From 24d0a8782f8324f80222251a4ff4977d1258e3a8 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 19 Mar 2019 15:50:02 +0200 Subject: PPC Working on Tech Module. TCC using arocus + barcode scanning using ZBar! --- .../PPCApplication/DefaultPPCApplicationManager.cs | 27 +++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs index 788d2b178..261dbe6d4 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -28,6 +28,7 @@ using Tango.PPC.Common.EventLogging; using Tango.BL.Enumerations; using Tango.PPC.Common.Notifications; using Tango.PPC.Common.WatchDog; +using Tango.PPC.UI.Dialogs; namespace Tango.PPC.UI.PPCApplication { @@ -88,6 +89,11 @@ namespace Tango.PPC.UI.PPCApplication /// public bool IsShuttingDown { get; private set; } + /// + /// Gets a value indicating whether the application is in technician mode. + /// + public bool IsInTechnicianMode { get; private set; } + /// /// Gets the application version. /// @@ -412,10 +418,24 @@ namespace Tango.PPC.UI.PPCApplication /// /// Enteres the application technician mode. /// - public void EnterTechnicianMode() + public async void EnterTechnicianMode() { - _moduleLoader.AllModules.ToList().ForEach(x => x.OnTechnicianEntered()); - _notificationProvider.ShowInfo("Technician mode is now enabled."); + var vm = await _notificationProvider.ShowDialog(); + + if (vm.DialogResult) + { + if (vm.Password == "Aa123456") + { + IsInTechnicianMode = true; + _moduleLoader.AllModules.ToList().ForEach(x => x.OnTechnicianEntered()); + await _notificationProvider.ShowInfo("Technician mode is now enabled."); + } + else + { + await _notificationProvider.ShowError("Invalid technician mode password."); + EnterTechnicianMode(); + } + } } /// @@ -423,6 +443,7 @@ namespace Tango.PPC.UI.PPCApplication /// public void ExitTechnicianMode() { + IsInTechnicianMode = false; _moduleLoader.AllModules.ToList().ForEach(x => x.OnTechnicianExited()); _notificationProvider.ShowInfo("Technician mode is now disabled."); } -- cgit v1.3.1 From db9308c46379fb324678ba04771dbee4edae4b17 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 20 Mar 2019 16:23:17 +0200 Subject: working on PPC Technician module . --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes .../Tango.PPC.Technician/Images/logging.png | Bin 0 -> 4265 bytes .../Modules/Tango.PPC.Technician/Images/system.png | Bin 0 -> 2854 bytes .../Tango.PPC.Technician.csproj | 26 ++++++ .../Tango.PPC.Technician/ViewModelLocator.cs | 24 +++++ .../ViewModels/CatalogViewVM.cs | 40 ++++++++ .../ViewModels/LoggingViewVM.cs | 52 +++++++++++ .../Tango.PPC.Technician/ViewModels/MainViewVM.cs | 7 ++ .../Tango.PPC.Technician/Views/CatalogView.xaml | 51 +++++++++++ .../Tango.PPC.Technician/Views/CatalogView.xaml.cs | 28 ++++++ .../Tango.PPC.Technician/Views/LoggingView.xaml | 101 +++++++++++++++++++++ .../Tango.PPC.Technician/Views/LoggingView.xaml.cs | 28 ++++++ .../Tango.PPC.Technician/Views/MainView.xaml | 35 +------ .../Application/IPPCApplicationManager.cs | 2 +- .../PPC/Tango.PPC.Common/PPCSettings.cs | 5 + .../PPC/Tango.PPC.Common/Resources/Merged.xaml | 1 + .../PPCApplication/DefaultPPCApplicationManager.cs | 39 +++++--- .../PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs | 18 ++++ .../PPC/Tango.PPC.UI/Views/LayoutView.xaml | 2 +- .../PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs | 28 +++--- .../Tango.AnimatedGif/ImageBehavior.cs | 6 +- .../ExtensionMethods/FrameworkElementExtensions.cs | 4 + .../Tango.Touch/Controls/TouchNativeListBox.xaml | 54 ++++++----- .../Tango.Touch/Controls/TouchPanel.xaml | 2 +- 25 files changed, 463 insertions(+), 90 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/logging.png create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/system.png create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/CatalogViewVM.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/CatalogView.xaml create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/CatalogView.xaml.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/LoggingView.xaml create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/LoggingView.xaml.cs (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index 36b58c4d0..fc78951f4 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index ab7c33171..58e5492a8 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/logging.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/logging.png new file mode 100644 index 000000000..580bcb046 Binary files /dev/null and b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/logging.png differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/system.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/system.png new file mode 100644 index 000000000..48c8ce83d Binary files /dev/null and b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Images/system.png differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Tango.PPC.Technician.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Tango.PPC.Technician.csproj index 2a4c1d39c..5b34c38a1 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Tango.PPC.Technician.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Tango.PPC.Technician.csproj @@ -72,7 +72,15 @@ True + + + + CatalogView.xaml + + + LoggingView.xaml + MainView.xaml @@ -96,6 +104,10 @@ {A34EE0F0-649D-41C8-8489-B6F1CC6924EE} Tango.Core + + {BC932DBD-7CDB-488C-99E4-F02CF441F55E} + Tango.Logging + {8491D07B-C1F6-4B62-A412-41B9FD2D6538} Tango.SharedUI @@ -114,6 +126,14 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -122,5 +142,11 @@ + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModelLocator.cs index 3a4c8d829..3c6f874e0 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModelLocator.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModelLocator.cs @@ -16,6 +16,8 @@ namespace Tango.PPC.Technician static ViewModelLocator() { TangoIOC.Default.Register(); + TangoIOC.Default.Register(); + TangoIOC.Default.Register(); } /// @@ -28,5 +30,27 @@ namespace Tango.PPC.Technician return TangoIOC.Default.GetInstance(); } } + + /// + /// Gets the logging view VM. + /// + public static LoggingViewVM LoggingViewVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } + + /// + /// Gets the logging view VM. + /// + public static CatalogViewVM CatalogViewVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/CatalogViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/CatalogViewVM.cs new file mode 100644 index 000000000..97bae6f5b --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/CatalogViewVM.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.PPC.Common; + +namespace Tango.PPC.Technician.ViewModels +{ + public class CatalogViewVM : PPCViewModel + { + /// + /// Gets or sets the navigation command. + /// + public RelayCommand NavigationCommand { get; set; } + + /// + /// Initializes a new instance of the class. + /// + public CatalogViewVM() + { + NavigationCommand = new RelayCommand(NavigateToView); + } + + public override void OnApplicationStarted() + { + + } + + /// + /// Navigates to the specified view name. + /// + /// The view. + private void NavigateToView(string view) + { + NavigationManager.NavigateTo(view); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs new file mode 100644 index 000000000..b46c6477e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.Logging; +using Tango.PPC.Common; + +namespace Tango.PPC.Technician.ViewModels +{ + public class LoggingViewVM : PPCViewModel + { + public SynchronizedObservableCollection ApplicationLogs { get; set; } + public SynchronizedObservableCollection EmbeddedLogs { get; set; } + + public LoggingViewVM() + { + ApplicationLogs = new SynchronizedObservableCollection(); + EmbeddedLogs = new SynchronizedObservableCollection(); + LogManager.NewLog += LogManager_NewLog; + } + + private void LogManager_NewLog(object sender, LogItemBase log) + { + ApplicationLogs.Insert(0, log); + + var now = DateTime.Now; + + try + { + foreach (var l in ApplicationLogs.ToList()) + { + if (l.TimeStamp.Date < DateTime.Now.Date) + { + ApplicationLogs.Remove(l); + } + } + } + catch + { + //I don't know if this will cause an exception but I'm tired. + } + } + + public override void OnApplicationStarted() + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/MainViewVM.cs index 893d495fc..d63a89f3b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/MainViewVM.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.PPC.Common; +using Tango.PPC.Technician.Views; namespace Tango.PPC.Technician.ViewModels { @@ -13,5 +14,11 @@ namespace Tango.PPC.Technician.ViewModels { } + + public override void OnNavigatedTo() + { + base.OnNavigatedTo(); + NavigationManager.NavigateTo(nameof(CatalogView)); + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/CatalogView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/CatalogView.xaml new file mode 100644 index 000000000..79d753474 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/CatalogView.xaml @@ -0,0 +1,51 @@ + + + + + + + + + + + + Technician Mode + + + + + + + Logging + + + + + + + System + + + + + + + Coming soon... + + + + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/CatalogView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/CatalogView.xaml.cs new file mode 100644 index 000000000..d5e0398fb --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/CatalogView.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.Technician.Views +{ + /// + /// Interaction logic for CatalogView.xaml + /// + public partial class CatalogView : UserControl + { + public CatalogView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/LoggingView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/LoggingView.xaml new file mode 100644 index 000000000..db82a5ad0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/LoggingView.xaml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + Logging + + + + + + + + Application + Embedded + + + + + + + + + + + + + + + + + + + Time: + + + + File: + + + + Method: + + + + Line: + + + + Message: + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/LoggingView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/LoggingView.xaml.cs new file mode 100644 index 000000000..9c12f7f13 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/LoggingView.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.Technician.Views +{ + /// + /// Interaction logic for LoggingView.xaml + /// + public partial class LoggingView : UserControl + { + public LoggingView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/MainView.xaml index 5e9401742..66e16588b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/MainView.xaml @@ -7,39 +7,14 @@ xmlns:vm="clr-namespace:Tango.PPC.Technician.ViewModels" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:global="clr-namespace:Tango.PPC.Technician" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:local="clr-namespace:Tango.PPC.Technician.Views" mc:Ignorable="d" d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> - - - - - - - - - - Logs - - - - - - - - Application - Embedded - - - - - - - - - - - + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs index ff3f65221..2d76b202f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs @@ -78,7 +78,7 @@ namespace Tango.PPC.Common.Application /// /// Enteres the application technician mode. /// - void EnterTechnicianMode(); + void EnterTechnicianMode(bool displayNotification = true); /// /// Exits the application technician mode. diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index 409dd1cfc..32181a753 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -76,6 +76,11 @@ namespace Tango.PPC.Common /// public bool EnableWatchDog { get; set; } + /// + /// Gets or sets a value indicating whether to enable the technician mode when the application starts. + /// + public bool EnableTechnicianModeByDefault { get; set; } + /// /// Gets the machine service address. /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml index 05cd998e6..62f248a8c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml @@ -14,6 +14,7 @@ + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs index 261dbe6d4..ba1b44c8a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -335,6 +335,11 @@ namespace Tango.PPC.UI.PPCApplication LogManager.Log($"Invoking {vm.GetType().Name}.OnApplicationReady..."); vm.OnApplicationReady(); } + + if (SettingsManager.Default.GetOrCreate().EnableTechnicianModeByDefault) + { + EnterTechnicianMode(false); + } }); } @@ -418,24 +423,32 @@ namespace Tango.PPC.UI.PPCApplication /// /// Enteres the application technician mode. /// - public async void EnterTechnicianMode() + public async void EnterTechnicianMode(bool displayNotification = true) { - var vm = await _notificationProvider.ShowDialog(); - - if (vm.DialogResult) + if (displayNotification) { - if (vm.Password == "Aa123456") - { - IsInTechnicianMode = true; - _moduleLoader.AllModules.ToList().ForEach(x => x.OnTechnicianEntered()); - await _notificationProvider.ShowInfo("Technician mode is now enabled."); - } - else + var vm = await _notificationProvider.ShowDialog(); + + if (vm.DialogResult) { - await _notificationProvider.ShowError("Invalid technician mode password."); - EnterTechnicianMode(); + if (vm.Password == "Aa123456") + { + IsInTechnicianMode = true; + _moduleLoader.AllModules.ToList().ForEach(x => x.OnTechnicianEntered()); + await _notificationProvider.ShowInfo("Technician mode is now enabled."); + } + else + { + await _notificationProvider.ShowError("Invalid technician mode password."); + EnterTechnicianMode(); + } } } + else + { + IsInTechnicianMode = true; + _moduleLoader.AllModules.ToList().ForEach(x => x.OnTechnicianEntered()); + } } /// 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 3cb790e65..9e8a9fe34 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -115,6 +115,12 @@ namespace Tango.PPC.UI.ViewModels /// Gets or sets the power command. /// public RelayCommand PowerCommand { get; set; } + + /// + /// Gets or sets the restart application command. + /// + public RelayCommand RestartApplicationCommand { get; set; } + #endregion #region Constructors @@ -139,6 +145,7 @@ namespace Tango.PPC.UI.ViewModels }); PowerCommand = new RelayCommand(() => IsPowerOpened = true); + RestartApplicationCommand = new RelayCommand(RestartApplication); } #endregion @@ -221,6 +228,17 @@ namespace Tango.PPC.UI.ViewModels } } + /// + /// Restarts the application. + /// + private async void RestartApplication() + { + if (await NotificationProvider.ShowQuestion("Are you sure you want to restart the application?")) + { + ApplicationManager.Restart(); + } + } + #endregion #region Override Methods diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml index 2a2f3e8b5..4079777f7 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml @@ -158,7 +158,7 @@ - Restart + Restart diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs index 2156e45ca..777083b67 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs @@ -52,24 +52,28 @@ namespace Tango.PPC.UI.Views private void OnMouseOrTouchDown(object sender, MouseOrTouchEventArgs e) { - techPressElement.CaptureMouse(); - - if (e.TouchDevice != null) - { - techPressElement.CaptureTouch(e.TouchDevice); - } + //if (e.TouchDevice != null) + //{ + // techPressElement.CaptureTouch(e.TouchDevice); + //} + //else + //{ + // techPressElement.CaptureMouse(); + //} _timer.Start(); } private void OnMouseOrTouchUp(object sender, MouseOrTouchEventArgs e) { - this.ReleaseMouseCapture(); - - if (e.TouchDevice != null) - { - techPressElement.ReleaseTouchCapture(e.TouchDevice); - } + //if (e.TouchDevice != null) + //{ + // techPressElement.ReleaseTouchCapture(e.TouchDevice); + //} + //else + //{ + // techPressElement.ReleaseMouseCapture(); + //} _timer.Stop(); } diff --git a/Software/Visual_Studio/Tango.AnimatedGif/ImageBehavior.cs b/Software/Visual_Studio/Tango.AnimatedGif/ImageBehavior.cs index a159106e6..cc13688ff 100644 --- a/Software/Visual_Studio/Tango.AnimatedGif/ImageBehavior.cs +++ b/Software/Visual_Studio/Tango.AnimatedGif/ImageBehavior.cs @@ -573,10 +573,8 @@ namespace Tango.AnimatedGif animation.RepeatBehavior = GetActualRepeatBehavior(imageControl, decoder, gifMetadata); - //Removed animation cache for PPC AsyncAdornerControl! - - //AnimationCache.AddAnimation(source, GetRepeatBehavior(imageControl), animation); - //AnimationCache.IncrementReferenceCount(source, GetRepeatBehavior(imageControl)); + AnimationCache.AddAnimation(source, GetRepeatBehavior(imageControl), animation); + AnimationCache.IncrementReferenceCount(source, GetRepeatBehavior(imageControl)); return animation; } return null; diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/FrameworkElementExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/FrameworkElementExtensions.cs index 08f3bb101..909366ffd 100644 --- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/FrameworkElementExtensions.cs +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/FrameworkElementExtensions.cs @@ -77,6 +77,7 @@ public static class FrameworkElementExtensions OriginalSource = e.OriginalSource, Handled = e.Handled, GetPositionAction = (s) => { return e.GetTouchPoint(s).Position; }, + TouchDevice = e.TouchDevice, }; handler(element, args); @@ -176,6 +177,7 @@ public static class FrameworkElementExtensions OriginalSource = e.OriginalSource, Handled = e.Handled, GetPositionAction = (s) => { return e.GetTouchPoint(s).Position; }, + TouchDevice = e.TouchDevice, }; handler(element, args); @@ -270,6 +272,7 @@ public static class FrameworkElementExtensions OriginalSource = e.OriginalSource, Handled = e.Handled, GetPositionAction = (s) => { return e.GetTouchPoint(s).Position; }, + TouchDevice = e.TouchDevice, }; handler(element, args); @@ -369,6 +372,7 @@ public static class FrameworkElementExtensions OriginalSource = e.OriginalSource, Handled = e.Handled, GetPositionAction = (s) => { return e.GetTouchPoint(s).Position; }, + TouchDevice = e.TouchDevice, }; handler(element, args); diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNativeListBox.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchNativeListBox.xaml index 7d04c902a..456e82750 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNativeListBox.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNativeListBox.xaml @@ -7,37 +7,35 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -120,6 +156,9 @@ + + + @@ -258,6 +297,9 @@ + + + @@ -385,7 +427,7 @@ - + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs index 6a6e770a7..3cd6e1bce 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs @@ -13,6 +13,7 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.BL; using Tango.BL.Entities; using Tango.Core.DI; using Tango.PPC.Jobs.ViewContracts; @@ -111,5 +112,15 @@ namespace Tango.PPC.Jobs.Views borderDockFloat.Child = dockEdit; borderEditDock.Visibility = Visibility.Collapsed; } + + private void OnLiquidVolumeFieldValueChanged(object sender, Touch.Controls.DoubleValueChangedEventArgs e) + { + var liquidVolume = (sender as FrameworkElement).DataContext as LiquidVolume; + + if (liquidVolume != null) + { + _vm.OnBrushStopFieldValueChanged(liquidVolume.BrushStop); + } + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs index c858e982e..b413fee0d 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -86,6 +86,27 @@ namespace Tango.PPC.MachineSettings.ViewModels set { _enableRemoteAssistance = value; RaisePropertyChangedAuto(); OnEnableRemoteAssistanceChanged(); } } + private bool _enableLockScreen; + public bool EnableLockScreen + { + get { return _enableLockScreen; } + set { _enableLockScreen = value; RaisePropertyChangedAuto(); } + } + + private int _lockScreenTimeoutMinutes; + public int LockScreenTimeoutMinutes + { + get { return _lockScreenTimeoutMinutes; } + set { _lockScreenTimeoutMinutes = value; RaisePropertyChangedAuto(); } + } + + private String _lockScreenPassword; + public String LockScreenPassword + { + get { return _lockScreenPassword; } + set { _lockScreenPassword = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -125,6 +146,9 @@ namespace Tango.PPC.MachineSettings.ViewModels Settings.HotSpotPassword = HotSpotPassword; Settings.EnableExternalBridge = EnableExternalBridge; Settings.ExternalBridgePassword = ExternalBridgePassword; + Settings.EnableLockScreen = EnableLockScreen; + Settings.LockScreenTimeout = TimeSpan.FromMinutes(LockScreenTimeoutMinutes); + Settings.LockScreenPassword = LockScreenPassword; Settings.Save(); await MachineProvider.SaveMachine(); @@ -166,6 +190,9 @@ namespace Tango.PPC.MachineSettings.ViewModels _enableRemoteAssistance = RemoteAssistanceProvider.IsEnabled; RaisePropertyChanged(nameof(EnableRemoteAssistance)); + EnableLockScreen = Settings.EnableLockScreen; + LockScreenTimeoutMinutes = (int)Settings.LockScreenTimeout.TotalMinutes; + LockScreenPassword = Settings.LockScreenPassword; SelectedJobTypes = new SelectedObjectCollection(Enum.GetValues(typeof(JobTypes)).Cast().ToObservableCollection(), Machine.SupportedJobTypes.ToObservableCollection()); SelectedColorSpaces = new SelectedObjectCollection(Enum.GetValues(typeof(ColorSpaces)).Cast().Where(x => x.IsUserSpace()).ToObservableCollection(), Machine.SupportedColorSpaces.ToObservableCollection()); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index 4f846a46d..dd5f89bb2 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -11,7 +11,7 @@ xmlns:global="clr-namespace:Tango.PPC.MachineSettings" xmlns:local="clr-namespace:Tango.PPC.MachineSettings.Views" mc:Ignorable="d" - d:DesignHeight="2000" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + d:DesignHeight="2500" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> @@ -172,6 +172,29 @@ + + + + + + Enable Lock Screen + + + Lock Screen Timeout (m) + + + Lock Screen Password + + + + + + + Enable the lock screen to protect the panel from unauthorized access. + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs index 2d76b202f..5f58be48b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs @@ -94,5 +94,20 @@ namespace Tango.PPC.Common.Application /// Gets the application build date. /// String BuildDate { get; } + + /// + /// Gets or sets a value indicating whether the screen is currently locked. + /// + bool IsScreenLocked { get; set; } + + /// + /// Resets the screen lock timer. + /// + void ResetScreenLockTimer(); + + /// + /// Invokes a dialog for entering a password and releasing the screen lock. + /// + void ReleaseScreenLock(); } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index 698dbf374..050f1615c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -97,6 +97,21 @@ namespace Tango.PPC.Common /// public int GradientGenerationResolution { get; set; } + /// + /// Gets or sets a value indicating whether to enable the application lock screen. + /// + public bool EnableLockScreen { get; set; } + + /// + /// Gets or sets the lock screen timeout. + /// + public TimeSpan LockScreenTimeout { get; set; } + + /// + /// Gets or sets the lock screen password. + /// + public String LockScreenPassword { get; set; } + /// /// Gets the machine service address. /// @@ -119,6 +134,8 @@ namespace Tango.PPC.Common EmbeddedComPort = null; ExternalBridgePassword = "Aa123456"; HotSpotPassword = "Aa123456"; + LockScreenTimeout = TimeSpan.FromMinutes(10); + LockScreenPassword = "1111"; DeploymentSlot = DeploymentSlot.TEST; EnableWatchDog = true; } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ScreenLockView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ScreenLockView.xaml new file mode 100644 index 000000000..8a90b03a0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ScreenLockView.xaml @@ -0,0 +1,30 @@ + + + + + + + + + CANCEL + OK + + + + + Screen Locked + Please enter the password to unlock the screen. + + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ScreenLockView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ScreenLockView.xaml.cs new file mode 100644 index 000000000..4a28984e6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ScreenLockView.xaml.cs @@ -0,0 +1,36 @@ +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 TechnicianModeLoginView.xaml + /// + public partial class ScreenLockView : UserControl + { + public ScreenLockView() + { + InitializeComponent(); + + Loaded += ScreenLockView_Loaded; + } + + private async void ScreenLockView_Loaded(object sender, RoutedEventArgs e) + { + await Task.Delay(200); + txtPassword.Focus(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ScreenLockViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ScreenLockViewVM.cs new file mode 100644 index 000000000..e19117621 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ScreenLockViewVM.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SharedUI; + +namespace Tango.PPC.UI.Dialogs +{ + public class ScreenLockViewVM : DialogViewVM + { + private String _password; + public String Password + { + get { return _password; } + set { _password = value; RaisePropertyChangedAuto(); } + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/TechnicianModeLoginView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/TechnicianModeLoginView.xaml index ca53d6027..24a5416ba 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/TechnicianModeLoginView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/TechnicianModeLoginView.xaml @@ -7,6 +7,11 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="560" Width="600" Height="250" d:DataContext="{d:DesignInstance Type=local:TechnicianModeLoginViewVM, IsDesignTimeCreatable=False}"> + + + + + @@ -18,7 +23,7 @@ Technician Mode Please enter the technician mode password. - + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/TechnicianModeLoginView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/TechnicianModeLoginView.xaml.cs index 02dfed896..3a809b6f3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/TechnicianModeLoginView.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/TechnicianModeLoginView.xaml.cs @@ -23,6 +23,14 @@ namespace Tango.PPC.UI.Dialogs public TechnicianModeLoginView() { InitializeComponent(); + + Loaded += TechnicianModeLoginView_Loaded; + } + + private async void TechnicianModeLoginView_Loaded(object sender, RoutedEventArgs e) + { + await Task.Delay(200); + txtPassword.Focus(); } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs index ba1b44c8a..1550e97e1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -29,6 +29,8 @@ using Tango.BL.Enumerations; using Tango.PPC.Common.Notifications; using Tango.PPC.Common.WatchDog; using Tango.PPC.UI.Dialogs; +using Tango.Core.Threading; +using Tango.PPC.Common.Messages; namespace Tango.PPC.UI.PPCApplication { @@ -48,6 +50,7 @@ namespace Tango.PPC.UI.PPCApplication private INotificationProvider _notificationProvider; private WatchDogServer _watchdogServer; private ObservablesContext _machineContext; + private ActionTimer _screenLockTimer; /// /// Occurs when a system restart is required. @@ -116,6 +119,16 @@ namespace Tango.PPC.UI.PPCApplication } } + private bool _isScreenLocked; + /// + /// Gets or sets a value indicating whether the screen is currently locked. + /// + public bool IsScreenLocked + { + get { return _isScreenLocked; } + set { _isScreenLocked = value; RaisePropertyChangedAuto(); } + } + /// /// Initializes a new instance of the class. /// @@ -306,6 +319,8 @@ namespace Tango.PPC.UI.PPCApplication /// private void FinalizeModuleInitialization() { + var settings = SettingsManager.Default.GetOrCreate(); + LogManager.Log("Finalizing application initialization..."); LogManager.Log("Initializing Machine Provider..."); @@ -336,10 +351,30 @@ namespace Tango.PPC.UI.PPCApplication vm.OnApplicationReady(); } - if (SettingsManager.Default.GetOrCreate().EnableTechnicianModeByDefault) + if (settings.EnableTechnicianModeByDefault) { EnterTechnicianMode(false); } + + if (settings.EnableLockScreen) + { + _screenLockTimer = new ActionTimer(settings.LockScreenTimeout); + _screenLockTimer.ResetReplace(ScreenLockTimerAction); + } + + TangoMessenger.Default.Register((msg) => + { + if (_screenLockTimer != null) + { + _screenLockTimer.Dispose(); + } + + if (settings.EnableLockScreen) + { + _screenLockTimer = new ActionTimer(settings.LockScreenTimeout); + _screenLockTimer.ResetReplace(ScreenLockTimerAction); + } + }); }); } @@ -460,5 +495,38 @@ namespace Tango.PPC.UI.PPCApplication _moduleLoader.AllModules.ToList().ForEach(x => x.OnTechnicianExited()); _notificationProvider.ShowInfo("Technician mode is now disabled."); } + + /// + /// Invokes a dialog for entering a password and releasing the screen lock. + /// + public async void ReleaseScreenLock() + { + if (IsScreenLocked) + { + var vm = await _notificationProvider.ShowDialog(); + + if (vm.DialogResult) + { + if (vm.Password == SettingsManager.Default.GetOrCreate().LockScreenPassword) + { + IsScreenLocked = false; + ResetScreenLockTimer(); + } + } + } + } + + public void ResetScreenLockTimer() + { + if (_screenLockTimer != null) + { + _screenLockTimer.ResetReplace(ScreenLockTimerAction); + } + } + + private void ScreenLockTimerAction() + { + IsScreenLocked = true; + } } } 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 22ecff0f6..71fa82504 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 @@ -122,9 +122,13 @@ + + ScreenLockView.xaml + TechnicianModeLoginView.xaml + UpdateFromFileView.xaml @@ -186,6 +190,10 @@ Designer MSBuild:Compile + + MSBuild:Compile + Designer + Designer MSBuild:Compile @@ -526,7 +534,7 @@ del "$(TargetDir)firmware_package.tfp" - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml index 768fce222..6e820ab64 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml @@ -279,7 +279,12 @@ + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs index 777083b67..883d3f893 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs @@ -42,6 +42,13 @@ namespace Tango.PPC.UI.Views _timer = new DispatcherTimer(); _timer.Interval = TimeSpan.FromSeconds(10); _timer.Tick += _timer_Tick; + + this.PreviewMouseUp += LayoutView_PreviewMouseUp; + } + + private void LayoutView_PreviewMouseUp(object sender, MouseButtonEventArgs e) + { + _vm.ApplicationManager.ResetScreenLockTimer(); } private void _timer_Tick(object sender, EventArgs e) @@ -77,5 +84,10 @@ namespace Tango.PPC.UI.Views _timer.Stop(); } + + private void Grid_PreviewMouseUp(object sender, MouseButtonEventArgs e) + { + _vm.ApplicationManager.ReleaseScreenLock(); + } } } diff --git a/Software/Visual_Studio/Tango.BL/Entities/Job.cs b/Software/Visual_Studio/Tango.BL/Entities/Job.cs index 555e26ccc..c93889dad 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Job.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Job.cs @@ -455,9 +455,9 @@ namespace Tango.BL.Entities public Segment AddGradientSegment(double length) { var segment = AddSolidSegment(length); - segment.BrushStops.Last().Color = System.Windows.Media.Colors.Silver; + segment.BrushStops.Last().Color = System.Windows.Media.Colors.White; segment.AddBrushStop(); - segment.BrushStops.Last().Color = System.Windows.Media.Colors.DimGray; + segment.BrushStops.Last().Color = System.Windows.Media.Colors.White; return segment; } diff --git a/Software/Visual_Studio/Tango.Core/Threading/ActionTimer.cs b/Software/Visual_Studio/Tango.Core/Threading/ActionTimer.cs index 48ee12964..f16e7739c 100644 --- a/Software/Visual_Studio/Tango.Core/Threading/ActionTimer.cs +++ b/Software/Visual_Studio/Tango.Core/Threading/ActionTimer.cs @@ -10,7 +10,7 @@ namespace Tango.Core.Threading /// /// Represents an action executer with a predefined interval and a reset mechanism. /// - public class ActionTimer + public class ActionTimer : IDisposable { private Timer _timer; private Action _action; @@ -43,5 +43,17 @@ namespace Tango.Core.Threading _timer.Stop(); _action?.Invoke(); } + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + public void Dispose() + { + if (_timer != null) + { + _timer.Stop(); + _timer = null; + } + } } } diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs index 5e6a309da..6fbce65bf 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs @@ -49,6 +49,18 @@ namespace Tango.Touch.Controls public static readonly DependencyProperty WatermarkProperty = DependencyProperty.Register("Watermark", typeof(String), typeof(TouchNumericTextBox), new PropertyMetadata(null)); + + + public bool DisplayWatermarkHint + { + get { return (bool)GetValue(DisplayWatermarkHintProperty); } + set { SetValue(DisplayWatermarkHintProperty, value); } + } + public static readonly DependencyProperty DisplayWatermarkHintProperty = + DependencyProperty.Register("DisplayWatermarkHint", typeof(bool), typeof(TouchNumericTextBox), new PropertyMetadata(false)); + + + public String StringFormat { get { return (String)GetValue(StringFormatProperty); } diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.xaml index bfe65cbd1..29be2dd00 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.xaml @@ -88,23 +88,49 @@ - - - - - - - - + + + + + + + diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs index 777e53ed0..beb7e0c18 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs @@ -21,6 +21,7 @@ namespace Tango.Touch.Controls public class TouchTextBox : TouchInput { private TextBox _text_box; + private PasswordBox _password_box; private DateTime _lost_focus_time; public String Text @@ -97,6 +98,7 @@ namespace Tango.Touch.Controls base.OnApplyTemplate(); _text_box = GetTemplateChild("PART_TextBox") as TextBox; + _password_box = GetTemplateChild("PART_PasswordBox") as PasswordBox; _text_box.GotFocus += _text_box_GotFocus; _text_box.LostFocus += _text_box_LostFocus; @@ -137,7 +139,14 @@ namespace Tango.Touch.Controls public new void Focus() { - _text_box.Focus(); + if (IsPassword) + { + _password_box.Focus(); + } + else + { + _text_box.Focus(); + } } } } -- cgit v1.3.1