aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-10-12 16:54:21 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-10-12 16:54:21 +0300
commit28f7a6f566c4e951d3d40c449813fce0c7460ca7 (patch)
tree7ea0e25c802b3086ddf28a374884f1a72c463e9e /Software/Visual_Studio
parentaf99d6cf60267ea8c92c7610b16565104a5b6aed (diff)
downloadTango-28f7a6f566c4e951d3d40c449813fce0c7460ca7.tar.gz
Tango-28f7a6f566c4e951d3d40c449813fce0c7460ca7.zip
IMplemented emulator ink filling status.
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs52
-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/Tango.MachineEM.UI.csproj9
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml13
5 files changed, 151 insertions, 3 deletions
diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs
index a8818df2b..779e110e8 100644
--- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs
+++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs
@@ -34,6 +34,7 @@ using Tango.Core.ExtensionMethods;
using Tango.PMR.MachineStatus;
using Tango.PMR.Power;
using Tango.PMR.ThreadLoading;
+using Tango.PMR.IFS;
namespace Tango.Emulations.Emulators
{
@@ -114,6 +115,8 @@ namespace Tango.Emulations.Emulators
public MachineStatus MachineStatus { get; set; }
+ public InkFillingStatus InkFillingStatus { get; set; }
+
#endregion
#region Constructors
@@ -225,6 +228,33 @@ namespace Tango.Emulations.Emulators
}
ResetGraphFactors();
+
+ InkFillingStatus = new InkFillingStatus();
+
+ for (int i = 0; i < 8; i++)
+ {
+ InkFillingStatus.CartridgesStatuses.Add(new CartridgeStatus()
+ {
+ Cartridge = new Cartridge()
+ {
+ Index = i,
+ Slot = CartridgeSlot.Ink,
+ },
+ State = CartridgeState.Exists
+ });
+ }
+
+ InkFillingStatus.CartridgesStatuses.Add(new CartridgeStatus()
+ {
+ Cartridge = new Cartridge() { Index = 0, Slot = CartridgeSlot.WasteLower },
+ State = CartridgeState.Exists
+ });
+
+ InkFillingStatus.CartridgesStatuses.Add(new CartridgeStatus()
+ {
+ Cartridge = new Cartridge() { Index = 1, Slot = CartridgeSlot.WasteMiddle },
+ State = CartridgeState.Exists
+ });
}
private void ResetGraphFactors()
@@ -433,6 +463,9 @@ namespace Tango.Emulations.Emulators
case MessageType.StartPowerUpRequest:
HandleStartPowerUpRequest(MessageFactory.ParseTangoMessageFromContainer<StartPowerUpRequest>(container));
break;
+ case MessageType.StartInkFillingStatusRequest:
+ HandleStartInkFillingStatusRequest(MessageFactory.ParseTangoMessageFromContainer<StartInkFillingStatusRequest>(container));
+ break;
}
}
@@ -1562,7 +1595,7 @@ namespace Tango.Emulations.Emulators
//if (_rnd.Next(0, 100) > 50)
//{
- await Transporter.SendResponse<StartThreadLoadingResponse>(new StartThreadLoadingResponse() { State = ThreadLoadingState.Completed }, _threadLoadingToken);
+ await Transporter.SendResponse<StartThreadLoadingResponse>(new StartThreadLoadingResponse() { State = ThreadLoadingState.Completed }, _threadLoadingToken);
//}
//else
//{
@@ -1656,6 +1689,23 @@ namespace Tango.Emulations.Emulators
});
}
+ private void HandleStartInkFillingStatusRequest(TangoMessage<StartInkFillingStatusRequest> request)
+ {
+ Task.Factory.StartNew(() =>
+ {
+ while (IsStarted)
+ {
+
+ Transporter.SendResponse(new StartInkFillingStatusResponse()
+ {
+ Status = InkFillingStatus
+ }, request.Container.Token);
+
+ Thread.Sleep(2000);
+ }
+ });
+ }
+
#endregion
#region Public Methods
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Controls/InkFillingStatusView.xaml b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Controls/InkFillingStatusView.xaml
new file mode 100644
index 000000000..22468a052
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Controls/InkFillingStatusView.xaml
@@ -0,0 +1,51 @@
+<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
new file mode 100644
index 000000000..575e12210
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Controls/InkFillingStatusView.xaml.cs
@@ -0,0 +1,29 @@
+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/Tango.MachineEM.UI.csproj b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Tango.MachineEM.UI.csproj
index bce166287..705194057 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,10 +80,17 @@
<Compile Include="..\..\Versioning\GlobalVersionInfo.cs">
<Link>GlobalVersionInfo.cs</Link>
</Compile>
+ <Compile Include="Controls\InkFillingStatusView.xaml.cs">
+ <DependentUpon>InkFillingStatusView.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="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -193,7 +200,7 @@
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
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 62bacd6d2..73a14b5b1 100644
--- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml
+++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml
@@ -3,6 +3,7 @@
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"
@@ -81,7 +82,7 @@
</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">STATUS</TextBlock>
+ <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">MACHINE STATUS</TextBlock>
<fa:ImageAwesome Icon="ChevronDown" Width="16" Foreground="White"></fa:ImageAwesome>
</StackPanel>
</ToggleButton>
@@ -135,6 +136,16 @@
</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>
<!--BUTTONS HERE-->
<Button Padding="10 0 0 0" Margin="5" Height="45" HorizontalContentAlignment="Left" Style="{StaticResource AccentedSquareButtonStyle}" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0" Command="{Binding AbortJobCommand}">