From 1c7f16c34f85dd65a02ad08dde984f04a4d82b83 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Tue, 18 Apr 2023 14:47:53 +0300 Subject: PPC Eureka. Power button, new dialog. --- .../PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs | 38 +++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs index 42d947326..d16792ead 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -16,6 +16,7 @@ using Tango.PPC.Common; using Tango.PPC.Common.Connection; using Tango.PPC.Common.Modules; using Tango.PPC.Common.Navigation; +using Tango.PPC.UI.Dialogs; using Tango.PPC.UI.Views; using Tango.PPC.UI.ViewsContracts; using Tango.SharedUI; @@ -300,7 +301,7 @@ namespace Tango.PPC.UI.ViewModels SignOutCommand = new RelayCommand(SignOut); UpdateCommand = new RelayCommand(UpdateMachine); - PowerCommand = new RelayCommand(() => IsPowerOpened = true); + PowerCommand = new RelayCommand(OpenPowerOptions); RestartApplicationCommand = new RelayCommand(RestartApplication); PowerOffCommand = new RelayCommand(PowerOffMachine, () => MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected); ResetCommand = new RelayCommand(ResetMachine, () => MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected); @@ -311,6 +312,41 @@ namespace Tango.PPC.UI.ViewModels #region Private Methods + private async void OpenPowerOptions() + { + IsPowerOpened = true; + + if (BuildProvider.IsEureka) + { + PowerEurekaViewVM vm = new PowerEurekaViewVM(); + vm = await NotificationProvider.ShowDialog(vm); + + if (!vm.DialogResult) return; + + switch(vm.PowerAction) + { + case PowerEurekaViewVM.PowerActionEnum.TurnOff: + if(MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected) + PowerOffMachine(); + return; + case PowerEurekaViewVM.PowerActionEnum.StandBy: + if (MachineProvider.MachineOperator.CanPrint) + StandBy(); + return; + case PowerEurekaViewVM.PowerActionEnum.RestartT: + RestartApplication(); + return; + case PowerEurekaViewVM.PowerActionEnum.Restart: + if (MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected) + ResetMachine(); + return; + default: + return; + } + + } + } + /// /// Stops the printing. /// -- cgit v1.3.1 From 1133972c0c51feb478aa3944fad5f374a8a2da35 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Tue, 18 Apr 2023 20:25:46 +0300 Subject: Added connective icons and time to bottom of menu. --- .../Tango.PPC.JobsV2/ViewModels/JobViewVM.cs | 4 +- .../Tango.PPC.JobsV2/Views/JobEurekaView.xaml | 8 +- .../Converters/ProgressLengthSpoolConverter.cs | 20 +-- .../Converters/ProgressWeightSpoolConverter.cs | 67 ++++++++ .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 1 + .../PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs | 21 +++ .../Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs | 2 +- .../PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml | 188 ++++++++------------- .../PPC/Tango.PPC.UI/Views/MachineStatusView.xaml | 23 ++- 9 files changed, 187 insertions(+), 147 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressWeightSpoolConverter.cs (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs index da021858c..6227610e4 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs @@ -581,8 +581,8 @@ namespace Tango.PPC.Jobs.ViewModels JobType = Job.JobType, InterSegmentLength = Job.InterSegmentLength, EnableInterSegment = Job.EnableInterSegment, - NumberSpools = (BuildProvider.IsEureka? 4 : 1), - NumberOfUnitsMultipliedBySpools = (BuildProvider.IsEureka ? Job.NumberOfUnits * 4 : Job.NumberOfUnits) + NumberSpools = (BuildProvider.IsEureka? Job.Spools : 1), + Copies = (BuildProvider.IsEureka ? Job.NumberOfUnits * Job.Spools : Job.NumberOfUnits) }; Dictionary guidToGroup = new Dictionary(); if (Job.Version < 2) diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml index 987314d3f..f8a74443d 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml @@ -1306,17 +1306,17 @@ - + + - + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressLengthSpoolConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressLengthSpoolConverter.cs index 00473955b..3be7a8818 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressLengthSpoolConverter.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressLengthSpoolConverter.cs @@ -15,13 +15,11 @@ namespace Tango.PPC.UI.Converters { try { - if (values.Count() == 4) + if (values.Count() == 2) { double length = System.Convert.ToDouble(values[0]); - int spools = System.Convert.ToInt32(values[1]); - int NumberOfUnits = System.Convert.ToInt32(values[2]); - bool forOneSpool = System.Convert.ToBoolean(values[3]); - var totalBy4Spools = (double)length* spools * NumberOfUnits/ 4; + bool forOneSpool = System.Convert.ToBoolean(values[1]); + var totalBy4Spools = (double)length*4;// spools ; if (forOneSpool) { return (double)totalBy4Spools / 4; @@ -29,16 +27,14 @@ namespace Tango.PPC.UI.Converters return totalBy4Spools; } - if (values.Count() == 5) + if (values.Count() == 3) { double length = System.Convert.ToDouble(values[0]); - int spools = System.Convert.ToInt32(values[1]); - int NumberOfUnits = System.Convert.ToInt32(values[2]); - bool forOneSpool = System.Convert.ToBoolean(values[3]); - double currentProgresslength = System.Convert.ToDouble(values[4]) ; + bool forOneSpool = System.Convert.ToBoolean(values[1]); + double currentProgresslength = System.Convert.ToDouble(values[2]) ; - var totalBy4Spools = (double)length * spools * NumberOfUnits / 4; - var currentProgressBy4Spools = (double)currentProgresslength * spools ; + var totalBy4Spools = (double)length * 4; + var currentProgressBy4Spools = (double)currentProgresslength * 4 ; int coeff = (int)currentProgressBy4Spools / (int)totalBy4Spools; var progressCurrent = coeff == 0 ? currentProgressBy4Spools : currentProgressBy4Spools % (coeff * totalBy4Spools);//show for progress diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressWeightSpoolConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressWeightSpoolConverter.cs new file mode 100644 index 000000000..05a41912c --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ProgressWeightSpoolConverter.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; + + +namespace Tango.PPC.UI.Converters +{ + public class ProgressWeightSpoolConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + if (values.Count() == 3) + { + double length = System.Convert.ToDouble(values[0]); + bool forOneSpool = System.Convert.ToBoolean(values[1]); + double coef = System.Convert.ToDouble(values[2]); + var totalBy4Spools = (double)length * 4;// spools ; + + var weight = ((double)totalBy4Spools * coef) / (1000);//(g) + if (forOneSpool) + { + return (double)weight / 4; + } + return weight; + + } + if (values.Count() == 4) + { + double length = System.Convert.ToDouble(values[0]); + bool forOneSpool = System.Convert.ToBoolean(values[1]); + double currentProgresslength = System.Convert.ToDouble(values[2]); + double coef = System.Convert.ToDouble(values[3]); + + var totalBy4Spools = (double)length * 4; + var currentProgressBy4Spools = (double)currentProgresslength * 4; + + int coeff = (int)currentProgressBy4Spools / (int)totalBy4Spools; + var progressCurrent = coeff == 0 ? currentProgressBy4Spools : currentProgressBy4Spools % (coeff * totalBy4Spools);//show for progress + var weight = ((double)progressCurrent * coef) / (1000);//(g) + if (forOneSpool) + { + return (double)weight / 4; + + } + return weight; + } + return "-"; + } + catch + { + return "-"; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index d32900728..1534d8a73 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -145,6 +145,7 @@ + BitResultsView.xaml diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs index d16792ead..95eb22d7a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -31,6 +31,7 @@ namespace Tango.PPC.UI.ViewModels { private JobHandler _jobHandler; private bool _resettingDevice; + private DispatcherTimer _date_timer; /// /// Gets or sets the module loader. @@ -219,6 +220,16 @@ namespace Tango.PPC.UI.ViewModels set { _cartridges = value; RaisePropertyChangedAuto(); } } + private DateTime _currentDateTime; + /// + /// Gets or sets the current date time. + /// + public DateTime CurrentDateTime + { + get { return _currentDateTime; } + set { _currentDateTime = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -306,6 +317,11 @@ namespace Tango.PPC.UI.ViewModels PowerOffCommand = new RelayCommand(PowerOffMachine, () => MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected); ResetCommand = new RelayCommand(ResetMachine, () => MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected); StandByCommand = new RelayCommand(StandBy, () => MachineProvider.MachineOperator.CanPrint); + + _date_timer = new DispatcherTimer(); + _date_timer.Interval = TimeSpan.FromSeconds(1); + _date_timer.Tick += _date_timer_Tick; + _date_timer.Start(); } #endregion @@ -614,6 +630,11 @@ namespace Tango.PPC.UI.ViewModels #region Event Handlers + private void _date_timer_Tick(object sender, EventArgs e) + { + CurrentDateTime = DateTime.Now; + } + /// /// Handles the PrintingStarted event of the MachineOperator. /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs index b41dbb0bf..95db08dfa 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -194,7 +194,7 @@ namespace Tango.PPC.UI.ViewModels { StopCommand = new RelayCommand(StopJob, ()=>CanStopped()); AbortCommand = new RelayCommand(AbortJob, () => CanStopped()); - GoToJobCommand = new RelayCommand(GoToJob, () => CanStopped()); + GoToJobCommand = new RelayCommand(GoToJob); JobStatusViewCommand = new RelayCommand(JobStatusView); OverviewViewCommand = new RelayCommand(OverviewView); ClearAllNotificationsCommand = new RelayCommand(ClearAllNotifications); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml index 092088ca6..d90ddd962 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml @@ -35,19 +35,19 @@ - + - - - + + + - - + + - + @@ -92,7 +92,7 @@ - + Power @@ -101,119 +101,77 @@ - - - - - - - - - - - + + + + + - - - - - - - + + + + + - Restart - --> - - - - + + + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml index e69f33514..9230f61c3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml @@ -18,6 +18,7 @@ + + + + + + + + + + + + + + + + Environment: + + + + + + + + + + + + + + Application Version: + + + + + + + + + + + + + + Site: + + + + + + + + + + + + + + Machine S/N: + + + + + + + + + + + + + + Firmware Version: + + + + + + + + + + + + + + CPU: + + + + + + + + % + + + + + + + + + RAM: + + + + + + + + + + + + + + Up Time: + + + + + + + + + + + + + + IP Address: + + + + + + + + + + + + + + Total Dye Time: + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml new file mode 100644 index 000000000..b4bc717cc --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml @@ -0,0 +1,122 @@ + + + + + + CLOSE + + + + + General Information + + + + + + + + + + + + + + + + + + + + + + + Environment: + + + + + + + + + + + + + + Application Version: + + + + + + + + + + + + + + Site: + + + + + + + + + + + + + + Machine S/N: + + + + + + + + + + + + + + Firmware Version: + + + + + + + + + + + +
+
+
+
+
+
+
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml.cs new file mode 100644 index 000000000..3e01d9b93 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml.cs @@ -0,0 +1,28 @@ +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.Navigation; +using System.Windows.Shapes; + +namespace Tango.PPC.UI.Dialogs +{ + /// + /// Interaction logic for GeneralInformationView.xaml + /// + public partial class GeneralInformationView : UserControl + { + public GeneralInformationView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationViewVM.cs new file mode 100644 index 000000000..c680f4b90 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationViewVM.cs @@ -0,0 +1,76 @@ +using System; +using System.Data.Entity; +using System.Linq; +using Tango.BL; +using Tango.BL.Entities; +using Tango.Core.DI; +using Tango.Integration.Operation; +using Tango.PMR.Diagnostics; +using Tango.PPC.Common; +using Tango.PPC.Common.Application; +using Tango.PPC.Common.Connection; +using Tango.PPC.Common.Notifications; +using Tango.Settings; +using Tango.SharedUI; + +namespace Tango.PPC.UI.Dialogs +{ + public class GeneralInformationViewVM : DialogViewVM + { + [TangoInject] + public IMachineProvider MachineProvider { get; set; } + + [TangoInject] + public IPPCApplicationManager ApplicationManager { get; set; } + + private PPCSettings _settings; + /// + /// Gets the main PPC settings. + /// + public PPCSettings Settings + { + get + { + if (_settings == null) + { + _settings = SettingsManager.Default.GetOrCreate(); + } + + return _settings; + } + private set { _settings = value; } + } + + public Site CurrentSite { get; set; } + + public String SiteName + { + get { return CurrentSite == null ? "" : CurrentSite.Name; } + } + + public GeneralInformationViewVM( IMachineProvider provider, IPPCApplicationManager appManager) + { + MachineProvider = provider; + ApplicationManager = appManager; + InitSite(); + } + + public async void InitSite() + { + if (CurrentSite == null) + { + var machine = MachineProvider.Machine; + if (machine != null && !String.IsNullOrEmpty(machine.SiteGuid)) + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var site = (await db.Sites.Where(x => x.Guid == machine.SiteGuid).ToListAsync()).FirstOrDefault(); + CurrentSite = site; + RaisePropertyChanged(nameof(SiteName)); + } + } + } + } + } +} + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 12d0486bd..e02dba00e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -182,6 +182,10 @@ CartridgeValidationView.xaml + + GeneralInformationView.xaml + + InsufficientLiquidQuantityView.xaml @@ -350,6 +354,10 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + MSBuild:Compile Designer diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs index 95eb22d7a..f40a89f42 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -293,6 +293,10 @@ namespace Tango.PPC.UI.ViewModels /// Gets or sets the stand by command. ///
public RelayCommand StandByCommand { get; set; } + /// + /// Gets or sets the open general information dialog command. + /// + public RelayCommand OpenGeneralinformationCommand { get; set; } #endregion @@ -317,6 +321,7 @@ namespace Tango.PPC.UI.ViewModels PowerOffCommand = new RelayCommand(PowerOffMachine, () => MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected); ResetCommand = new RelayCommand(ResetMachine, () => MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected); StandByCommand = new RelayCommand(StandBy, () => MachineProvider.MachineOperator.CanPrint); + OpenGeneralinformationCommand = new RelayCommand(OpenGeneralinformationDlg); _date_timer = new DispatcherTimer(); _date_timer.Interval = TimeSpan.FromSeconds(1); @@ -527,6 +532,13 @@ namespace Tango.PPC.UI.ViewModels IsMenuOpened = false; } + private async void OpenGeneralinformationDlg() + { + GeneralInformationViewVM vm = new GeneralInformationViewVM(MachineProvider, ApplicationManager); + vm = await NotificationProvider.ShowDialog(vm); + + } + #endregion #region Override Methods diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml index a72dc2d1d..84d1108f2 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml @@ -47,11 +47,13 @@ --> - - - - - + + + + + + + Date: Sun, 2 Jul 2023 15:26:42 +0300 Subject: UI Power options: Close application and minimize. Related Work Items: #8675 --- .../PPC/Tango.PPC.UI/Dialogs/PowerEurekaView.xaml | 32 ++++++++++++++------- .../PPC/Tango.PPC.UI/Dialogs/PowerEurekaViewVM.cs | 18 +++++++++++- .../Tango.PPC.UI/Images/Menu/AppPower_image.png | Bin 0 -> 799 bytes .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 1 + .../PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs | 11 +++++++ 5 files changed, 50 insertions(+), 12 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Menu/AppPower_image.png (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaView.xaml index f5b1116c0..3ef594046 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaView.xaml @@ -6,7 +6,7 @@ xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:local="clr-namespace:Tango.PPC.UI.Dialogs" mc:Ignorable="d" - Width="500" Height="462" + Width="500" Height="625" Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="500" d:DataContext="{d:DesignInstance Type=local:PowerEurekaViewVM, IsDesignTimeCreatable=False}"> @@ -36,17 +36,27 @@ Power
- - - Turn off - - - Restart + + + + Minimize + + Restart UI + Close + + - - - Restart - + + + + + Power Save + + Restart FW + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaViewVM.cs index 2dc8f7b6e..292c4b2d6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/PowerEurekaViewVM.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows; using Tango.Core.Commands; using Tango.SharedUI; @@ -10,7 +11,7 @@ namespace Tango.PPC.UI.Dialogs { public class PowerEurekaViewVM : DialogViewVM { - public enum PowerActionEnum { TurnOff, StandBy, Restart, RestartT }; + public enum PowerActionEnum { TurnOff, StandBy, Restart, RestartT, CloseApp }; private PowerActionEnum _powerAction; @@ -26,6 +27,8 @@ namespace Tango.PPC.UI.Dialogs public RelayCommand StandByCommand { get; set;} public RelayCommand RestartCommand { get; set; } public RelayCommand RestartTabletCommand { get; set; } + public RelayCommand MinimizeCommand { get; set; } + public RelayCommand CloseAppCommand { get; set; } public PowerEurekaViewVM() @@ -35,6 +38,19 @@ namespace Tango.PPC.UI.Dialogs StandByCommand = new RelayCommand(OnStandBy); RestartCommand = new RelayCommand(OnRestart); RestartTabletCommand = new RelayCommand(OnRestartTablet); + MinimizeCommand = new RelayCommand(OnMinimize); + CloseAppCommand = new RelayCommand(OnCloseApp); + } + + private void OnCloseApp(object obj) + { + PowerAction = PowerActionEnum.CloseApp; + base.Accept(); + } + + private void OnMinimize(object obj) + { + Application.Current.MainWindow.WindowState = WindowState.Minimized; } private void OnRestartTablet(object obj) diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Menu/AppPower_image.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Menu/AppPower_image.png new file mode 100644 index 000000000..e81b56d37 Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Menu/AppPower_image.png differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index f5d3502c0..e364c530c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -644,6 +644,7 @@ + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs index f40a89f42..17b676499 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -361,6 +361,9 @@ namespace Tango.PPC.UI.ViewModels if (MachineProvider.MachineOperator.Status != MachineStatuses.Disconnected) ResetMachine(); return; + case PowerEurekaViewVM.PowerActionEnum.CloseApp: + CloseApplication(); + return; default: return; } @@ -455,6 +458,14 @@ namespace Tango.PPC.UI.ViewModels } } + private async void CloseApplication() + { + if (await NotificationProvider.ShowQuestion("Are you sure you want to close the application?")) + { + ApplicationManager.ShutDown(); + } + } + /// /// Powers off the machine. /// -- cgit v1.3.1