WIP - Variable Export
This commit is contained in:
parent
ecc8afbab6
commit
7335f9bdb8
@ -1,28 +0,0 @@
|
|||||||
<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>
|
|
@ -1,39 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -128,7 +128,7 @@ namespace rabi_splitter_WPF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DebugContext : INotifyPropertyChanged
|
public class DebugContext : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
private int _entityAnalysisIndex;
|
private int _entityAnalysisIndex;
|
||||||
private bool _bossEvent;
|
private bool _bossEvent;
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
||||||
<local:InverseBooleanConverter x:Key="InverseBooleanConverter"/>
|
<local:InverseBooleanConverter x:Key="InverseBooleanConverter"/>
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
<DockPanel>
|
<TabControl>
|
||||||
|
<TabItem Header="Display">
|
||||||
<!--<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left">
|
<!--<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left">
|
||||||
<TextBlock Text="v0.3.2" Margin="0,0,30,0" VerticalAlignment="Top" />
|
<TextBlock Text="v0.3.2" Margin="0,0,30,0" VerticalAlignment="Top" />
|
||||||
<TextBlock Text="GitHub" MouseUp="TextBlock_MouseUp" Cursor="Hand" Foreground="Blue" TextDecorations="Underline" VerticalAlignment="Top" />
|
<TextBlock Text="GitHub" MouseUp="TextBlock_MouseUp" Cursor="Hand" Foreground="Blue" TextDecorations="Underline" VerticalAlignment="Top" />
|
||||||
@ -108,9 +109,11 @@
|
|||||||
<TextBox TextWrapping="Wrap" Text="{Binding DebugLog, Mode=TwoWay}" Grid.Row="1" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" TextChanged="TextBox_TextChanged" VerticalScrollBarVisibility="Visible"/>
|
<TextBox TextWrapping="Wrap" Text="{Binding DebugLog, Mode=TwoWay}" Grid.Row="1" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" TextChanged="TextBox_TextChanged" VerticalScrollBarVisibility="Visible"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</DockPanel>
|
</TabItem>
|
||||||
|
<TabItem Header="Variable Export">
|
||||||
|
<local:VariableExportTab x:Name="VariableExportTab" d:DataContext="{d:DesignData local:PracticeModeContext}"/>
|
||||||
|
</TabItem>
|
||||||
|
</TabControl>
|
||||||
</Window>
|
</Window>
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ namespace rabi_splitter_WPF
|
|||||||
private MainContext mainContext;
|
private MainContext mainContext;
|
||||||
private RabiRibiDisplay rabiRibiDisplay;
|
private RabiRibiDisplay rabiRibiDisplay;
|
||||||
private DebugContext debugContext;
|
private DebugContext debugContext;
|
||||||
|
private VariableExportContext variableExportContext;
|
||||||
private static TcpClient tcpclient;
|
private static TcpClient tcpclient;
|
||||||
private static NetworkStream networkStream;
|
private static NetworkStream networkStream;
|
||||||
private readonly Regex titleReg = new Regex(@"ver.*?(\d+\.?\d+.*)$");
|
private readonly Regex titleReg = new Regex(@"ver.*?(\d+\.?\d+.*)$");
|
||||||
@ -110,11 +111,14 @@ namespace rabi_splitter_WPF
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
mainContext=new MainContext();
|
mainContext=new MainContext();
|
||||||
debugContext=new DebugContext();
|
debugContext=new DebugContext();
|
||||||
|
variableExportContext = new VariableExportContext();
|
||||||
this.DataContext = mainContext;
|
this.DataContext = mainContext;
|
||||||
DebugPanel.DataContext = debugContext;
|
DebugPanel.DataContext = debugContext;
|
||||||
this.Grid.ItemsSource = debugContext.BossList;
|
this.Grid.ItemsSource = debugContext.BossList;
|
||||||
EntityDataPanel.DataContext = debugContext;
|
EntityDataPanel.DataContext = debugContext;
|
||||||
this.EntityStats.ItemsSource = debugContext.EntityStatsListView;
|
this.EntityStats.ItemsSource = debugContext.EntityStatsListView;
|
||||||
|
this.VariableExportTab.DataContext = variableExportContext;
|
||||||
|
this.VariableExportTab.Initialise(debugContext, variableExportContext);
|
||||||
BossEventDebug.DataContext = debugContext;
|
BossEventDebug.DataContext = debugContext;
|
||||||
rabiRibiDisplay = new RabiRibiDisplay(mainContext, debugContext, this);
|
rabiRibiDisplay = new RabiRibiDisplay(mainContext, debugContext, this);
|
||||||
memoryThread = new Thread(() =>
|
memoryThread = new Thread(() =>
|
||||||
|
43
rabi_splitter_WPF/VariableExportContext.cs
Normal file
43
rabi_splitter_WPF/VariableExportContext.cs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
using rabi_splitter_WPF.Annotations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace rabi_splitter_WPF
|
||||||
|
{
|
||||||
|
public class VariableExportContext : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
private List<VariableExportSetting> _variableExportSettings;
|
||||||
|
|
||||||
|
public VariableExportContext()
|
||||||
|
{
|
||||||
|
//_variableExportSettings = new List<VariableExportSetting>();
|
||||||
|
_variableExportSettings =
|
||||||
|
new List<VariableExportSetting>
|
||||||
|
{
|
||||||
|
new VariableExportSetting() {OutputFileName = "Test.txt" }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<VariableExportSetting> VariableExportSettings
|
||||||
|
{
|
||||||
|
get { return _variableExportSettings; }
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void Add(VariableExportSetting ves)
|
||||||
|
{
|
||||||
|
_variableExportSettings.Add(ves);
|
||||||
|
}
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
|
[NotifyPropertyChangedInvocator]
|
||||||
|
protected virtual void OnPropertyChanged(string propertyName)
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -7,17 +7,53 @@ using System.Text;
|
|||||||
|
|
||||||
namespace rabi_splitter_WPF
|
namespace rabi_splitter_WPF
|
||||||
{
|
{
|
||||||
class ExportableVariable
|
public class ExportableVariable
|
||||||
{
|
{
|
||||||
|
// Do not make these properties public.
|
||||||
|
private static int nextAvailableId = 0;
|
||||||
|
private readonly int _id;
|
||||||
|
private readonly string _displayName;
|
||||||
|
|
||||||
|
private ExportableVariable(string displayName)
|
||||||
public List<ExportableVariable> GetAll()
|
|
||||||
{
|
{
|
||||||
return new List<ExportableVariable>();
|
_id = nextAvailableId++;
|
||||||
}
|
_displayName = displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
class VariableExportSetting : INotifyPropertyChanged
|
public int Id
|
||||||
|
{
|
||||||
|
get { return _id; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string DisplayName
|
||||||
|
{
|
||||||
|
get { return _displayName; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<ExportableVariable> GetAll()
|
||||||
|
{
|
||||||
|
return new List<ExportableVariable>()
|
||||||
|
{
|
||||||
|
new ExportableVariable("TestVariable")
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Equals, GetHashCode
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
var otherValue = obj as ExportableVariable;
|
||||||
|
if (otherValue == null) return false;
|
||||||
|
return _id.Equals(otherValue.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return _id.GetHashCode();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
public class VariableExportSetting : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
private ExportableVariable _selectedVariable;
|
private ExportableVariable _selectedVariable;
|
||||||
private string _outputFileName;
|
private string _outputFileName;
|
||||||
@ -25,15 +61,18 @@ namespace rabi_splitter_WPF
|
|||||||
private bool _isExporting;
|
private bool _isExporting;
|
||||||
|
|
||||||
#region Dictionaries
|
#region Dictionaries
|
||||||
|
private static Dictionary<ExportableVariable, string> _variableCaptions;
|
||||||
// Captions for Split Trigger Options
|
|
||||||
private static readonly Dictionary<ExportableVariable, string> _variableCaptions = new Dictionary<ExportableVariable, string>()
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
public Dictionary<ExportableVariable, string> VariableCaptions
|
public Dictionary<ExportableVariable, string> VariableCaptions
|
||||||
{
|
{
|
||||||
get {return _variableCaptions;}
|
get
|
||||||
|
{
|
||||||
|
if (_variableCaptions == null)
|
||||||
|
{
|
||||||
|
_variableCaptions = ExportableVariable.GetAll().ToDictionary(ev => ev, ev => ev.DisplayName);
|
||||||
|
}
|
||||||
|
return _variableCaptions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
39
rabi_splitter_WPF/VariableExportTab.xaml
Normal file
39
rabi_splitter_WPF/VariableExportTab.xaml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<UserControl x:Class="rabi_splitter_WPF.VariableExportTab"
|
||||||
|
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="500" d:DesignWidth="900">
|
||||||
|
<DockPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<Button Content="Add" Width="40" Height="40" DockPanel.Dock="Right" Click="AddButton_Click"/>
|
||||||
|
</StackPanel>
|
||||||
|
<ListBox Name="VariableExportListBox" ItemsSource="{Binding VariableExportSettings}">
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid Name="MainPanel" Height="80" Width="500" DockPanel.Dock="Top">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<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"/>
|
||||||
|
<TextBox Text="{Binding Path=OutputFileName, Mode=TwoWay}"/>
|
||||||
|
</StackPanel>
|
||||||
|
<DockPanel Grid.Column="1">
|
||||||
|
<TextBox Text="{Binding Path=OutputFormat, Mode=TwoWay}" AcceptsReturn="True"/>
|
||||||
|
</DockPanel>
|
||||||
|
<DockPanel Grid.Column="2">
|
||||||
|
<ToggleButton Content="Export" DockPanel.Dock="Bottom" IsChecked="{Binding Path=IsExporting, Mode=TwoWay}"/>
|
||||||
|
</DockPanel>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
</DockPanel>
|
||||||
|
</UserControl>
|
46
rabi_splitter_WPF/VariableExportTab.xaml.cs
Normal file
46
rabi_splitter_WPF/VariableExportTab.xaml.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
using rabi_splitter_WPF.Annotations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
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 VariableExportTab.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class VariableExportTab : UserControl
|
||||||
|
{
|
||||||
|
private DebugContext debugContext;
|
||||||
|
private VariableExportContext variableExportContext;
|
||||||
|
|
||||||
|
public VariableExportTab()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialise(DebugContext debugContext, VariableExportContext variableExportContext)
|
||||||
|
{
|
||||||
|
this.debugContext = debugContext;
|
||||||
|
this.variableExportContext = variableExportContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var ves = new VariableExportSetting();
|
||||||
|
ves.OutputFileName = "Hello.txt";
|
||||||
|
variableExportContext.Add(ves);
|
||||||
|
VariableExportListBox.Items.Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -38,6 +38,8 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
@ -64,10 +66,11 @@
|
|||||||
<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">
|
<Compile Include="VariableExportContext.cs" />
|
||||||
<DependentUpon>ExportPanel.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="VariableExportSetting.cs" />
|
<Compile Include="VariableExportSetting.cs" />
|
||||||
|
<Compile Include="VariableExportTab.xaml.cs">
|
||||||
|
<DependentUpon>VariableExportTab.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Page Include="MainWindow.xaml">
|
<Page Include="MainWindow.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
@ -81,7 +84,7 @@
|
|||||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Page Include="ExportPanel.xaml">
|
<Page Include="VariableExportTab.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user