Some groundwork for variable export
This commit is contained in:
parent
ce1b59d51f
commit
ecc8afbab6
28
rabi_splitter_WPF/ExportPanel.xaml
Normal file
28
rabi_splitter_WPF/ExportPanel.xaml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<UserControl x:Class="rabi_splitter_WPF.ExportPanel"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:rabi_splitter_WPF"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="80" d:DesignWidth="360">
|
||||||
|
<Grid Name="MainPanel" Height="80">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="2*" />
|
||||||
|
<ColumnDefinition Width="3*" />
|
||||||
|
<ColumnDefinition Width="1*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Grid.Column="0">
|
||||||
|
<TextBlock Text="Variable"/>
|
||||||
|
<ComboBox ItemsSource="{Binding VariableExportObject.VariableCaptions}" DisplayMemberPath="Value" SelectedValuePath="Key" SelectedValue="{Binding Path=VariableExportObject.SelectedVariable, Mode=TwoWay}"/>
|
||||||
|
<TextBlock Text="Output File"/>
|
||||||
|
<TextBox Text="{Binding Path=VariableExportObject.OutputFileName, Mode=TwoWay}"/>
|
||||||
|
</StackPanel>
|
||||||
|
<DockPanel Grid.Column="1">
|
||||||
|
<TextBox Text="{Binding Path=VariableExportObject.OutputFormat, Mode=TwoWay}"/>
|
||||||
|
</DockPanel>
|
||||||
|
<DockPanel Grid.Column="2">
|
||||||
|
<ToggleButton Content="Export" DockPanel.Dock="Bottom" IsChecked="{Binding Path=VariableExportObject.IsExporting, Mode=TwoWay}"/>
|
||||||
|
</DockPanel>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
39
rabi_splitter_WPF/ExportPanel.xaml.cs
Normal file
39
rabi_splitter_WPF/ExportPanel.xaml.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace rabi_splitter_WPF
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for ExportPanel.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ExportPanel : UserControl
|
||||||
|
{
|
||||||
|
public object VariableExportObject
|
||||||
|
{
|
||||||
|
get { return (object)GetValue(VariableExportObjectProperty); }
|
||||||
|
set { SetValue(VariableExportObjectProperty, value); }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly DependencyProperty VariableExportObjectProperty =
|
||||||
|
DependencyProperty.Register("VariableExportObject", typeof(object),
|
||||||
|
typeof(VariableExportSetting), new PropertyMetadata(null));
|
||||||
|
|
||||||
|
public ExportPanel()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.MainPanel.DataContext = this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
108
rabi_splitter_WPF/VariableExportSetting.cs
Normal file
108
rabi_splitter_WPF/VariableExportSetting.cs
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
using rabi_splitter_WPF.Annotations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace rabi_splitter_WPF
|
||||||
|
{
|
||||||
|
class ExportableVariable
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public List<ExportableVariable> GetAll()
|
||||||
|
{
|
||||||
|
return new List<ExportableVariable>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class VariableExportSetting : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
private ExportableVariable _selectedVariable;
|
||||||
|
private string _outputFileName;
|
||||||
|
private string _outputFormat;
|
||||||
|
private bool _isExporting;
|
||||||
|
|
||||||
|
#region Dictionaries
|
||||||
|
|
||||||
|
// Captions for Split Trigger Options
|
||||||
|
private static readonly Dictionary<ExportableVariable, string> _variableCaptions = new Dictionary<ExportableVariable, string>()
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
public Dictionary<ExportableVariable, string> VariableCaptions
|
||||||
|
{
|
||||||
|
get {return _variableCaptions;}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public VariableExportSetting()
|
||||||
|
{
|
||||||
|
// Default values
|
||||||
|
_selectedVariable = null;
|
||||||
|
_outputFileName = "";
|
||||||
|
_outputFormat = "";
|
||||||
|
_isExporting = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Parameters
|
||||||
|
|
||||||
|
public ExportableVariable SelectedVariable
|
||||||
|
{
|
||||||
|
get { return _selectedVariable; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value.Equals(_selectedVariable)) return;
|
||||||
|
_selectedVariable = value;
|
||||||
|
OnPropertyChanged(nameof(SelectedVariable));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string OutputFileName
|
||||||
|
{
|
||||||
|
get { return _outputFileName; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value.Equals(_outputFileName)) return;
|
||||||
|
_outputFileName = value;
|
||||||
|
OnPropertyChanged(nameof(OutputFileName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string OutputFormat
|
||||||
|
{
|
||||||
|
get { return _outputFormat; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value.Equals(_outputFormat)) return;
|
||||||
|
_outputFormat = value;
|
||||||
|
OnPropertyChanged(nameof(OutputFormat));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsExporting
|
||||||
|
{
|
||||||
|
get { return _isExporting; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value.Equals(_isExporting)) return;
|
||||||
|
_isExporting = value;
|
||||||
|
OnPropertyChanged(nameof(IsExporting));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
|
[NotifyPropertyChangedInvocator]
|
||||||
|
protected virtual void OnPropertyChanged(string propertyName)
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -64,6 +64,10 @@
|
|||||||
<Compile Include="RabiRibiDisplay.cs" />
|
<Compile Include="RabiRibiDisplay.cs" />
|
||||||
<Compile Include="RabiRibiState.cs" />
|
<Compile Include="RabiRibiState.cs" />
|
||||||
<Compile Include="StaticData.cs" />
|
<Compile Include="StaticData.cs" />
|
||||||
|
<Compile Include="ExportPanel.xaml.cs">
|
||||||
|
<DependentUpon>ExportPanel.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="VariableExportSetting.cs" />
|
||||||
<Page Include="MainWindow.xaml">
|
<Page Include="MainWindow.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
@ -77,6 +81,10 @@
|
|||||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Page Include="ExportPanel.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="MemoryHelper.cs" />
|
<Compile Include="MemoryHelper.cs" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user