Can add / remove variable exports in list
This commit is contained in:
parent
7335f9bdb8
commit
292f0785c6
@ -26,12 +26,17 @@ namespace rabi_splitter_WPF
|
||||
{
|
||||
get { return _variableExportSettings; }
|
||||
}
|
||||
|
||||
|
||||
internal void Add(VariableExportSetting ves)
|
||||
{
|
||||
_variableExportSettings.Add(ves);
|
||||
}
|
||||
|
||||
internal void Delete(VariableExportSetting ves)
|
||||
{
|
||||
_variableExportSettings.Remove(ves);
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
|
@ -74,9 +74,14 @@ namespace rabi_splitter_WPF
|
||||
return _variableCaptions;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal void DefaultButton_Click()
|
||||
{
|
||||
OutputFormat = "DEFAULT OUTPUT FORMAT: " + OutputFileName;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public VariableExportSetting()
|
||||
{
|
||||
// Default values
|
||||
|
@ -5,7 +5,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:rabi_splitter_WPF"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="500" d:DesignWidth="900">
|
||||
d:DesignHeight="500" d:DesignWidth="540">
|
||||
<DockPanel>
|
||||
<StackPanel>
|
||||
<Button Content="Add" Width="40" Height="40" DockPanel.Dock="Right" Click="AddButton_Click"/>
|
||||
@ -13,23 +13,30 @@
|
||||
<ListBox Name="VariableExportListBox" ItemsSource="{Binding VariableExportSettings}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Name="MainPanel" Height="80" Width="500" DockPanel.Dock="Top">
|
||||
<Grid Name="MainPanel" Height="80" Width="500" DockPanel.Dock="Top" Margin="5,0,5,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="4*" />
|
||||
<ColumnDefinition Width="6*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="3*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<TextBlock Text="Variable"/>
|
||||
<ComboBox ItemsSource="{Binding Path=VariableCaptions}" DisplayMemberPath="Value" SelectedValuePath="Key" SelectedValue="{Binding Path=SelectedVariable, Mode=TwoWay}"/>
|
||||
<TextBlock Text="Output File"/>
|
||||
<TextBlock Text="Output File" Margin="0,2,0,0"/>
|
||||
<TextBox Text="{Binding Path=OutputFileName, Mode=TwoWay}"/>
|
||||
</StackPanel>
|
||||
<DockPanel Grid.Column="1">
|
||||
<TextBox Text="{Binding Path=OutputFormat, Mode=TwoWay}" AcceptsReturn="True"/>
|
||||
<DockPanel Grid.Column="1" Margin="15,0,15,0">
|
||||
<DockPanel>
|
||||
<DockPanel DockPanel.Dock="Top">
|
||||
<TextBlock DockPanel.Dock="Left" Text="Format"/>
|
||||
<Button DockPanel.Dock="Right" Content="Default Format" Click="DefaultButton_Click" Width="120" HorizontalAlignment="Right"/>
|
||||
</DockPanel>
|
||||
<TextBox Margin="0,5,0,5" Text="{Binding Path=OutputFormat, Mode=TwoWay}" AcceptsReturn="True"/>
|
||||
</DockPanel>
|
||||
</DockPanel>
|
||||
<DockPanel Grid.Column="2">
|
||||
<ToggleButton Content="Export" DockPanel.Dock="Bottom" IsChecked="{Binding Path=IsExporting, Mode=TwoWay}"/>
|
||||
<Button Content="X" DockPanel.Dock="Top" Width="20" HorizontalAlignment="Right" Click="CloseButton_Click"/>
|
||||
<ToggleButton Margin="5,5,5,5" Content="Export" DockPanel.Dock="Bottom" IsChecked="{Binding Path=IsExporting, Mode=TwoWay}"/>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
@ -42,5 +42,18 @@ namespace rabi_splitter_WPF
|
||||
variableExportContext.Add(ves);
|
||||
VariableExportListBox.Items.Refresh();
|
||||
}
|
||||
|
||||
private void CloseButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var variableExportSetting = (sender as Button).DataContext as VariableExportSetting;
|
||||
variableExportContext.Delete(variableExportSetting);
|
||||
VariableExportListBox.Items.Refresh();
|
||||
}
|
||||
|
||||
private void DefaultButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var variableExportSetting = (sender as Button).DataContext as VariableExportSetting;
|
||||
variableExportSetting.DefaultButton_Click();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user