From ecc8afbab60d660653674d1a5ed78ad30905ec7d Mon Sep 17 00:00:00 2001 From: wcko87 Date: Tue, 9 May 2017 08:38:56 +0800 Subject: [PATCH] Some groundwork for variable export --- rabi_splitter_WPF/ExportPanel.xaml | 28 ++++++ rabi_splitter_WPF/ExportPanel.xaml.cs | 39 ++++++++ rabi_splitter_WPF/VariableExportSetting.cs | 108 +++++++++++++++++++++ rabi_splitter_WPF/rabi_display.csproj | 8 ++ 4 files changed, 183 insertions(+) create mode 100644 rabi_splitter_WPF/ExportPanel.xaml create mode 100644 rabi_splitter_WPF/ExportPanel.xaml.cs create mode 100644 rabi_splitter_WPF/VariableExportSetting.cs diff --git a/rabi_splitter_WPF/ExportPanel.xaml b/rabi_splitter_WPF/ExportPanel.xaml new file mode 100644 index 0000000..ba5ce5b --- /dev/null +++ b/rabi_splitter_WPF/ExportPanel.xaml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/rabi_splitter_WPF/ExportPanel.xaml.cs b/rabi_splitter_WPF/ExportPanel.xaml.cs new file mode 100644 index 0000000..621a2e3 --- /dev/null +++ b/rabi_splitter_WPF/ExportPanel.xaml.cs @@ -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 +{ + /// + /// Interaction logic for ExportPanel.xaml + /// + 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; + } + } +} diff --git a/rabi_splitter_WPF/VariableExportSetting.cs b/rabi_splitter_WPF/VariableExportSetting.cs new file mode 100644 index 0000000..ecc614b --- /dev/null +++ b/rabi_splitter_WPF/VariableExportSetting.cs @@ -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 GetAll() + { + return new List(); + } + } + + 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 _variableCaptions = new Dictionary() + { + }; + + public Dictionary 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)); + } + + } +} diff --git a/rabi_splitter_WPF/rabi_display.csproj b/rabi_splitter_WPF/rabi_display.csproj index 8572f5a..cdc0d4a 100644 --- a/rabi_splitter_WPF/rabi_display.csproj +++ b/rabi_splitter_WPF/rabi_display.csproj @@ -64,6 +64,10 @@ + + ExportPanel.xaml + + MSBuild:Compile Designer @@ -77,6 +81,10 @@ MainWindow.xaml Code + + Designer + MSBuild:Compile +