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 bool _bossEvent;
|
||||
|
@ -10,7 +10,8 @@
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
||||
<local:InverseBooleanConverter x:Key="InverseBooleanConverter"/>
|
||||
</Window.Resources>
|
||||
<DockPanel>
|
||||
<TabControl>
|
||||
<TabItem Header="Display">
|
||||
<!--<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left">
|
||||
<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" />
|
||||
@ -108,9 +109,11 @@
|
||||
<TextBox TextWrapping="Wrap" Text="{Binding DebugLog, Mode=TwoWay}" Grid.Row="1" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" TextChanged="TextBox_TextChanged" VerticalScrollBarVisibility="Visible"/>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
|
||||
</DockPanel>
|
||||
</DockPanel>
|
||||
|
||||
</TabItem>
|
||||
<TabItem Header="Variable Export">
|
||||
<local:VariableExportTab x:Name="VariableExportTab" d:DataContext="{d:DesignData local:PracticeModeContext}"/>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</Window>
|
||||
|
||||
|
@ -27,6 +27,7 @@ namespace rabi_splitter_WPF
|
||||
private MainContext mainContext;
|
||||
private RabiRibiDisplay rabiRibiDisplay;
|
||||
private DebugContext debugContext;
|
||||
private VariableExportContext variableExportContext;
|
||||
private static TcpClient tcpclient;
|
||||
private static NetworkStream networkStream;
|
||||
private readonly Regex titleReg = new Regex(@"ver.*?(\d+\.?\d+.*)$");
|
||||
@ -110,11 +111,14 @@ namespace rabi_splitter_WPF
|
||||
InitializeComponent();
|
||||
mainContext=new MainContext();
|
||||
debugContext=new DebugContext();
|
||||
variableExportContext = new VariableExportContext();
|
||||
this.DataContext = mainContext;
|
||||
DebugPanel.DataContext = debugContext;
|
||||
this.Grid.ItemsSource = debugContext.BossList;
|
||||
EntityDataPanel.DataContext = debugContext;
|
||||
this.EntityStats.ItemsSource = debugContext.EntityStatsListView;
|
||||
this.VariableExportTab.DataContext = variableExportContext;
|
||||
this.VariableExportTab.Initialise(debugContext, variableExportContext);
|
||||
BossEventDebug.DataContext = debugContext;
|
||||
rabiRibiDisplay = new RabiRibiDisplay(mainContext, debugContext, this);
|
||||
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
|
||||
{
|
||||
class ExportableVariable
|
||||
public class ExportableVariable
|
||||
{
|
||||
// Do not make these properties public.
|
||||
private static int nextAvailableId = 0;
|
||||
private readonly int _id;
|
||||
private readonly string _displayName;
|
||||
|
||||
|
||||
public List<ExportableVariable> GetAll()
|
||||
private ExportableVariable(string displayName)
|
||||
{
|
||||
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 string _outputFileName;
|
||||
@ -25,15 +61,18 @@ namespace rabi_splitter_WPF
|
||||
private bool _isExporting;
|
||||
|
||||
#region Dictionaries
|
||||
|
||||
// Captions for Split Trigger Options
|
||||
private static readonly Dictionary<ExportableVariable, string> _variableCaptions = new Dictionary<ExportableVariable, string>()
|
||||
{
|
||||
};
|
||||
private static 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
|
||||
|
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>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
@ -64,10 +66,11 @@
|
||||
<Compile Include="RabiRibiDisplay.cs" />
|
||||
<Compile Include="RabiRibiState.cs" />
|
||||
<Compile Include="StaticData.cs" />
|
||||
<Compile Include="ExportPanel.xaml.cs">
|
||||
<DependentUpon>ExportPanel.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="VariableExportContext.cs" />
|
||||
<Compile Include="VariableExportSetting.cs" />
|
||||
<Compile Include="VariableExportTab.xaml.cs">
|
||||
<DependentUpon>VariableExportTab.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@ -81,7 +84,7 @@
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="ExportPanel.xaml">
|
||||
<Page Include="VariableExportTab.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
|
Loading…
x
Reference in New Issue
Block a user