aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Utilities/Tango.MachineEM.UI
diff options
context:
space:
mode:
authorMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
committerMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
commit00a491d93733d4625ad329b2ba8237f445364b3f (patch)
tree4b24c6fa78d7648f4bb7cefafa464bb0b063fec4 /Software/Visual_Studio/Utilities/Tango.MachineEM.UI
parent124ad4150f80c6846fdee41dbbda9848c105f6e5 (diff)
downloadTango-00a491d9.tar.gz
Tango-00a491d9.zip
merge
Diffstat (limited to 'Software/Visual_Studio/Utilities/Tango.MachineEM.UI')
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Controls/InkFillingStatusView.xaml51
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Controls/InkFillingStatusView.xaml.cs29
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Converters/EventTypeToStringConverter.cs29
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineEM.UI/InputWindow.xaml25
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineEM.UI/InputWindow.xaml.cs56
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineEM.UI/MainWindow.xaml2
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Tango.MachineEM.UI.csproj15
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs186
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml191
9 files changed, 59 insertions, 525 deletions
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Controls/InkFillingStatusView.xaml b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Controls/InkFillingStatusView.xaml
deleted file mode 100644
index 22468a052..000000000
--- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Controls/InkFillingStatusView.xaml
+++ /dev/null
@@ -1,51 +0,0 @@
-<UserControl x:Class="Tango.MachineEM.UI.Controls.InkFillingStatusView"
- 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
- xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
- xmlns:fa="http://schemas.fontawesome.io/icons/"
- xmlns:ifs="clr-namespace:Tango.PMR.IFS;assembly=Tango.PMR"
- xmlns:diagnostics="clr-namespace:Tango.PMR.Diagnostics;assembly=Tango.PMR"
- xmlns:vm="clr-namespace:Tango.MachineEM.UI.ViewModels"
- xmlns:local="clr-namespace:Tango.MachineEM.UI.Views"
- mc:Ignorable="d"
- d:DesignHeight="400" Width="500" Foreground="Gainsboro" d:DataContext="{d:DesignInstance Type=ifs:InkFillingStatus, IsDesignTimeCreatable=False}" >
-
- <UserControl.Resources>
- <converters:BooleanInverseConverter x:Key="BooleanInverseConverter"></converters:BooleanInverseConverter>
- <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" />
- </UserControl.Resources>
- <Grid>
- <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Padding="5">
- <ItemsControl ItemsSource="{Binding CartridgesStatuses}">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Border BorderBrush="DimGray" BorderThickness="1" Margin="0 5" Padding="5" CornerRadius="5">
- <StackPanel>
- <DockPanel>
- <TextBlock>
- <TextBlock.Style>
- <Style TargetType="TextBlock">
- <Setter Property="Text" Value="Waste"></Setter>
- <Style.Triggers>
- <DataTrigger Binding="{Binding Cartridge.Slot}" Value="Ink">
- <Setter Property="Text" Value="Ink"></Setter>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </TextBlock.Style>
- </TextBlock>
- <TextBlock Margin="5 0 0 0" Text="{Binding Cartridge.Index}"></TextBlock>
- </DockPanel>
- <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Source={x:Type ifs:CartridgeState},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding State,Mode=TwoWay}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>
- <Slider Margin="0 5 0 0" Minimum="0" MaxHeight="100" Value="{Binding ProgressPercentage}"></Slider>
- </StackPanel>
- </Border>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </ScrollViewer>
- </Grid>
-</UserControl>
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Controls/InkFillingStatusView.xaml.cs b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Controls/InkFillingStatusView.xaml.cs
deleted file mode 100644
index 575e12210..000000000
--- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Controls/InkFillingStatusView.xaml.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-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 Tango.MachineEM.UI.Controls
-{
- /// <summary>
- /// Interaction logic for MainView.xaml
- /// </summary>
- public partial class InkFillingStatusView : UserControl
- {
- public InkFillingStatusView()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Converters/EventTypeToStringConverter.cs b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Converters/EventTypeToStringConverter.cs
deleted file mode 100644
index de771f2a8..000000000
--- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Converters/EventTypeToStringConverter.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using Google.Protobuf.Reflection;
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Data;
-using Tango.PMR.Diagnostics;
-
-namespace Tango.MachineEM.UI.Converters
-{
- public class EventTypeToStringConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- EventType eventType = (EventType)value;
- FieldInfo fi = value.GetType().GetField(eventType.ToString());
- String name = fi.GetCustomAttribute<OriginalNameAttribute>().Name;
- return $"{(int)eventType} {name}";
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/InputWindow.xaml b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/InputWindow.xaml
deleted file mode 100644
index 05a4b33cd..000000000
--- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/InputWindow.xaml
+++ /dev/null
@@ -1,25 +0,0 @@
-<Window x:Class="Tango.MachineEM.UI.InputWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
- xmlns:local="clr-namespace:Tango.MachineEM.UI"
- mc:Ignorable="d"
- Title="Input" Height="250" Width="600">
- <Grid>
- <DockPanel>
- <UniformGrid Columns="2" DockPanel.Dock="Bottom" HorizontalAlignment="Right" Height="45">
- <Button x:Name="btnCancel" Width="150" Margin="5" Style="{StaticResource AccentedSquareButtonStyle}" BorderThickness="0" mahapps:ButtonHelper.PreserveTextCase="True">CANCEL</Button>
- <Button IsDefault="True" x:Name="btnOK" Width="150" Margin="5" Style="{StaticResource AccentedSquareButtonStyle}" BorderThickness="0" mahapps:ButtonHelper.PreserveTextCase="True">OK</Button>
- </UniformGrid>
-
- <Rectangle DockPanel.Dock="Bottom" Stroke="#494949" StrokeThickness="1" />
-
- <StackPanel Margin="40">
- <TextBlock x:Name="txtMessage" Text="Please enter a value" Foreground="Gainsboro"></TextBlock>
- <TextBox x:Name="txtValue" Margin="0 10 120 0"></TextBox>
- </StackPanel>
- </DockPanel>
- </Grid>
-</Window>
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/InputWindow.xaml.cs b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/InputWindow.xaml.cs
deleted file mode 100644
index 191b53072..000000000
--- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/InputWindow.xaml.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-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.Shapes;
-
-namespace Tango.MachineEM.UI
-{
- /// <summary>
- /// Interaction logic for InputWindow.xaml
- /// </summary>
- public partial class InputWindow : Window
- {
- public String Value { get; set; }
- public String Message { get; set; }
-
- public InputWindow()
- {
- InitializeComponent();
-
- btnOK.Click += BtnOK_Click;
- btnCancel.Click += BtnCancel_Click;
- Loaded += InputWindow_Loaded;
- }
-
- private void InputWindow_Loaded(object sender, RoutedEventArgs e)
- {
- txtValue.Text = Value;
- txtMessage.Text = Message;
-
- txtValue.Focus();
- Keyboard.Focus(txtValue);
- }
-
- private void BtnCancel_Click(object sender, RoutedEventArgs e)
- {
- DialogResult = false;
- Close();
- }
-
- private void BtnOK_Click(object sender, RoutedEventArgs e)
- {
- Value = txtValue.Text;
- DialogResult = true;
- Close();
- }
- }
-}
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/MainWindow.xaml b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/MainWindow.xaml
index 8f066800e..7bfc7f0fd 100644
--- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/MainWindow.xaml
+++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/MainWindow.xaml
@@ -9,7 +9,7 @@
xmlns:local="clr-namespace:Tango.MachineEM.UI"
xmlns:views="clr-namespace:Tango.MachineEM.UI.Views"
mc:Ignorable="d"
- Title="Tango Embedded Emulator" Height="820" Width="1300" TitleCaps="False" BorderBrush="Gray" BorderThickness="1" WindowStartupLocation="CenterScreen" Background="#202020" Foreground="Gainsboro" DataContext="{Binding RelativeSource={RelativeSource Self}}">
+ Title="Tango Embedded Emulator" Height="720" Width="1300" TitleCaps="False" BorderBrush="Gray" BorderThickness="1" WindowStartupLocation="CenterScreen" Background="#202020" Foreground="Gainsboro" DataContext="{Binding RelativeSource={RelativeSource Self}}">
<Grid>
<views:MainView DataContext="{StaticResource MainViewVM}"></views:MainView>
</Grid>
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Tango.MachineEM.UI.csproj b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Tango.MachineEM.UI.csproj
index c6f382afe..bce166287 100644
--- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Tango.MachineEM.UI.csproj
+++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Tango.MachineEM.UI.csproj
@@ -80,25 +80,10 @@
<Compile Include="..\..\Versioning\GlobalVersionInfo.cs">
<Link>GlobalVersionInfo.cs</Link>
</Compile>
- <Compile Include="Controls\InkFillingStatusView.xaml.cs">
- <DependentUpon>InkFillingStatusView.xaml</DependentUpon>
- </Compile>
- <Compile Include="Converters\EventTypeToStringConverter.cs" />
- <Compile Include="InputWindow.xaml.cs">
- <DependentUpon>InputWindow.xaml</DependentUpon>
- </Compile>
<Compile Include="ViewModels\MainViewVM.cs" />
<Compile Include="Views\MainView.xaml.cs">
<DependentUpon>MainView.xaml</DependentUpon>
</Compile>
- <Page Include="Controls\InkFillingStatusView.xaml">
- <Generator>MSBuild:Compile</Generator>
- <SubType>Designer</SubType>
- </Page>
- <Page Include="InputWindow.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs
index c993be2d7..1662a3ede 100644
--- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs
@@ -12,9 +12,6 @@ using Tango.Transport.Servers;
using Tango.Transport.Transporters;
using Tango.Core;
using Tango.Settings;
-using Tango.PMR.ThreadLoading;
-using Tango.PMR.DataStore;
-using System.Windows;
namespace Tango.MachineEM.UI.ViewModels
{
@@ -23,7 +20,6 @@ namespace Tango.MachineEM.UI.ViewModels
private TcpServer TcpServer;
private bool _running;
private LogManager logManager = LogManager.Default;
- private bool _isThreadLoading;
#region Properties
@@ -67,30 +63,10 @@ namespace Tango.MachineEM.UI.ViewModels
set { _selectedPort = value; RaisePropertyChanged(nameof(SelectedPort)); }
}
- private ThreadLoadingState _threadLoadingState;
- public ThreadLoadingState ThreadLoadingState
- {
- get { return _threadLoadingState; }
- set { _threadLoadingState = value; OnThreadLoadingStateChanged(); }
- }
-
-
#endregion
#region Private Methods
- private void OnThreadLoadingStateChanged()
- {
- try
- {
- Emulator?.SetThreadLoadingState(ThreadLoadingState);
- }
- catch (Exception ex)
- {
- LogManager.Log(ex);
- }
- }
-
#endregion
#region Commands
@@ -125,27 +101,6 @@ namespace Tango.MachineEM.UI.ViewModels
/// </summary>
public RelayCommand ValidateCartridgeCommand { get; set; }
- /// <summary>
- /// Gets or sets the start thread loading sequence command.
- /// </summary>
- public RelayCommand StartThreadLoadingCommand { get; set; }
-
- /// <summary>
- /// Gets or sets the finalize thread loading command.
- /// </summary>
- public RelayCommand FinalizeThreadLoadingCommand { get; set; }
-
- /// <summary>
- /// Gets or sets the abort job.
- /// </summary>
- public RelayCommand AbortJobCommand { get; set; }
-
- public RelayCommand GetDataStoreItemCommand { get; set; }
-
- public RelayCommand PutDataStoreItemCommand { get; set; }
-
- public RelayCommand PerformDataStoreTestCommand { get; set; }
-
#endregion
#region Constructors
@@ -176,9 +131,6 @@ namespace Tango.MachineEM.UI.ViewModels
CancelCommand = new RelayCommand(Cancel, (x) => _running);
ClearCommand = new RelayCommand(() => Log = String.Empty);
ValidateCartridgeCommand = new RelayCommand(ValidateCartridge, (x) => Emulator.IsStarted);
- StartThreadLoadingCommand = new RelayCommand(StartThreadLoading, (x) => Emulator.IsStarted && !_isThreadLoading);
- FinalizeThreadLoadingCommand = new RelayCommand(FinalizeThreadLoading, (x) => Emulator.IsStarted && _isThreadLoading);
- AbortJobCommand = new RelayCommand(() => Emulator?.AbortJob(), (x) => Emulator.IsStarted);
Ports = new List<string>()
{
@@ -195,10 +147,6 @@ namespace Tango.MachineEM.UI.ViewModels
};
SelectedPort = Ports.First();
-
- PerformDataStoreTestCommand = new RelayCommand(Emulator.PerformDataStoreTest);
- GetDataStoreItemCommand = new RelayCommand(GetDataStoreItem);
- PutDataStoreItemCommand = new RelayCommand(PutDataStoreItem);
}
#endregion
@@ -270,140 +218,6 @@ namespace Tango.MachineEM.UI.ViewModels
}
}
- private async void StartThreadLoading()
- {
- LogManager.Log("Starting thread loading sequence...");
- Emulator.StartThreadLoading();
- _isThreadLoading = true;
- InvalidateRelayCommands();
-
- await Task.Delay(10000);
- _isThreadLoading = false;
- InvalidateRelayCommands();
- }
-
- private void FinalizeThreadLoading()
- {
- LogManager.Log("Finalizing thread loading sequence...");
- Emulator.FinalizeThreadLoading();
- _isThreadLoading = false;
- InvalidateRelayCommands();
- }
-
- private void GetDataStoreItem()
- {
- try
- {
- var result = GetUserInput<String>("Get Data Store Item", "Enter collection name", String.Empty);
- if (!result.Confirmed) return;
- var collectionName = result.Value;
-
- result = GetUserInput<String>("Get Data Store Item", "Enter item key", String.Empty);
- if (!result.Confirmed) return;
- var key = result.Value;
-
- Emulator.GetDataStoreItem(new PMR.DataStore.GetDataStoreItemRequest()
- {
- Collection = collectionName,
- Key = key
- });
- }
- catch { }
- }
-
- private void PutDataStoreItem()
- {
- try
- {
- var result = GetUserInput<String>("Put Data Store Item", "Enter collection name", String.Empty);
- if (!result.Confirmed) return;
- var collectionName = result.Value;
-
- result = GetUserInput<String>("Put Data Store Item", "Enter item key", String.Empty);
- if (!result.Confirmed) return;
- var key = result.Value;
-
- result = GetUserInput<String>("Put Data Store Item", "Enter data type", "Int32");
- if (!result.Confirmed) return;
- DataType dataType = (DataType)Enum.Parse(typeof(DataType), result.Value);
-
- result = GetUserInput<String>("Put Data Store Item", "Enter value", "10");
- if (!result.Confirmed) return;
- var value = result.Value;
-
- DataStoreItem item = new DataStoreItem();
- item.DataType = dataType;
-
- switch (dataType)
- {
- case DataType.Int32:
- item.Int32Value = int.Parse(value);
- break;
- case DataType.Float:
- item.FloatValue = float.Parse(value);
- break;
- case DataType.Double:
- item.DoubleValue = double.Parse(value);
- break;
- case DataType.Boolean:
- item.BooleanValue = bool.Parse(value);
- break;
- case DataType.String:
- item.StringValue = value;
- break;
- default:
- LogManager.Log("Data type not supported by this emulator.");
- throw new NotSupportedException();
- }
-
- Emulator.PutDataStoreItem(new PutDataStoreItemRequest()
- {
- Collection = collectionName,
- Key = key,
- Item = item
- });
- }
- catch { }
- }
-
- #endregion
-
- #region Private Methods
-
- private class InputResult<T>
- {
- public bool Confirmed { get; set; }
- public T Value { get; set; }
- }
-
- private InputResult<T> GetUserInput<T>(String title, String message, T defaultValue)
- {
- InputWindow window = new InputWindow();
- window.Title = title;
- window.Message = message;
- window.Value = defaultValue.ToStringSafe();
- window.Owner = Application.Current.MainWindow;
- window.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
- window.WindowStyle = WindowStyle.ToolWindow;
-
- try
- {
- if (window.ShowDialog().Value)
- {
- return new InputResult<T>() { Confirmed = true, Value = (T)Convert.ChangeType(window.Value, typeof(T)) };
- }
- else
- {
- return new InputResult<T>();
- }
- }
- catch (Exception ex)
- {
- LogManager.Log(ex, "Error parsing input.");
- throw ex;
- }
- }
-
#endregion
}
}
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml
index c0c4b7b97..036fec7dc 100644
--- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml
+++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml
@@ -3,23 +3,19 @@
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:controls="clr-namespace:Tango.MachineEM.UI.Controls"
xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:editors="clr-namespace:Tango.SharedUI.Editors;assembly=Tango.SharedUI"
xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
xmlns:fa="http://schemas.fontawesome.io/icons/"
xmlns:vm="clr-namespace:Tango.MachineEM.UI.ViewModels"
xmlns:pmr="clr-namespace:Tango.PMR.MachineStatus;assembly=Tango.PMR"
- xmlns:threadLoading="clr-namespace:Tango.PMR.ThreadLoading;assembly=Tango.PMR"
- xmlns:localConverters="clr-namespace:Tango.MachineEM.UI.Converters"
xmlns:local="clr-namespace:Tango.MachineEM.UI.Views"
mc:Ignorable="d"
- d:DesignHeight="780" d:DesignWidth="1300" Foreground="Gainsboro" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" >
+ d:DesignHeight="720" d:DesignWidth="1300" Foreground="Gainsboro" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" >
<UserControl.Resources>
<converters:BooleanInverseConverter x:Key="BooleanInverseConverter"></converters:BooleanInverseConverter>
<converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" />
- <localConverters:EventTypeToStringConverter x:Key="EventTypeToStringConverter" />
</UserControl.Resources>
<Grid>
<Grid.Background>
@@ -57,141 +53,17 @@
<Grid>
<Grid.ColumnDefinitions>
- <ColumnDefinition Width="220"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="280"/>
</Grid.ColumnDefinitions>
- <Grid Background="#A3000000">
- <StackPanel>
- <!--BUTTONS HERE-->
- <Button Padding="10 0 0 0" Height="45" Margin="5" HorizontalContentAlignment="Left" MinWidth="100" Style="{StaticResource AccentedSquareButtonStyle}" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0" Command="{Binding StartThreadLoadingCommand}">
- <StackPanel Orientation="Horizontal">
- <fa:ImageAwesome Icon="ChevronCircleDown" Width="16"></fa:ImageAwesome>
- <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">START THREAD LOADING</TextBlock>
- </StackPanel>
- </Button>
- <Button Padding="10 0 0 0" Height="45" Margin="5" HorizontalContentAlignment="Left" Style="{StaticResource AccentedSquareButtonStyle}" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0" Command="{Binding FinalizeThreadLoadingCommand}">
- <StackPanel Orientation="Horizontal">
- <fa:ImageAwesome Icon="ChevronCircleUp" Width="16"></fa:ImageAwesome>
- <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">FINALIZE THREAD LOADING</TextBlock>
- </StackPanel>
- </Button>
- <Button Padding="10 0 0 0" Margin="5" Height="45" HorizontalContentAlignment="Left" Style="{StaticResource AccentedSquareButtonStyle}" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0" Command="{Binding ValidateCartridgeCommand}">
- <StackPanel Orientation="Horizontal">
- <fa:ImageAwesome Icon="FlagCheckered" Width="16"></fa:ImageAwesome>
- <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">CARTRIDGE VALIDATION</TextBlock>
- </StackPanel>
- </Button>
- <ToggleButton Style="{StaticResource AccentedSquareButtonStyle}" BorderThickness="0" x:Name="toggleLevels" Height="45" Margin="5">
- <StackPanel Orientation="Horizontal">
- <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">MACHINE STATUS</TextBlock>
- <fa:ImageAwesome Icon="ChevronDown" Width="16" Foreground="White"></fa:ImageAwesome>
- </StackPanel>
- </ToggleButton>
- <Popup IsOpen="{Binding ElementName=toggleLevels,Path=IsChecked}" StaysOpen="True">
- <Border Padding="10">
- <StackPanel Orientation="Horizontal">
- <StackPanel HorizontalAlignment="Left">
- <TextBlock Foreground="Red">IDS Packs Levels</TextBlock>
- <ScrollViewer Height="400" HorizontalScrollBarVisibility="Disabled" Width="300">
- <ItemsControl Margin="0 5 0 0" ItemsSource="{Binding Emulator.MachineStatus.IDSPacksLevels}">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <StackPanel Margin="0 5">
- <TextBlock>
- <Run Text="Index: "></Run>
- <Run Text="{Binding Index}"></Run>
- </TextBlock>
-
- <StackPanel Orientation="Horizontal">
- <TextBlock Text="Dispenser Level (nl): " />
- <TextBox Text="{Binding ElementName=sliderDispenser,Path=Value,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"></TextBox>
- </StackPanel>
-
- <Slider x:Name="sliderDispenser" Orientation="Horizontal" Minimum="0" Maximum="130000000" Value="{Binding DispenserLevel}"></Slider>
-
- <TextBlock>
- <Run Text="MidTank Level (ml): "></Run>
- <Run Text="{Binding ElementName=sliderMidTank,Path=Value}"></Run>
- </TextBlock>
-
- <Slider x:Name="sliderMidTank" Orientation="Horizontal" Minimum="0" Maximum="1.8" Value="{Binding MidTankLevel}"></Slider>
- </StackPanel>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </ScrollViewer>
- </StackPanel>
- <StackPanel Margin="10 0 0 0">
- <TextBlock Foreground="Red">MACHINE STATE</TextBlock>
- <ComboBox Margin="0 5 0 0" Width="150" ItemsSource="{Binding Source={x:Type pmr:MachineState},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding Emulator.MachineStatus.State,Mode=TwoWay}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>
-
- <TextBlock Margin="0 20 0 0" Foreground="Red" Width="160">
- <Run>OVERALL TEMPERATURE</Run>
- <Run Text="{Binding ElementName=sliderTemperature,Path=Value,StringFormat='0.0',Mode=OneWay}"></Run>
- </TextBlock>
- <Slider x:Name="sliderTemperature" Margin="0 5 0 0" Minimum="0" Maximum="60" Value="{Binding Emulator.MachineStatus.OverallTemperature,Mode=TwoWay}"></Slider>
-
- <TextBlock Margin="0 10 0 0">SPOOL STATE</TextBlock>
- <ComboBox Margin="0 5 0 0" Width="150" ItemsSource="{Binding Source={x:Type pmr:SpoolState},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding Emulator.MachineStatus.SpoolState,Mode=TwoWay}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>
- </StackPanel>
- </StackPanel>
- </Border>
- </Popup>
-
- <ToggleButton Style="{StaticResource AccentedSquareButtonStyle}" BorderThickness="0" x:Name="toggleIFS" Height="45" Margin="5">
- <StackPanel Orientation="Horizontal">
- <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">INK FILLING STATUS</TextBlock>
- <fa:ImageAwesome Icon="ChevronDown" Width="16" Foreground="White"></fa:ImageAwesome>
- </StackPanel>
- </ToggleButton>
- <Popup IsOpen="{Binding ElementName=toggleIFS,Path=IsChecked}" StaysOpen="True" PlacementTarget="{Binding ElementName=toggleIFS}" Placement="Bottom">
- <controls:InkFillingStatusView Height="300" Width="210" DataContext="{Binding Emulator.InkFillingStatus}" />
- </Popup>
-
- <Button Padding="10 0 0 0" Margin="5" Height="45" HorizontalContentAlignment="Left" Style="{StaticResource AccentedSquareButtonStyle}" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0" Command="{Binding AbortJobCommand}">
- <DockPanel>
- <fa:ImageAwesome Icon="ExclamationTriangle" Width="16"></fa:ImageAwesome>
- <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" HorizontalAlignment="Center">ABORT JOB</TextBlock>
- </DockPanel>
- </Button>
-
- <Button Padding="10 0 0 0" Margin="5" HorizontalContentAlignment="Left" Height="45" Style="{StaticResource AccentedSquareButtonStyle}" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0" Command="{Binding PerformDataStoreTestCommand}">
- <DockPanel>
- <fa:ImageAwesome Icon="Database" Width="16"></fa:ImageAwesome>
- <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" HorizontalAlignment="Center">DATASTORE TEST</TextBlock>
- </DockPanel>
- </Button>
-
- <Button Padding="10 0 0 0" Margin="5" HorizontalContentAlignment="Left" Height="45" Style="{StaticResource AccentedSquareButtonStyle}" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0" Command="{Binding GetDataStoreItemCommand}">
- <DockPanel>
- <fa:ImageAwesome Icon="Download" Width="16"></fa:ImageAwesome>
- <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" HorizontalAlignment="Center">GET DATA STORE ITEM</TextBlock>
- </DockPanel>
- </Button>
-
- <Button HorizontalContentAlignment="Left" Padding="10 0 0 0" Margin="5" Height="45" Style="{StaticResource AccentedSquareButtonStyle}" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0" Command="{Binding PutDataStoreItemCommand}">
- <DockPanel>
- <fa:ImageAwesome Icon="Upload" Width="16"></fa:ImageAwesome>
- <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" HorizontalAlignment="Center">PUT DATA STORE ITEM</TextBlock>
- </DockPanel>
- </Button>
- <!--BUTTONS HERE-->
-
- <DockPanel Margin="5 20 5 0">
- <TextBlock FontSize="12" DockPanel.Dock="Top">Thread Loading State</TextBlock>
- <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Source={x:Type threadLoading:ThreadLoadingState},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding ThreadLoadingState,Mode=OneWayToSource}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>
- </DockPanel>
- </StackPanel>
- </Grid>
- <TextBox x:Name="txtLog" Grid.Column="1" FontFamily="monospaced" TextChanged="txtLog_TextChanged" Text="{Binding Log}" Background="Transparent" Foreground="Red" FontSize="11" Padding="5" Style="{x:Null}" BorderThickness="0" IsReadOnly="True" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" TextWrapping="Wrap">
+ <TextBox x:Name="txtLog" FontFamily="monospaced" TextChanged="txtLog_TextChanged" Text="{Binding Log}" Background="Transparent" Foreground="Red" FontSize="11" Padding="5" Style="{x:Null}" BorderThickness="0" IsReadOnly="True" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" TextWrapping="Wrap">
</TextBox>
- <Grid Grid.Column="2">
+ <Grid Grid.Column="1">
<DockPanel>
<TextBlock DockPanel.Dock="Top" Margin="10 0 0 0">HARDWARE EVENTS</TextBlock>
- <ListBox BorderThickness="0" Background="#66000000" Margin="10 10 10 0" ItemsSource="{Binding Emulator.EventsStates}" FontSize="11">
+ <ListBox BorderThickness="0" Background="#66000000" Margin="10 10 10 40" ItemsSource="{Binding Emulator.EventsStates}" FontSize="11">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
@@ -199,7 +71,7 @@
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
- <CheckBox FontSize="11" Content="{Binding EventType,Converter={StaticResource EventTypeToStringConverter}}" IsChecked="{Binding IsActive}" Margin="5"></CheckBox>
+ <CheckBox FontSize="11" Content="{Binding EventType}" IsChecked="{Binding IsActive}" Margin="5"></CheckBox>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
@@ -309,6 +181,59 @@
<SolidColorBrush Color="#151515" Opacity="0.8" />
</Grid.Background>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Margin="5">
+ <Button Margin="5" MinWidth="100" Style="{StaticResource AccentedSquareButtonStyle}" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0" Command="{Binding ValidateCartridgeCommand}">
+ <StackPanel Orientation="Horizontal">
+ <fa:ImageAwesome Icon="FlagCheckered" Width="16"></fa:ImageAwesome>
+ <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">CARTRIDGE VALIDATION</TextBlock>
+ </StackPanel>
+ </Button>
+ <ToggleButton Style="{StaticResource AccentedSquareButtonStyle}" BorderThickness="0" x:Name="toggleLevels" MinWidth="140" Margin="5 5 20 5">
+ <StackPanel Orientation="Horizontal">
+ <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">STATUS</TextBlock>
+ <fa:ImageAwesome Icon="ChevronDown" Width="16" Foreground="White"></fa:ImageAwesome>
+ </StackPanel>
+ </ToggleButton>
+ <Popup IsOpen="{Binding ElementName=toggleLevels,Path=IsChecked}" StaysOpen="True">
+ <Border Padding="10">
+ <StackPanel Orientation="Horizontal">
+ <StackPanel HorizontalAlignment="Left">
+ <TextBlock Foreground="Red">IDS Packs Levels</TextBlock>
+ <ScrollViewer Height="400" HorizontalScrollBarVisibility="Disabled">
+ <ItemsControl Margin="0 5 0 0" ItemsSource="{Binding Emulator.MachineStatus.IDSPacksLevels}">
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <StackPanel Margin="0 5">
+ <TextBlock>
+ <Run Text="Index: "></Run>
+ <Run Text="{Binding Index}"></Run>
+ </TextBlock>
+
+ <StackPanel Orientation="Horizontal">
+ <TextBlock Text="Dispenser Level (nl): " />
+ <TextBox Text="{Binding ElementName=sliderDispenser,Path=Value,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"></TextBox>
+ </StackPanel>
+
+ <Slider x:Name="sliderDispenser" Orientation="Horizontal" Minimum="0" Maximum="130000000" Value="{Binding DispenserLevel}"></Slider>
+
+ <TextBlock>
+ <Run Text="MidTank Level (ml): "></Run>
+ <Run Text="{Binding ElementName=sliderMidTank,Path=Value}"></Run>
+ </TextBlock>
+
+ <Slider x:Name="sliderMidTank" Orientation="Horizontal" Minimum="0" Maximum="2500" Value="{Binding MidTankLevel}"></Slider>
+ </StackPanel>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </ScrollViewer>
+ </StackPanel>
+ <StackPanel Margin="10 0 0 0">
+ <TextBlock Foreground="Red">MACHINE STATE</TextBlock>
+ <ComboBox Margin="0 5 0 0" Width="150" ItemsSource="{Binding Source={x:Type pmr:MachineState},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding Emulator.MachineStatus.State,Mode=TwoWay}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>
+ </StackPanel>
+ </StackPanel>
+ </Border>
+ </Popup>
<CheckBox Margin="0 0 20 0" VerticalAlignment="Center" IsChecked="{Binding Emulator.EmulateCorruption}" Foreground="Red">Emulate Corruption</CheckBox>
<CheckBox Margin="0 0 20 0" VerticalAlignment="Center" IsChecked="{Binding Emulator.PerformNativeRoundTrip}">Perform Native RoundTrip</CheckBox>
<ComboBox IsEnabled="{Binding Emulator.IsStarted,Converter={StaticResource BooleanInverseConverter}}" MinWidth="140" Margin="5" BorderThickness="0" ItemsSource="{Binding Ports}" SelectedItem="{Binding SelectedPort}"></ComboBox>