Change shear calculator add crack export to excel
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews"
|
||||
xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
|
||||
d:DataContext="{d:DesignInstance local:CrackResultViewModel}"
|
||||
mc:Ignorable="d"
|
||||
Title="Result of calculations of crack" Height="450" Width="800" MinHeight="300" MinWidth="600" MaxHeight="800" MaxWidth="1000" WindowStartupLocation="CenterScreen">
|
||||
@@ -16,7 +17,7 @@
|
||||
</Window.Resources>
|
||||
<DockPanel>
|
||||
<ToolBarTray DockPanel.Dock="Top">
|
||||
<ToolBar>
|
||||
<ToolBar ToolTip="Rebar results">
|
||||
<Button Style="{DynamicResource ToolButton}" Command="{Binding ShowRebarsCommand}" ToolTip="Show results by rebars">
|
||||
<Viewbox>
|
||||
<ContentControl ContentTemplate="{DynamicResource ShowRebarsResult}"/>
|
||||
@@ -28,6 +29,18 @@
|
||||
</Viewbox>
|
||||
</Button>
|
||||
</ToolBar>
|
||||
<ToolBar ToolTip="Export">
|
||||
<Button Style="{DynamicResource ToolButton}" Command="{Binding ExportToCSVCommand}">
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Export to *.csv"
|
||||
IconContent="{StaticResource ExportToXLS}"
|
||||
DescriptionText="Export all valid results to *.csv file"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox>
|
||||
<ContentControl ContentTemplate="{DynamicResource ExportToXLS}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
</ToolBar>
|
||||
</ToolBarTray>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
@@ -115,26 +128,7 @@
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<TextBlock Grid.Row="1" Text="{Binding CrackResult.Description}"/>
|
||||
<StatusBar Grid.Row="2">
|
||||
<StatusBarItem>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Valid result(s): "/>
|
||||
<TextBlock Text="{Binding ValidResultCount}"/>
|
||||
</StackPanel>
|
||||
</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Invalid result(s): "/>
|
||||
<TextBlock Text="{Binding InvalidResultCount}"/>
|
||||
</StackPanel>
|
||||
</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Total: "/>
|
||||
<TextBlock Text="{Binding TotalResultCount}"/>
|
||||
</StackPanel>
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
<ContentControl Grid.Row="2" ContentTemplate="{StaticResource ResultValidness}" Content="{Binding ValidResultCounter}"/>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</Window>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Services.Exports;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
@@ -12,16 +11,14 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
public class CrackResultViewModel : ViewModelBase
|
||||
{
|
||||
IShowCrackIsoFieldsLogic showCrackIsoFieldsLogic => new ShowCrackIsoFieldsLogic();
|
||||
private CrackResult resultModel;
|
||||
private ICrackResult resultModel;
|
||||
private RelayCommand? showIsoFieldCommand;
|
||||
private RelayCommand? showRebarsCommand;
|
||||
|
||||
public int ValidResultCount => resultModel.TupleResults.Count(x => x.IsValid == true);
|
||||
public int InvalidResultCount => resultModel.TupleResults.Count(x => x.IsValid == false);
|
||||
public int TotalResultCount => resultModel.TupleResults.Count;
|
||||
private RelayCommand exportToCSVCommand;
|
||||
|
||||
public TupleCrackResult SelectedResult { get; set; }
|
||||
public List<ITupleCrackResult> TupleResults => CrackResult.TupleResults;
|
||||
public ValidResultCounterVM ValidResultCounter { get; }
|
||||
public ICommand ShowRebarsCommand
|
||||
{
|
||||
get
|
||||
@@ -45,11 +42,25 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews
|
||||
}
|
||||
}
|
||||
|
||||
public CrackResult CrackResult => resultModel;
|
||||
public ICrackResult CrackResult => resultModel;
|
||||
|
||||
public CrackResultViewModel(CrackResult crackResult)
|
||||
public CrackResultViewModel(ICrackResult crackResult)
|
||||
{
|
||||
this.resultModel = crackResult;
|
||||
ValidResultCounter = new(resultModel.TupleResults);
|
||||
}
|
||||
|
||||
public ICommand ExportToCSVCommand => exportToCSVCommand ??= new RelayCommand(o => { ExportToCSV(); });
|
||||
private void ExportToCSV()
|
||||
{
|
||||
var inputData = new ExportToFileInputData
|
||||
{
|
||||
Filter = "csv |*.csv",
|
||||
Title = "Save in *.csv File"
|
||||
};
|
||||
var logic = new ExportCrackResultToCSVLogic(resultModel);
|
||||
var exportService = new ExportToFileService(inputData, logic);
|
||||
exportService.Export();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,18 +131,7 @@ namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalcu
|
||||
}, o => SelectedResult != null && SelectedResult.IsValid));
|
||||
}
|
||||
}
|
||||
public ICommand ExportToCSVCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return exportToCSVCommand ??
|
||||
(exportToCSVCommand = new RelayCommand(o =>
|
||||
{
|
||||
ExportToCSV();
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
public ICommand ExportToCSVCommand => exportToCSVCommand ??= new RelayCommand(o => { ExportToCSV();});
|
||||
private void ExportToCSV()
|
||||
{
|
||||
var inputData = new ExportToFileInputData
|
||||
|
||||
Reference in New Issue
Block a user