WIP - Variable Export

rabi_display
wcko87 8 years ago
parent ecc8afbab6
commit 7335f9bdb8
  1. 28
      rabi_splitter_WPF/ExportPanel.xaml
  2. 39
      rabi_splitter_WPF/ExportPanel.xaml.cs
  3. 2
      rabi_splitter_WPF/MainContext.cs
  4. 177
      rabi_splitter_WPF/MainWindow.xaml
  5. 4
      rabi_splitter_WPF/MainWindow.xaml.cs
  6. 43
      rabi_splitter_WPF/VariableExportContext.cs
  7. 59
      rabi_splitter_WPF/VariableExportSetting.cs
  8. 39
      rabi_splitter_WPF/VariableExportTab.xaml
  9. 46
      rabi_splitter_WPF/VariableExportTab.xaml.cs
  10. 11
      rabi_splitter_WPF/rabi_display.csproj

@ -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,107 +10,110 @@
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/> <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<local:InverseBooleanConverter x:Key="InverseBooleanConverter"/> <local:InverseBooleanConverter x:Key="InverseBooleanConverter"/>
</Window.Resources> </Window.Resources>
<DockPanel> <TabControl>
<!--<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left"> <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="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" />
</StackPanel>--> </StackPanel>-->
<DockPanel Margin="5" DockPanel.Dock="Top"> <DockPanel Margin="5" DockPanel.Dock="Top">
<StackPanel Margin="0,0,0,0" Width="500"> <StackPanel Margin="0,0,0,0" Width="500">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,0,0,3"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,0,0,3">
<TextBlock TextWrapping="Wrap" Text="LiveSplit Server Port" VerticalAlignment="Center" FontSize="16" Margin="0,0,10,0"/> <TextBlock TextWrapping="Wrap" Text="LiveSplit Server Port" VerticalAlignment="Center" FontSize="16" Margin="0,0,10,0"/>
<TextBox TextWrapping="Wrap" Text="{Binding ServerPort}" VerticalAlignment="Center" HorizontalAlignment="Center" VerticalContentAlignment="Center" FontSize="16" Padding="6,0"/> <TextBox TextWrapping="Wrap" Text="{Binding ServerPort}" VerticalAlignment="Center" HorizontalAlignment="Center" VerticalContentAlignment="Center" FontSize="16" Padding="6,0"/>
<Button x:Name="BtnConnect" Content="Connect" VerticalAlignment="Center" FontSize="16" Width="80" Click="BtnConnect_Click"/> <Button x:Name="BtnConnect" Content="Connect" VerticalAlignment="Center" FontSize="16" Width="80" Click="BtnConnect_Click"/>
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,0,0,3"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,0,0,3">
<TextBlock TextWrapping="Wrap" Text="Rabi-Ribi Status:" FontSize="16"/> <TextBlock TextWrapping="Wrap" Text="Rabi-Ribi Status:" FontSize="16"/>
<TextBlock TextWrapping="Wrap" Text="{Binding GameVer}" FontSize="16"/> <TextBlock TextWrapping="Wrap" Text="{Binding GameVer}" FontSize="16"/>
</StackPanel> </StackPanel>
<Grid Height="500"> <Grid Height="500">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="3*"/> <RowDefinition Height="3*"/>
<RowDefinition Height="3*"/> <RowDefinition Height="3*"/>
<RowDefinition Height="3*"/> <RowDefinition Height="3*"/>
<RowDefinition Height="3*"/> <RowDefinition Height="3*"/>
<RowDefinition Height="3*"/> <RowDefinition Height="3*"/>
<RowDefinition Height="3*"/> <RowDefinition Height="3*"/>
<RowDefinition Height="3*"/> <RowDefinition Height="3*"/>
<RowDefinition Height="3*"/> <RowDefinition Height="3*"/>
<RowDefinition Height="3*"/> <RowDefinition Height="3*"/>
<RowDefinition Height="3*"/> <RowDefinition Height="3*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/> <ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/> <ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/> <ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Text1}" FontSize="16"/> <TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Text1}" FontSize="16"/>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Text2}" FontSize="16"/> <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Text2}" FontSize="16"/>
<TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding Text3}" FontSize="16"/> <TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding Text3}" FontSize="16"/>
<TextBlock Grid.Row="1" Grid.Column="0" Text="{Binding Text4}" FontSize="16"/> <TextBlock Grid.Row="1" Grid.Column="0" Text="{Binding Text4}" FontSize="16"/>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Text5}" FontSize="16"/> <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Text5}" FontSize="16"/>
<TextBlock Grid.Row="1" Grid.Column="2" Text="{Binding Text6}" FontSize="16"/> <TextBlock Grid.Row="1" Grid.Column="2" Text="{Binding Text6}" FontSize="16"/>
<TextBlock Grid.Row="2" Grid.Column="0" Text="{Binding Text7}" FontSize="16"/> <TextBlock Grid.Row="2" Grid.Column="0" Text="{Binding Text7}" FontSize="16"/>
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Text8}" FontSize="16"/> <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Text8}" FontSize="16"/>
<TextBlock Grid.Row="2" Grid.Column="2" Text="{Binding Text9}" FontSize="16"/> <TextBlock Grid.Row="2" Grid.Column="2" Text="{Binding Text9}" FontSize="16"/>
<TextBlock Grid.Row="3" Grid.Column="0" Text="{Binding Text10}" FontSize="16"/> <TextBlock Grid.Row="3" Grid.Column="0" Text="{Binding Text10}" FontSize="16"/>
<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding Text11}" FontSize="16"/> <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding Text11}" FontSize="16"/>
<TextBlock Grid.Row="3" Grid.Column="2" Text="{Binding Text12}" FontSize="16"/> <TextBlock Grid.Row="3" Grid.Column="2" Text="{Binding Text12}" FontSize="16"/>
<TextBlock Grid.Row="4" Grid.ColumnSpan="2" Grid.Column="0" TextWrapping="Wrap" Text="{Binding Text13}" FontSize="16"/> <TextBlock Grid.Row="4" Grid.ColumnSpan="2" Grid.Column="0" TextWrapping="Wrap" Text="{Binding Text13}" FontSize="16"/>
<TextBlock Grid.Row="4" Grid.Column="2" Text="{Binding Text14}" FontSize="16"/> <TextBlock Grid.Row="4" Grid.Column="2" Text="{Binding Text14}" FontSize="16"/>
<ScrollViewer Grid.Row="5" Grid.RowSpan="5" Grid.ColumnSpan="2" Grid.Column="0" > <ScrollViewer Grid.Row="5" Grid.RowSpan="5" Grid.ColumnSpan="2" Grid.Column="0" >
<TextBlock TextWrapping="Wrap" Text="{Binding Text20}" FontSize="16"/> <TextBlock TextWrapping="Wrap" Text="{Binding Text20}" FontSize="16"/>
</ScrollViewer> </ScrollViewer>
<TextBlock Grid.Row="5" Grid.Column="2" Text="{Binding Text15}" FontSize="16"/> <TextBlock Grid.Row="5" Grid.Column="2" Text="{Binding Text15}" FontSize="16"/>
<TextBlock Grid.Row="6" Grid.Column="2" Text="{Binding Text16}" FontSize="16"/> <TextBlock Grid.Row="6" Grid.Column="2" Text="{Binding Text16}" FontSize="16"/>
<TextBlock Grid.Row="7" Grid.Column="2" Text="{Binding Text17}" FontSize="16"/> <TextBlock Grid.Row="7" Grid.Column="2" Text="{Binding Text17}" FontSize="16"/>
<TextBlock Grid.Row="8" Grid.Column="2" Text="{Binding Text18}" FontSize="16"/> <TextBlock Grid.Row="8" Grid.Column="2" Text="{Binding Text18}" FontSize="16"/>
<TextBlock Grid.Row="9" Grid.Column="2" Text="{Binding Text19}" FontSize="16"/> <TextBlock Grid.Row="9" Grid.Column="2" Text="{Binding Text19}" FontSize="16"/>
</Grid> </Grid>
</StackPanel> </StackPanel>
<DockPanel x:Name="EntityDataPanel" d:DataContext="{d:DesignData local:DebugContext}"> <DockPanel x:Name="EntityDataPanel" d:DataContext="{d:DesignData local:DebugContext}">
<TextBox Width="100" DockPanel.Dock="Top" TextWrapping="Wrap" Text="{Binding EntityAnalysisIndex}" VerticalAlignment="Center" HorizontalAlignment="Center" VerticalContentAlignment="Center" FontSize="16" Padding="0,0"/> <TextBox Width="100" DockPanel.Dock="Top" TextWrapping="Wrap" Text="{Binding EntityAnalysisIndex}" VerticalAlignment="Center" HorizontalAlignment="Center" VerticalContentAlignment="Center" FontSize="16" Padding="0,0"/>
<DataGrid Width="250" x:Name="EntityStats" ItemsSource="{Binding EntityStatsListView}" CanUserAddRows="False" IsReadOnly="True" AutoGenerateColumns="False" SelectionUnit="FullRow" <DataGrid Width="250" x:Name="EntityStats" ItemsSource="{Binding EntityStatsListView}" CanUserAddRows="False" IsReadOnly="True" AutoGenerateColumns="False" SelectionUnit="FullRow"
d:DataContext="{d:DesignData local:EntityStatsData}"> d:DataContext="{d:DesignData local:EntityStatsData}">
<DataGrid.Columns>
<DataGridTextColumn Width="2*" Binding="{Binding Addr}" ClipboardContentBinding="{Binding Addr}" Header="Addr"/>
<DataGridTextColumn Width="3*" Binding="{Binding IntVal}" ClipboardContentBinding="{Binding IntVal}" Header="int"/>
<DataGridTextColumn Width="3*" Binding="{Binding FloatVal}" ClipboardContentBinding="{Binding FloatVal}" Header="float"/>
</DataGrid.Columns>
</DataGrid>
<!--<ScrollViewer Width="250">
<TextBlock TextWrapping="Wrap" Text="{Binding Text18}" FontSize="16"/>
</ScrollViewer>-->
</DockPanel>
<DockPanel>
<TextBlock TextWrapping="Wrap" Text="debug area" Height="15.24" Width="352.251" DockPanel.Dock="Top"/>
<CheckBox x:Name="BossEventDebug" IsEnabled="False" Content="(DEBUG)BOSS event tracked" FontSize="15" VerticalAlignment="Top" HorizontalAlignment="Left" IsChecked="{Binding BossEvent, Mode=TwoWay}" DockPanel.Dock="Top"/>
<Grid x:Name="DebugPanel" d:DataContext="{d:DesignData local:DebugContext}" DockPanel.Dock="Top">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<DataGrid x:Name="Grid" ItemsSource="{Binding BossList}" CanUserAddRows="False" IsReadOnly="True" AutoGenerateColumns="False" SelectionUnit="FullRow"
d:DataContext="{d:DesignData local:BossData}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn Binding="{Binding BossIdx}" ClipboardContentBinding="{Binding BossIdx}" Header="Index"/> <DataGridTextColumn Width="2*" Binding="{Binding Addr}" ClipboardContentBinding="{Binding Addr}" Header="Addr"/>
<DataGridTextColumn Binding="{Binding BossID}" ClipboardContentBinding="{Binding BossID}" Header="Entity ID"/> <DataGridTextColumn Width="3*" Binding="{Binding IntVal}" ClipboardContentBinding="{Binding IntVal}" Header="int"/>
<DataGridTextColumn Binding="{Binding BossHP}" ClipboardContentBinding="{Binding BossHP}" Header="HP"/> <DataGridTextColumn Width="3*" Binding="{Binding FloatVal}" ClipboardContentBinding="{Binding FloatVal}" Header="float"/>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<TextBox TextWrapping="Wrap" Text="{Binding DebugLog, Mode=TwoWay}" Grid.Row="1" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" TextChanged="TextBox_TextChanged" VerticalScrollBarVisibility="Visible"/> <!--<ScrollViewer Width="250">
</Grid> <TextBlock TextWrapping="Wrap" Text="{Binding Text18}" FontSize="16"/>
</ScrollViewer>-->
</DockPanel>
<DockPanel>
<TextBlock TextWrapping="Wrap" Text="debug area" Height="15.24" Width="352.251" DockPanel.Dock="Top"/>
<CheckBox x:Name="BossEventDebug" IsEnabled="False" Content="(DEBUG)BOSS event tracked" FontSize="15" VerticalAlignment="Top" HorizontalAlignment="Left" IsChecked="{Binding BossEvent, Mode=TwoWay}" DockPanel.Dock="Top"/>
<Grid x:Name="DebugPanel" d:DataContext="{d:DesignData local:DebugContext}" DockPanel.Dock="Top">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<DataGrid x:Name="Grid" ItemsSource="{Binding BossList}" CanUserAddRows="False" IsReadOnly="True" AutoGenerateColumns="False" SelectionUnit="FullRow"
d:DataContext="{d:DesignData local:BossData}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding BossIdx}" ClipboardContentBinding="{Binding BossIdx}" Header="Index"/>
<DataGridTextColumn Binding="{Binding BossID}" ClipboardContentBinding="{Binding BossID}" Header="Entity ID"/>
<DataGridTextColumn Binding="{Binding BossHP}" ClipboardContentBinding="{Binding BossHP}" Header="HP"/>
</DataGrid.Columns>
</DataGrid>
<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>
</DockPanel> <TabItem Header="Variable Export">
</DockPanel> <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(() =>

@ -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)
{
_id = nextAvailableId++;
_displayName = displayName;
}
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 List<ExportableVariable> GetAll() public override int GetHashCode()
{ {
return new List<ExportableVariable>(); return _id.GetHashCode();
} }
#endregion
} }
class VariableExportSetting : INotifyPropertyChanged 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

@ -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>

@ -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…
Cancel
Save