UpdateStrategy for Actions was added
This commit is contained in:
@@ -407,6 +407,10 @@ namespace StructureHelper.Windows.MainWindow
|
||||
{
|
||||
GlobalRepository.Materials.Create(item);
|
||||
}
|
||||
foreach (var item in newRepository.ForceActions)
|
||||
{
|
||||
GlobalRepository.Actions.Create(item);
|
||||
}
|
||||
return primitives;
|
||||
}
|
||||
return new List<PrimitiveBase>();
|
||||
|
||||
@@ -15,13 +15,12 @@
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition Width="280"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<ListBox ItemsSource="{Binding HeadMaterials}" SelectedItem="{Binding SelectedMaterial}" SelectionChanged="ListBox_SelectionChanged">
|
||||
<ListBox ItemsSource="{Binding HeadMaterials}" SelectedItem="{Binding SelectedMaterial}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
@@ -42,19 +41,7 @@
|
||||
</ListBox>
|
||||
</Grid>
|
||||
<StackPanel Grid.Column="1">
|
||||
<Button Content="New Concrete" Command="{Binding AddNewConcreteMaterialCommand}"/>
|
||||
<Button Content="New Reinforcement" Command="{Binding AddNewReinforcementMaterialCommand}"/>
|
||||
<Button Content="New Elastic Material" Command="{Binding AddElasticMaterialCommand}"/>
|
||||
<Button Content="Show diagram" Command="{Binding ShowMaterialDiagram}"/>
|
||||
<Button Content="Edit color" Command="{Binding EditColorCommand}"/>
|
||||
<Button Content="Edit" Command="{Binding EditCommand}"/>
|
||||
<Button Content="Copy" Command="{Binding CopyHeadMaterialCommand}"/>
|
||||
<Button Content="Delete" Command="{Binding DeleteMaterialCommand}"/>
|
||||
</StackPanel>
|
||||
<StackPanel x:Name="MatProps" Grid.Column="2">
|
||||
<TextBlock Text="Name"/>
|
||||
<TextBox Text="{Binding SelectedMaterial.Name}"/>
|
||||
<StackPanel x:Name="StpMaterialProperties"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -33,37 +33,5 @@ namespace StructureHelper.Windows.MainWindow.Materials
|
||||
this.DataContext = viewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
StpMaterialProperties.Children.Clear();
|
||||
var selectedMaterial = viewModel.SelectedMaterial;
|
||||
if (selectedMaterial == null) { return; }
|
||||
var helperMaterial = selectedMaterial.HelperMaterial;
|
||||
string dataTemplateName = string.Empty;
|
||||
Binding binding = new Binding();
|
||||
if (helperMaterial is IConcreteLibMaterial)
|
||||
{
|
||||
dataTemplateName = "ConcreteLibMaterial";
|
||||
binding.Source = viewModel;
|
||||
}
|
||||
else if (helperMaterial is IReinforcementLibMaterial)
|
||||
{
|
||||
dataTemplateName = "ReinforcementLibMaterial";
|
||||
binding.Source = viewModel;
|
||||
}
|
||||
else if (helperMaterial is IElasticMaterial)
|
||||
{
|
||||
dataTemplateName = "ElasticMaterial";
|
||||
binding.Source = viewModel.SelectedMaterial.HelperMaterial;
|
||||
}
|
||||
if (dataTemplateName != string.Empty)
|
||||
{
|
||||
ContentControl contentControl = new ContentControl();
|
||||
contentControl.SetResourceReference(ContentTemplateProperty, dataTemplateName);
|
||||
contentControl.SetBinding(ContentProperty, binding);
|
||||
StpMaterialProperties.Children.Add(contentControl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user