From 749d9907ffe8da66164ee3f523055b6fde5407a7 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Thu, 18 Apr 2019 16:40:48 +0300 Subject: Some fixes on PPC. --- .../Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs | 2 +- .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 24 +++++++++++----------- .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs index cd7308afb..ef838f590 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs @@ -108,7 +108,7 @@ namespace Tango.PPC.Jobs.ViewModels { LogManager.Log("Start job command pressed. Starting job and navigating to job progress view..."); - PrintingManager.Print(Job, _context); + await PrintingManager.Print(Job, _context); await NavigationManager.NavigateTo(false, nameof(JobProgressView)); } catch (Exception ex) diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index f0cf87079..850bd5964 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -545,18 +545,18 @@ namespace Tango.PPC.Jobs.ViewModels /// /// Starts the job. /// - private void StartJob() + private async void StartJob() { try { LogManager.Log("Start job command pressed. Starting job and navigating to job progress view..."); - PrintingManager.Print(Job, _db); - NavigationManager.NavigateTo(nameof(JobProgressView)); + await PrintingManager.Print(Job, _db); + await NavigationManager.NavigateTo(nameof(JobProgressView)); } catch (Exception ex) { LogManager.Log(ex, "Could not start the current job."); - NotificationProvider.ShowError($"Cannot start job.\n{ex.Message}."); + await NotificationProvider.ShowError($"Cannot start job.\n{ex.Message}."); } } @@ -802,20 +802,20 @@ namespace Tango.PPC.Jobs.ViewModels /// /// Starts a sample dye. /// - private void StartSampleDye() + private async void StartSampleDye() { try { LogManager.Log("Sample dye command pressed..."); - PrintingManager.PrintSample(Job, _db); + await PrintingManager.PrintSample(Job, _db); - NavigationManager.NavigateTo(nameof(JobProgressView)); + await NavigationManager.NavigateTo(nameof(JobProgressView)); } catch (Exception ex) { LogManager.Log(ex, $"Error executing sample dye for job {Job.Name}."); - NotificationProvider.ShowError("An error occurred while trying to execute the sample dye."); + await NotificationProvider.ShowError("An error occurred while trying to execute the sample dye."); } } @@ -940,7 +940,7 @@ namespace Tango.PPC.Jobs.ViewModels /// /// Starts the fine tuning. /// - private void StartFineTuning() + private async void StartFineTuning() { try { @@ -948,14 +948,14 @@ namespace Tango.PPC.Jobs.ViewModels _jobs_fine_tune_items[Job.Guid] = FineTuneItems.ToList(); - PrintingManager.PrintFineTuning(Job, _db, FineTuneItems); + await PrintingManager.PrintFineTuning(Job, _db, FineTuneItems); - NavigationManager.NavigateTo(nameof(JobProgressView)); + await NavigationManager.NavigateTo(nameof(JobProgressView)); } catch (Exception ex) { LogManager.Log(ex, "Error executing fine tuning job."); - NotificationProvider.ShowError("An error occurred while trying to start the fine tuning job."); + await NotificationProvider.ShowError("An error occurred while trying to start the fine tuning job."); } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index e5b693a35..893cdc973 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -510,7 +510,7 @@ Include white gap between segments - + @@ -576,7 +576,7 @@ - + -- cgit v1.3.1 From f27893986e9fd647a69be8569ecd5d944f853869 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Thu, 18 Apr 2019 20:48:48 +0300 Subject: Implemented machine status animations. --- .../JobSummeryNavigationObject.cs | 16 +++++++ .../Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj | 3 +- .../Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs | 22 +++++++++ .../Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs | 52 ++++++++++----------- .../Tango.PPC.Jobs/ViewModels/JobsViewVM.cs | 12 +++-- .../Tango.PPC.Jobs/Views/JobProgressView.xaml | 2 +- .../Images/GlobalStatus/Ready_Anim.gif | Bin 0 -> 4671 bytes .../Images/GlobalStatus/dyeing_Anim.gif | Bin 0 -> 27299 bytes .../Images/GlobalStatus/error_Anim.gif | Bin 0 -> 6654 bytes .../Images/GlobalStatus/getting_ready_Anim.gif | Bin 0 -> 20744 bytes .../Images/GlobalStatus/machine_off_Anim.gif | Bin 0 -> 48595 bytes .../Images/GlobalStatus/service_Anim.gif | Bin 0 -> 6408 bytes .../Images/GlobalStatus/shutdown_icon_Anim.gif | Bin 0 -> 16723 bytes .../Images/GlobalStatus/standby_Anim.gif | Bin 0 -> 31289 bytes .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 10 +++- .../PPC/Tango.PPC.UI/Views/LayoutView.xaml | 21 +++++---- .../Tango.AnimatedGif/ImageBehavior.cs | 10 ++++ .../ExtensionMethods/FrameworkElementExtensions.cs | 35 ++++++++++++++ .../Tango.Integration/Operation/MachineOperator.cs | 18 ++++++- .../Tango.Integration/Operation/MachineStatuses.cs | 2 + .../Tango.Touch/Controls/TouchGifAnimation.cs | 9 ++++ 21 files changed, 167 insertions(+), 45 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NavigationObjects/JobSummeryNavigationObject.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/Ready_Anim.gif create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/dyeing_Anim.gif create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/error_Anim.gif create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/getting_ready_Anim.gif create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/machine_off_Anim.gif create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/service_Anim.gif create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/shutdown_icon_Anim.gif create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/standby_Anim.gif (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NavigationObjects/JobSummeryNavigationObject.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NavigationObjects/JobSummeryNavigationObject.cs new file mode 100644 index 000000000..912b42683 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NavigationObjects/JobSummeryNavigationObject.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; + +namespace Tango.PPC.Jobs.NavigationObjects +{ + public class JobSummeryNavigationObject + { + public ObservablesContext Context { get; set; } + public Job Job { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj index 0aac423b8..5b7e97c93 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj @@ -190,6 +190,7 @@ + Code @@ -408,7 +409,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs index 264f41131..3e8c6f280 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs @@ -4,12 +4,14 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.BL.Entities; +using Tango.Core.Commands; using Tango.Integration.Operation; using Tango.PPC.Common; using Tango.PPC.Common.Navigation; using Tango.PPC.Jobs.AppBarItems; using Tango.PPC.Jobs.AppButtons; using Tango.PPC.Jobs.Dialogs; +using Tango.PPC.Jobs.NavigationObjects; using Tango.PPC.Jobs.Views; namespace Tango.PPC.Jobs.ViewModels @@ -47,10 +49,24 @@ namespace Tango.PPC.Jobs.ViewModels #endregion + #region Commands + + /// + /// Gets or sets the go to job command. + /// + /// + /// The go to job command. + /// + public RelayCommand GoToJobCommand { get; set; } + + #endregion + public JobProgressViewVM() { _stop_job_btn = new StopPrintingButton(); _stop_job_btn.Pressed += _stop_job_btn_Pressed; + + GoToJobCommand = new RelayCommand(GoToJob); } private void _stop_job_btn_Pressed() @@ -61,6 +77,12 @@ namespace Tango.PPC.Jobs.ViewModels } } + private void GoToJob() + { + NavigationManager.NavigateWithObject(new JobNavigationObject() { Job = _handler.Job }); + NavigationManager.ClearHistoryExcept(); + } + #region Override Methods /// diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs index ef838f590..1a980fc4a 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs @@ -9,7 +9,9 @@ using Tango.BL.Entities; using Tango.Core.Commands; using Tango.PPC.Common; using Tango.PPC.Common.Messages; +using Tango.PPC.Common.Navigation; using Tango.PPC.Jobs.Messages; +using Tango.PPC.Jobs.NavigationObjects; using Tango.PPC.Jobs.Views; namespace Tango.PPC.Jobs.ViewModels @@ -18,7 +20,7 @@ namespace Tango.PPC.Jobs.ViewModels /// Represents the job summary view model. /// /// - public class JobSummeryViewVM : PPCViewModel + public class JobSummeryViewVM : PPCViewModel, INavigationObjectReceiver { private ObservablesContext _context; @@ -59,37 +61,10 @@ namespace Tango.PPC.Jobs.ViewModels /// public JobSummeryViewVM() { - RegisterForMessage(HandleJobSelectedMessage); - DyeCommand = new RelayCommand(StartJob); EditCommand = new RelayCommand(EditJob); } - /// - /// Handles the job selected message. - /// - /// The message. - private async void HandleJobSelectedMessage(JobSelectedMessage message) - { - _context = message.Context; - Job = message.Job; - - Job = await new JobBuilder(_context).Set(Job.Guid) - .WithConfiguration() - .WithRML() - .WithUser() - .WithSegments() - .WithBrushStops() - .BuildAsync(); - - - try - { - EstimatedDuration = await Job.GetEstimatedDuration(); - } - catch { } - } - /// /// Edits the job. /// @@ -125,5 +100,26 @@ namespace Tango.PPC.Jobs.ViewModels { } + + public async void OnNavigatedToWithObject(JobSummeryNavigationObject obj) + { + _context = obj.Context; + Job = obj.Job; + + Job = await new JobBuilder(_context).Set(Job.Guid) + .WithConfiguration() + .WithRML() + .WithUser() + .WithSegments() + .WithBrushStops() + .BuildAsync(); + + + try + { + EstimatedDuration = await Job.GetEstimatedDuration(); + } + catch { } + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs index aef6dd549..95d6bc290 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs @@ -274,7 +274,11 @@ namespace Tango.PPC.Jobs.ViewModels if (!directlyToEdit && MachineProvider.MachineOperator.Status == Integration.Operation.MachineStatuses.ReadyToDye) { - await NavigationManager.NavigateTo(nameof(JobSummeryView)); + await NavigationManager.NavigateWithObject(new JobSummeryNavigationObject() + { + Context = _db, + Job = job, + }); } else { @@ -307,7 +311,7 @@ namespace Tango.PPC.Jobs.ViewModels Jobs = jobs; DraftJobsCollectionView = new ListCollectionView(Jobs); DraftJobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending)); - DraftJobsCollectionView.Filter = new Predicate(x => + DraftJobsCollectionView.Filter = new Predicate(x => { var job = x as Job; @@ -324,7 +328,7 @@ namespace Tango.PPC.Jobs.ViewModels HistoryJobsCollectionView = new ListCollectionView(Jobs); HistoryJobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending)); - HistoryJobsCollectionView.Filter = new Predicate(x => + HistoryJobsCollectionView.Filter = new Predicate(x => { var job = x as Job; @@ -427,7 +431,7 @@ namespace Tango.PPC.Jobs.ViewModels job.RmlGuid = machine.DefaultRml != null ? machine.DefaultRmlGuid : Adapter.Rmls.FirstOrDefault().Guid; job.WindingMethodGuid = Adapter.WindingMethods.FirstOrDefault().Guid; job.SpoolTypeGuid = machine.DefaultSpoolType != null ? machine.DefaultSpoolTypeGuid : Adapter.SpoolTypes.FirstOrDefault().Guid; - + if (Jobs.Count > 0) { job.JobIndex = Jobs.Max(x => x.JobIndex) + 1; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml index 0227e24f5..e44d194bd 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobProgressView.xaml @@ -210,7 +210,7 @@ - + Go to job diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/Ready_Anim.gif b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/Ready_Anim.gif new file mode 100644 index 000000000..11cef3b10 Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/Ready_Anim.gif differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/dyeing_Anim.gif b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/dyeing_Anim.gif new file mode 100644 index 000000000..058d9a34d Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/dyeing_Anim.gif differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/error_Anim.gif b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/error_Anim.gif new file mode 100644 index 000000000..9bf0d84f3 Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/error_Anim.gif differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/getting_ready_Anim.gif b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/getting_ready_Anim.gif new file mode 100644 index 000000000..79256816a Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/getting_ready_Anim.gif differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/machine_off_Anim.gif b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/machine_off_Anim.gif new file mode 100644 index 000000000..9ca81da39 Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/machine_off_Anim.gif differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/service_Anim.gif b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/service_Anim.gif new file mode 100644 index 000000000..f5962c36c Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/service_Anim.gif differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/shutdown_icon_Anim.gif b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/shutdown_icon_Anim.gif new file mode 100644 index 000000000..d936476b6 Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/shutdown_icon_Anim.gif differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/standby_Anim.gif b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/standby_Anim.gif new file mode 100644 index 000000000..89491179d Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/GlobalStatus/standby_Anim.gif 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 8c4cc4992..22ecff0f6 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 @@ -287,6 +287,14 @@ + + + + + + + + @@ -518,7 +526,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 4079777f7..768fce222 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml @@ -214,27 +214,30 @@ - - - - - + + diff --git a/Software/Visual_Studio/Tango.AnimatedGif/ImageBehavior.cs b/Software/Visual_Studio/Tango.AnimatedGif/ImageBehavior.cs index cc13688ff..63b951a2f 100644 --- a/Software/Visual_Studio/Tango.AnimatedGif/ImageBehavior.cs +++ b/Software/Visual_Studio/Tango.AnimatedGif/ImageBehavior.cs @@ -264,6 +264,16 @@ namespace Tango.AnimatedGif private static void SetAnimationController(DependencyObject obj, ImageAnimationController value) { obj.SetValue(AnimationControllerPropertyKey, value); + + if (value != null) + { + (value as ImageAnimationController).SpeedRatio = GetSpeedRatio(obj as Image); + + if (GetEnableAnimation(obj as Image)) + { + (value as ImageAnimationController).Play(); + } + } } private static readonly DependencyPropertyKey AnimationControllerPropertyKey = diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/FrameworkElementExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/FrameworkElementExtensions.cs index ca546922f..4371796c4 100644 --- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/FrameworkElementExtensions.cs +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/FrameworkElementExtensions.cs @@ -42,6 +42,13 @@ public static class FrameworkElementExtensions /// The handler. public static String RegisterForMouseOrTouchDown(this FrameworkElement element, FrameworkElement relativeTo, EventHandler handler) { + var existing_container = _containers.SingleOrDefault(x => x.Element == element && x.Handler == handler); + + if (existing_container != null) + { + return existing_container.Token; + } + bool mousePressed = false; bool touchDown = false; @@ -145,6 +152,13 @@ public static class FrameworkElementExtensions /// The handler. public static String RegisterForMouseOrTouchUp(this FrameworkElement element, FrameworkElement relativeTo, EventHandler handler) { + var existing_container = _containers.SingleOrDefault(x => x.Element == element && x.Handler == handler); + + if (existing_container != null) + { + return existing_container.Token; + } + bool mouseReleased = false; bool touchReleased = false; @@ -245,6 +259,13 @@ public static class FrameworkElementExtensions /// The handler. public static String RegisterForPreviewMouseOrTouchDown(this FrameworkElement element, FrameworkElement relativeTo, EventHandler handler) { + var existing_container = _containers.SingleOrDefault(x => x.Element == element && x.Handler == handler); + + if (existing_container != null) + { + return existing_container.Token; + } + bool mousePressed = false; bool touchDown = false; @@ -348,6 +369,13 @@ public static class FrameworkElementExtensions /// The handler. public static String RegisterForPreviewMouseOrTouchUp(this FrameworkElement element, FrameworkElement relativeTo, EventHandler handler) { + var existing_container = _containers.SingleOrDefault(x => x.Element == element && x.Handler == handler); + + if (existing_container != null) + { + return existing_container.Token; + } + bool mouseReleased = false; bool touchReleased = false; @@ -464,6 +492,13 @@ public static class FrameworkElementExtensions /// The handler. public static void RegisterForMouseOrTouchMove(this FrameworkElement element, FrameworkElement relativeTo, EventHandler handler) { + var existing_container = _containers.SingleOrDefault(x => x.Element == element && x.Handler == handler); + + if (existing_container != null) + { + return; + } + bool _isTouch = false; MouseEventHandler mouseHandler = (x, e) => diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index b25afd67d..2672b2d0f 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -1356,7 +1356,7 @@ namespace Tango.Integration.Operation ThreadFactory.StartNew(async () => { - Status = MachineStatuses.Printing; + Status = MachineStatuses.GettingReady; RunningJob = originalJob; PrintingStarted?.Invoke(this, new PrintingEventArgs(handler, originalJob)); @@ -1411,6 +1411,22 @@ namespace Tango.Integration.Operation responseLogged = true; LogResponseReceived(response.Message); } + + if (JobHandlingMode == JobHandlerModes.SettingUp) + { + if (response.Message.Status.Progress > request.JobTicket.ProcessParameters.DryerBufferLength) + { + Status = MachineStatuses.Printing; + } + } + else + { + if (response.Message.Status.Progress > 0) + { + Status = MachineStatuses.Printing; + } + } + }, (ex) => { if (!(ex is ContinuousResponseAbortedException)) diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineStatuses.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineStatuses.cs index 3a09256b1..059c1f859 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineStatuses.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineStatuses.cs @@ -15,6 +15,8 @@ namespace Tango.Integration.Operation Standby, [Description("Ready To Dye")] ReadyToDye, + [Description("Getting Ready")] + GettingReady, [Description("Dyeing")] Printing, [Description("Service")] diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchGifAnimation.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchGifAnimation.cs index 45e552a43..38a2175d8 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchGifAnimation.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchGifAnimation.cs @@ -49,6 +49,15 @@ namespace Tango.Touch.Controls public static readonly DependencyProperty EnableAnimationProperty = DependencyProperty.Register("EnableAnimation", typeof(bool), typeof(TouchGifAnimation), new PropertyMetadata(false)); + public TouchGifAnimation() + { + Loaded += TouchGifAnimation_Loaded; + } + + private void TouchGifAnimation_Loaded(object sender, RoutedEventArgs e) + { + EnableAnimation = EnableAnimation; + } static TouchGifAnimation() { -- cgit v1.3.1 From 09eabd45ecf65d6f900b9d53428e7576bdc4d825 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Thu, 18 Apr 2019 22:19:59 +0300 Subject: Implemented resume job on PPC. Fixed resume job on emulator. Fixed an issue with PPC event logger. Added getting ready status to machine operator. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../Build/Shortcuts/Machine Emulator.lnk | Bin 1445 -> 1530 bytes .../Tango.PPC.Jobs/ViewModels/MainViewVM.cs | 34 +++++++++++++++++++++ .../EventLogging/DefaultEventLogger.cs | 25 ++++++++++++++- .../Tango.Emulations/Emulators/MachineEmulator.cs | 4 +-- .../Tango.Integration/Operation/MachineOperator.cs | 19 ++++++++++-- 7 files changed, 77 insertions(+), 5 deletions(-) (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 84eb6afc9..724b8c150 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index f3b9858f1..a2be2cb15 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk index 7417e4f31..697cc906e 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs index 7026a6ebc..d72f4544a 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Builders; using Tango.BL.Entities; using Tango.BL.Enumerations; using Tango.Integration.Operation; @@ -28,6 +30,38 @@ namespace Tango.PPC.Jobs.ViewModels { MachineProvider.MachineOperator.PrintingCompleted += MachineOperator_PrintingCompleted; MachineProvider.MachineOperator.PrintingFailed += MachineOperator_PrintingFailed; + MachineProvider.MachineOperator.ResumingJob += MachineOperator_ResumingJob; + } + + private async void MachineOperator_ResumingJob(object sender, ResumingJobEventArgs e) + { + LogManager.Log($"Trying to resume job '{e.JobGuid}'..."); + + try + { + var job = await new JobBuilder(ObservablesContext.CreateDefault()).Set(e.JobGuid) + .WithConfiguration() + .WithRML() + .WithUser() + .WithSegments() + .WithBrushStops() + .BuildAsync(); + + e.Approve(job); + + InvokeUI(() => + { + NavigationManager.NavigateTo(nameof(JobProgressView)); + }); + } + catch (Exception ex) + { + LogManager.Log(ex, "An error occurred while trying to resume the job."); + InvokeUI(() => + { + NotificationProvider.ShowError("An error occurred while trying to resume a job in progress."); + }); + } } /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs index d540e3fd3..25eb2df04 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs @@ -79,6 +79,7 @@ namespace Tango.PPC.Common.EventLogging _machineProvider.MachineOperator.RequestSent += Machine_RequestSent; _machineProvider.MachineOperator.RequestFailed += Machine_RequestFailed; _machineProvider.MachineOperator.ResponseReceived += Machine_ResponseReceived; + _machineProvider.MachineOperator.StateChanged += MachineOperator_StateChanged; } #endregion @@ -113,6 +114,20 @@ namespace Tango.PPC.Common.EventLogging #region Event Handlers + /// + /// Handles the machine operator state changed event. + /// + /// The sender. + /// The e. + private void MachineOperator_StateChanged(object sender, Transport.TransportComponentState e) + { + if (e == Transport.TransportComponentState.Connected) + { + _events = new ConcurrentQueue(); + _currentEvents.Clear(); + } + } + /// /// Handles the RequestSent event of the connected machine. /// @@ -212,7 +227,15 @@ namespace Tango.PPC.Common.EventLogging machineEvent.UserGuid = _authentication.CurrentUser.Guid; machineEvent.User = _authentication.CurrentUser; _events.Enqueue(machineEvent); - _currentEvents.Add(machineEvent); + + if (!_currentEvents.Exists(x => x.Type == machineEvent.Type)) + { + if (machineEvent.Group != EventTypeGroups.Application && machineEvent.Group != EventTypeGroups.Transport) + { + _currentEvents.Add(machineEvent); + } + } + EventReceived?.Invoke(this, machineEvent); } } diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index f1d9487ff..8b83f1f73 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -606,7 +606,7 @@ namespace Tango.Emulations.Emulators Transporter.SendResponse(new ResumeCurrentJobResponse() { - }, request.Container.Token, false, ErrorCode.ContinuousResponseAborted); + }, _current_job_resume_token, false, ErrorCode.ContinuousResponseAborted); } } else @@ -631,7 +631,7 @@ namespace Tango.Emulations.Emulators Progress = job.Length + job.ProcessParameters.DryerBufferLength, } - }, request.Container.Token, !_cancelJob); + }, _current_job_resume_token, !_cancelJob); } } }); diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 2672b2d0f..dd0872898 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -226,7 +226,7 @@ namespace Tango.Integration.Operation { get { - return Status == MachineStatuses.Printing; + return Status == MachineStatuses.Printing || Status == MachineStatuses.GettingReady; } } @@ -862,12 +862,27 @@ namespace Tango.Integration.Operation if (!responseLogged) { + Status = MachineStatuses.GettingReady; responseLogged = true; - Status = MachineStatuses.Printing; RunningJob = originalJob; PrintingStarted?.Invoke(this, new PrintingEventArgs(handler, originalJob)); LogResponseReceived(response.Message); } + + if (JobHandlingMode == JobHandlerModes.SettingUp) + { + if (response.Message.Status.Progress > jobTicket.ProcessParameters.DryerBufferLength) + { + Status = MachineStatuses.Printing; + } + } + else + { + if (response.Message.Status.Progress > 0) + { + Status = MachineStatuses.Printing; + } + } }, (ex) => { if (!(ex is ContinuousResponseAbortedException)) -- cgit v1.3.1 From 26ede873b194b0df70979b6f1b62e0c91ca19341 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sat, 20 Apr 2019 21:48:32 +0300 Subject: Working on PPC performance... --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 7 +- .../Tango.PPC.Jobs/ViewModels/JobsViewVM.cs | 3 +- .../Visual_Studio/Tango.Core/ExtendedObject.cs | 9 +- .../Tango.SharedUI/Controls/FastTextBlock.cs | 73 +++++++++++++++ .../Tango.SharedUI/Tango.SharedUI.csproj | 3 +- .../Controls/TouchVirtualizedContentControl.cs | 99 +++++++++++++++++++++ .../Controls/TouchVirtualizedContentControl.xaml | 15 ++++ .../Visual_Studio/Tango.Touch/Tango.Touch.csproj | 7 +- .../Visual_Studio/Tango.Touch/Themes/Generic.xaml | 1 + Software/Visual_Studio/Tango.sln | 12 +-- 12 files changed, 217 insertions(+), 12 deletions(-) create mode 100644 Software/Visual_Studio/Tango.SharedUI/Controls/FastTextBlock.cs create mode 100644 Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentControl.cs create mode 100644 Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentControl.xaml (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 724b8c150..1d4f688b1 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index a2be2cb15..dc895c719 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index 850bd5964..9aaf9fcbd 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -764,8 +764,11 @@ namespace Tango.PPC.Jobs.ViewModels /// The brush stop. public void OnBrushStopFieldValueChanged(BrushStop brushStop) { - brushStop.Corrected = false; - brushStop.OutOfGamutChecked = false; + if (brushStop != null) + { + brushStop.Corrected = false; + brushStop.OutOfGamutChecked = false; + } } /// diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs index 95d6bc290..86c53440e 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs @@ -272,6 +272,8 @@ namespace Tango.PPC.Jobs.ViewModels { LogManager.Log($"Job '{job.Name}' selected."); + RaiseMessage(new JobSelectedMessage() { Job = job, Context = _db }); + if (!directlyToEdit && MachineProvider.MachineOperator.Status == Integration.Operation.MachineStatuses.ReadyToDye) { await NavigationManager.NavigateWithObject(new JobSummeryNavigationObject() @@ -284,7 +286,6 @@ namespace Tango.PPC.Jobs.ViewModels { await NavigationManager.NavigateTo(nameof(JobView)); } - RaiseMessage(new JobSelectedMessage() { Job = job, Context = _db }); } /// diff --git a/Software/Visual_Studio/Tango.Core/ExtendedObject.cs b/Software/Visual_Studio/Tango.Core/ExtendedObject.cs index 44663b503..acead4157 100644 --- a/Software/Visual_Studio/Tango.Core/ExtendedObject.cs +++ b/Software/Visual_Studio/Tango.Core/ExtendedObject.cs @@ -109,7 +109,14 @@ namespace Tango.Core /// The action. protected virtual void InvokeUI(Action action) { - Application.Current.Dispatcher.BeginInvoke(action); + if (Application.Current != null) + { + Application.Current.Dispatcher.BeginInvoke(action); + } + else + { + action(); + } } /// diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/FastTextBlock.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/FastTextBlock.cs new file mode 100644 index 000000000..5b2808ab1 --- /dev/null +++ b/Software/Visual_Studio/Tango.SharedUI/Controls/FastTextBlock.cs @@ -0,0 +1,73 @@ +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.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.SharedUI.Controls +{ + + public class FastTextBlock : Control + { + private FormattedText _formattedText; + + static FastTextBlock() + { + + } + + public static readonly DependencyProperty TextProperty = + DependencyProperty.Register( + "Text", + typeof(string), + typeof(FastTextBlock), + new FrameworkPropertyMetadata(string.Empty, FrameworkPropertyMetadataOptions.AffectsMeasure, + (o, e) => ((FastTextBlock)o).TextPropertyChanged((string)e.NewValue))); + + private void TextPropertyChanged(string text) + { + if (text != null) + { + var typeface = new Typeface( + FontFamily, + FontStyles.Normal, FontWeights.Normal, FontStretches.Normal); + + _formattedText = new FormattedText( + text, CultureInfo.CurrentCulture, + FlowDirection.LeftToRight, typeface, FontSize, Foreground); + } + } + + + public string Text + { + get { return (string)GetValue(TextProperty); } + set { SetValue(TextProperty, value); } + } + + protected override void OnRender(DrawingContext drawingContext) + { + if (_formattedText != null) + { + drawingContext.DrawText(_formattedText, new Point()); + } + } + + protected override Size MeasureOverride(Size constraint) + { + return _formattedText != null + ? new Size(_formattedText.Width, _formattedText.Height) + : new Size(); + } + } +} \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj index a8bd06040..37ba006f0 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj +++ b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj @@ -68,6 +68,7 @@ + HiveControl.xaml @@ -235,7 +236,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentControl.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentControl.cs new file mode 100644 index 000000000..8e3db84fa --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentControl.cs @@ -0,0 +1,99 @@ +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.Markup; +using System.Windows.Shapes; +using Tango.Core.Threading; + +namespace Tango.Touch.Controls +{ + [ContentProperty(nameof(Content))] + public class TouchVirtualizedContentControl : Control + { + private LightTouchScrollViewer _scrollViewer; + private ContentPresenter _innerBorder; + private ActionTimer _updateTimer; + private Point _location; + private bool _loaded; + + public UIElement Content + { + get { return (UIElement)GetValue(ContentProperty); } + set { SetValue(ContentProperty, value); } + } + public static readonly DependencyProperty ContentProperty = + DependencyProperty.Register("Content", typeof(UIElement), typeof(TouchVirtualizedContentControl), new PropertyMetadata(null)); + + static TouchVirtualizedContentControl() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(TouchVirtualizedContentControl), new FrameworkPropertyMetadata(typeof(TouchVirtualizedContentControl))); + } + + public TouchVirtualizedContentControl() + { + _updateTimer = new ActionTimer(TimeSpan.FromMilliseconds(200)); + Loaded += TouchVirtualizedContentControl_Loaded; + } + + public override void OnApplyTemplate() + { + base.OnApplyTemplate(); + _innerBorder = GetTemplateChild("PART_innerBorder") as ContentPresenter; + } + + private void TouchVirtualizedContentControl_Loaded(object sender, System.Windows.RoutedEventArgs e) + { + _scrollViewer = this.FindAncestor(); + _scrollViewer.Scrolling += _scrollViewer_Scrolling; + + _location = this.TranslatePoint(new Point(0, 0), _scrollViewer); + + ApplyOptimization(); + _loaded = true; + } + + private void _scrollViewer_Scrolling(object sender, DoubleValueChangedEventArgs e) + { + if (_loaded) + { + //_updateTimer.ResetReplace(() => + //{ + // Dispatcher.BeginInvoke(new Action(() => + // { + ApplyOptimization(); + // })); + //}); + } + } + + private void ApplyOptimization() + { + var _border_viewport = _scrollViewer.GetViewportBorder(); + + if (_border_viewport.IsAncestorOf(this)) + { + //Point relativeLocation = this.TranslatePoint(new Point(0, 0), _border_viewport); + //Rect bounds = this.TransformToAncestor(_border_viewport).TransformBounds(new Rect(0.0, 0.0, this.ActualWidth, this.ActualHeight)); + //Rect rect = new Rect(0.0, 0.0, _border_viewport.ActualWidth, _border_viewport.ActualHeight); + if (_location.Y > _scrollViewer.GetScrollPosition() && _location.Y < _scrollViewer.GetScrollPosition() + _border_viewport.ActualHeight) + { + if (_innerBorder.Visibility == Visibility.Hidden) + { + _innerBorder.Visibility = Visibility.Visible; + } + } + else + { + if (_innerBorder.Visibility == Visibility.Visible) + { + _innerBorder.Visibility = Visibility.Hidden; + } + } + } + } + } +} diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentControl.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentControl.xaml new file mode 100644 index 000000000..7cd72cc40 --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentControl.xaml @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj index 15e455168..3177f206d 100644 --- a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj +++ b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj @@ -91,6 +91,7 @@ + @@ -245,6 +246,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -385,7 +390,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml b/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml index 832a3bf95..b80e058db 100644 --- a/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml +++ b/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml @@ -44,6 +44,7 @@ + diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln index 880ff9c4a..a3e349ad0 100644 --- a/Software/Visual_Studio/Tango.sln +++ b/Software/Visual_Studio/Tango.sln @@ -5296,12 +5296,12 @@ Global {B822CBD9-1113-4668-85C9-22AA9C24CE60} = {EC62BC9C-F2FE-4333-B7E4-110E38D43958} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - BuildVersion_UseGlobalSettings = False - BuildVersion_AssemblyInfoFilename = Properties\AssemblyInfo.cs - BuildVersion_StartDate = 2000/1/1 - BuildVersion_UpdateFileVersion = False - BuildVersion_UpdateAssemblyVersion = True - BuildVersion_BuildVersioningStyle = None.None.Increment.DeltaBaseYearDayOfYear SolutionGuid = {7986F7F4-A86A-4994-B1B6-0988D7F057B6} + BuildVersion_BuildVersioningStyle = None.None.Increment.DeltaBaseYearDayOfYear + BuildVersion_UpdateAssemblyVersion = True + BuildVersion_UpdateFileVersion = False + BuildVersion_StartDate = 2000/1/1 + BuildVersion_AssemblyInfoFilename = Properties\AssemblyInfo.cs + BuildVersion_UseGlobalSettings = False EndGlobalSection EndGlobal -- cgit v1.3.1 From 13887d7b53fec7e2d357fd377a6a1fbd0e875e65 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Mon, 22 Apr 2019 09:33:28 +0300 Subject: Working on PPC optimizations... --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml | 20 +- .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 17 +- .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 1142 ++++++++++---------- .../Controls/TwineCatalogControl.xaml | 15 +- .../PPC/Tango.PPC.UI/MainWindow.xaml.cs | 14 + .../Notifications/DefaultNotificationProvider.cs | 10 +- .../PPC/Tango.PPC.UI/Views/LoginView.xaml | 7 - .../PPC/Tango.PPC.UI/Views/MainView.xaml | 4 +- .../Visual_Studio/Tango.BL/Entities/BrushStop.cs | 12 +- .../Visual_Studio/Tango.BL/Entities/Segment.cs | 1 + .../Tango.DragAndDrop/DragAndDropService.cs | 14 +- .../Tango.SharedUI/Controls/FastTextBlock.cs | 28 +- .../Components/SharedResourceDictionary.cs | 55 + .../Tango.Touch/Controls/TouchAutoComplete.cs | 4 + .../Tango.Touch/Controls/TouchLoadingPanel.xaml | 2 +- .../Tango.Touch/Controls/TouchNumericTextBox.cs | 5 +- .../Tango.Touch/Controls/TouchNumericTextBox.xaml | 22 +- .../Tango.Touch/Controls/TouchPanel.cs | 14 + .../Tango.Touch/Controls/TouchPanel.xaml | 124 ++- .../Tango.Touch/Controls/TouchTextBox.xaml | 2 +- .../Controls/TouchVirtualizedContentControl.cs | 42 +- .../Tango.Touch/Resources/Colors.xaml | 4 +- .../Visual_Studio/Tango.Touch/Resources/Fonts.xaml | 4 +- .../Visual_Studio/Tango.Touch/Tango.Touch.csproj | 1 + 26 files changed, 882 insertions(+), 681 deletions(-) create mode 100644 Software/Visual_Studio/Tango.Touch/Components/SharedResourceDictionary.cs (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 1d4f688b1..e66689c76 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index dc895c719..42942dacd 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml index e7a416623..be151678d 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml @@ -7,7 +7,7 @@ xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" xmlns:local="clr-namespace:Tango.PPC.Jobs.Controls" mc:Ignorable="d" - d:DesignHeight="60" d:DesignWidth="500" Height="38" d:DataContext="{d:DesignInstance Type=entities:Job, IsDesignTimeCreatable=False}"> + d:DesignHeight="60" d:DesignWidth="500" Height="38" d:DataContext="{d:DesignInstance Type=entities:Job, IsDesignTimeCreatable=False}" x:Name="control"> @@ -20,7 +20,7 @@ - + @@ -28,12 +28,12 @@ - + - - - + + + @@ -42,13 +42,13 @@ - + @@ -67,7 +67,7 @@ - + @@ -102,7 +102,7 @@ - + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index 9aaf9fcbd..c7946ee6a 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -396,7 +396,8 @@ namespace Tango.PPC.Jobs.ViewModels { LogManager.Log($"Loading selected job '{_job_to_load.Name}'..."); - NotificationProvider.SetGlobalBusyMessage("Loading job details..."); + //NotificationProvider.SetGlobalBusyMessage("Loading job details..."); + IsFree = false; _can_navigate_back = false; @@ -433,10 +434,6 @@ namespace Tango.PPC.Jobs.ViewModels SegmentsCollectionView = CollectionViewSource.GetDefaultView(Job.Segments); SegmentsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Segment.SegmentIndex), ListSortDirection.Ascending)); - InvokeUIOnIdle(() => - { - NotificationProvider.ReleaseGlobalBusyMessage(); - }); _job_to_load = null; } @@ -471,10 +468,16 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log(ex, $"Error loading job '{_job_to_load.Name}'"); await NotificationProvider.ShowError("An error occurred while trying to load the selected job."); } + finally + { + InvokeUIOnIdle(() => + { + IsFree = true; + //NotificationProvider.ReleaseGlobalBusyMessage(); + }); + } } - - /// /// Saves the job. /// diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index 893cdc973..cb12805f5 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -17,11 +17,15 @@ xmlns:localControls="clr-namespace:Tango.PPC.Jobs.Controls" xmlns:local="clr-namespace:Tango.PPC.Jobs.Views" mc:Ignorable="d" - d:DesignHeight="2000" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:JobViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.JobViewVM}"> + d:DesignHeight="2000" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:JobViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.JobViewVM}" x:Name="view"> + + + + - + - + - + - - + + - - - - - + + - + - - - - - - + + + Color & Length + - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + - - - - - - - SOLID SEGMENT - - - - - - - - - - - - - GRADIENT SEGMENT - - - + + + + + + + + + + + SOLID SEGMENT + + + + + + + + + + + + + GRADIENT SEGMENT + + + - - - Include white gap between segments - - + + + Include white gap between segments + + - + - + - - - - + + + + - + - - - Output - + + + Output + - - - - - - - - + + + + + + + - - - - - Job Summary - + + + + + Job Summary + - - - - + + + + - + - - + + - - - - - + + + + + (+%) - - + + - - + + - + - + - % + % - - - + + + + - - + - - Additional Tools - + + Additional Tools + - - - - - - Sample Dye - - + + + + + Sample Dye + + - - - - - - - - - - START - - - - + + + + + + + + + + + + START + + + + - - - - - - How to continue? + + + + + + How to continue? + + + + + + + DONE + + - - - - - - DONE - - + The sample is approved + - The sample is approved - + + + + + REPEAT + + - - + Dye more samples + + + + + + + + + + + + + + + Sample Approved: + + + - - REPEAT + + ANOTHER SAMPLE + + + + + + + + + + - Dye more samples - - - - - - - - - - - - - - - Sample Approved: - - - - - - ANOTHER SAMPLE - - - - - - + + + - - - - - - - - - + + - - - + + + You can use the color fine tuning tool to adjust the colors. - + + - - + - - - - - Color Fine Tuning - - - - - - - - - - - - - - - - - - + + + + + Color Fine Tuning + + - - Reset + - - START - - - - - - - - - - - - - - 1 - - Select the best variation for each color: - + + + + + + + + + + + + + + + + + 2 + + How to continue - - - - - REPEAT - - + + + + + + DONE + + - Some color need more fine tuning - - - - - - + All colors are approved + - - - - - - + + + + + REPEAT + + + + Some color need more fine tuning + + + + + + + + + + + + + Colors Approved: - - - - - REPEAT FINE TUNING - - - - - - - - - - - - - + + + + + REPEAT FINE TUNING + + + + + + + + + + + + + + - - - - - - - - - - + + - - - - - - - - - + + + - - + + + - + - - + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml index 897810c99..f99b299cc 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Tango.PPC.Common.Controls" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:catalog="clr-namespace:Tango.BL.Catalogs;assembly=Tango.BL" mc:Ignorable="d" @@ -20,8 +21,8 @@ - - + + @@ -45,8 +46,8 @@ - - + + @@ -54,8 +55,8 @@ - - + + @@ -68,7 +69,7 @@ - + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs index 364ca8ee7..b90a1afff 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs @@ -11,7 +11,9 @@ using System.Windows.Data; using System.Windows.Documents; using System.Windows.Forms; using System.Windows.Input; +using System.Windows.Interop; using System.Windows.Media; +using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; @@ -32,6 +34,8 @@ namespace Tango.PPC.UI { Instance = this; + //Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline),new FrameworkPropertyMetadata { DefaultValue = 30 }); + InitializeComponent(); bool has_touch = false; @@ -77,6 +81,16 @@ namespace Tango.PPC.UI Closing += MainWindow_Closing; } + protected override void OnSourceInitialized(EventArgs e) + { + //var hwndSource = PresentationSource.FromVisual(this) as HwndSource; + + //if (hwndSource != null) + // hwndSource.CompositionTarget.RenderMode = RenderMode.SoftwareOnly; + + base.OnSourceInitialized(e); + } + private void LockAspectRatio() { this.Width = (this.Height * (800d / 1280d)) - 10; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs index d7dca484e..5062df1d6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs @@ -140,7 +140,7 @@ namespace Tango.PPC.UI.Notifications return ShowMessageBox(new MessageBoxVM() { Message = message, - Icon = TouchIconKind.AlertOctagon, + Icon = TouchIconKind.AlertCircleOutline, Title = "Error", Brush = Application.Current.Resources["TangoMessageBoxErrorBrush"] as Brush, }); @@ -156,7 +156,7 @@ namespace Tango.PPC.UI.Notifications return ShowMessageBox(new MessageBoxVM() { Message = message, - Icon = TouchIconKind.InfoCircleSolid, + Icon = TouchIconKind.AlertCircleOutline, Title = "Information", Brush = Application.Current.Resources["TangoMessageBoxInfoBrush"] as Brush, }); @@ -172,7 +172,7 @@ namespace Tango.PPC.UI.Notifications return ShowMessageBox(new MessageBoxVM() { Message = message, - Icon = TouchIconKind.Alert, + Icon = TouchIconKind.AlertCircleOutline, Title = "Warning", Brush = Application.Current.Resources["TangoMessageBoxWarningBrush"] as Brush, }); @@ -188,7 +188,7 @@ namespace Tango.PPC.UI.Notifications return ShowMessageBox(new MessageBoxVM() { Message = message, - Icon = TouchIconKind.QuestionCircleSolid, + Icon = TouchIconKind.QuestionCircleRegular, Title = "Confirm", HasCancel = true, Brush = Application.Current.Resources["TangoMessageBoxQuestionBrush"] as Brush, @@ -218,6 +218,8 @@ namespace Tango.PPC.UI.Notifications /// private Task ShowMessageBox(MessageBoxVM vm) { + ReleaseGlobalBusyMessage(); + LogManager.Log($"Displaying MessagBox '{vm.Message}'."); TaskCompletionSource source = new TaskCompletionSource(); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoginView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoginView.xaml index 179d1dde3..dee4e9c7b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoginView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoginView.xaml @@ -27,13 +27,6 @@ Forgot password? - - - - - - - diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml index c63ef1e13..604c79aeb 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml @@ -28,7 +28,9 @@ ItemExpandedPropertyPath="IsExpanded" HasDialog="{Binding NotificationProvider.HasDialog}" CurrentDialog="{Binding NotificationProvider.CurrentDialog}" - NotificationBarVisibility="{Binding NotificationProvider.NotificationsVisible,Converter={StaticResource BooleanToVisibilityConverter}}"> + NotificationBarVisibility="{Binding NotificationProvider.NotificationsVisible,Converter={StaticResource BooleanToVisibilityConverter}}" + IsBusy="{Binding NotificationProvider.IsInGlobalBusyState}" + BusyMessage="{Binding NotificationProvider.GlobalBusyMessage}"> diff --git a/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs b/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs index 8816d9825..6738ad99c 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs @@ -211,11 +211,15 @@ namespace Tango.BL.Entities get { return _isOutOfGamut; } set { - _isOutOfGamut = value; RaisePropertyChangedAuto(); - - if (Segment != null) + if (_isOutOfGamut != value) { - Segment.RaiseHasOutOfGamutBrushStop(); + _isOutOfGamut = value; + RaisePropertyChangedAuto(); + + if (Segment != null) + { + Segment.RaiseHasOutOfGamutBrushStop(); + } } } } diff --git a/Software/Visual_Studio/Tango.BL/Entities/Segment.cs b/Software/Visual_Studio/Tango.BL/Entities/Segment.cs index 7e15b9ea5..a15cb32ab 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Segment.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Segment.cs @@ -139,6 +139,7 @@ namespace Tango.BL.Entities } [NotMapped] + [JsonIgnore] public bool HasOutOfGamutBrushStop { get { return BrushStops.Any(x => x.IsOutOfGamut); } diff --git a/Software/Visual_Studio/Tango.DragAndDrop/DragAndDropService.cs b/Software/Visual_Studio/Tango.DragAndDrop/DragAndDropService.cs index 1c84b8768..e814985e6 100644 --- a/Software/Visual_Studio/Tango.DragAndDrop/DragAndDropService.cs +++ b/Software/Visual_Studio/Tango.DragAndDrop/DragAndDropService.cs @@ -579,7 +579,7 @@ namespace Tango.DragAndDrop //element.AddHandler(FrameworkElement.PreviewMouseDownEvent, (MouseButtonEventHandler)Draggable_PreviewMouseDown, true); //element.AddHandler(FrameworkElement.MouseMoveEvent, (MouseEventHandler)Draggable_MouseMove, true); //element.AddHandler(FrameworkElement.PreviewMouseUpEvent, (MouseButtonEventHandler)Draggable_PreviewMouseUp, true); - element.Unloaded += Element_Unloaded; + element.Unloaded += Draggable_Unloaded; } } @@ -592,7 +592,7 @@ namespace Tango.DragAndDrop if (!_dropElements.Contains(element)) { _dropElements.Add(element); - element.Unloaded += Element_Unloaded1; + element.Unloaded += Droppable_Unloaded; } } @@ -601,12 +601,10 @@ namespace Tango.DragAndDrop /// /// The source of the event. /// The instance containing the event data. - private static void Element_Unloaded(object sender, RoutedEventArgs e) + private static void Draggable_Unloaded(object sender, RoutedEventArgs e) { FrameworkElement element = sender as FrameworkElement; UnRegisterDraggable(element); - element.PreviewMouseUp -= Draggable_PreviewMouseUp; - element.Unloaded -= Element_Unloaded; } /// @@ -614,11 +612,10 @@ namespace Tango.DragAndDrop /// /// The source of the event. /// The instance containing the event data. - private static void Element_Unloaded1(object sender, RoutedEventArgs e) + private static void Droppable_Unloaded(object sender, RoutedEventArgs e) { FrameworkElement element = sender as FrameworkElement; UnRegisterDroppable(element); - element.Unloaded -= Element_Unloaded1; } /// @@ -628,6 +625,8 @@ namespace Tango.DragAndDrop private static void UnRegisterDraggable(FrameworkElement element) { _dragElements.Remove(element); + element.PreviewMouseUp -= Draggable_PreviewMouseUp; + element.Unloaded -= Draggable_Unloaded; } /// @@ -637,6 +636,7 @@ namespace Tango.DragAndDrop private static void UnRegisterDroppable(FrameworkElement element) { _dropElements.Remove(element); + element.Unloaded -= Droppable_Unloaded; } /// diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/FastTextBlock.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/FastTextBlock.cs index 5b2808ab1..141fa6e27 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Controls/FastTextBlock.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Controls/FastTextBlock.cs @@ -9,6 +9,7 @@ using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; +using System.Windows.Markup; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; @@ -16,14 +17,24 @@ using System.Windows.Shapes; namespace Tango.SharedUI.Controls { - + [ContentProperty(nameof(Text))] public class FastTextBlock : Control { private FormattedText _formattedText; static FastTextBlock() { - + + } + + public FastTextBlock() + { + Loaded += FastTextBlock_Loaded; + } + + private void FastTextBlock_Loaded(object sender, RoutedEventArgs e) + { + Init(); } public static readonly DependencyProperty TextProperty = @@ -31,19 +42,24 @@ namespace Tango.SharedUI.Controls "Text", typeof(string), typeof(FastTextBlock), - new FrameworkPropertyMetadata(string.Empty, FrameworkPropertyMetadataOptions.AffectsMeasure, + new FrameworkPropertyMetadata(string.Empty, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender, (o, e) => ((FastTextBlock)o).TextPropertyChanged((string)e.NewValue))); private void TextPropertyChanged(string text) { - if (text != null) + Init(); + } + + private void Init() + { + if (Text != null) { var typeface = new Typeface( FontFamily, - FontStyles.Normal, FontWeights.Normal, FontStretches.Normal); + FontStyle, FontWeight, FontStretch); _formattedText = new FormattedText( - text, CultureInfo.CurrentCulture, + Text, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, typeface, FontSize, Foreground); } } diff --git a/Software/Visual_Studio/Tango.Touch/Components/SharedResourceDictionary.cs b/Software/Visual_Studio/Tango.Touch/Components/SharedResourceDictionary.cs new file mode 100644 index 000000000..efa1e77e4 --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Components/SharedResourceDictionary.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; + +namespace Tango.Touch.Components +{ + /// + /// The shared resource dictionary is a specialized resource dictionary + /// that loads it content only once. If a second instance with the same source + /// is created, it only merges the resources from the cache. + /// + public class SharedResourceDictionary : ResourceDictionary + { + /// + /// Internal cache of loaded dictionaries + /// + public static Dictionary _sharedDictionaries = + new Dictionary(); + + /// + /// Local member of the source uri + /// + private Uri _sourceUri; + + /// + /// Gets or sets the uniform resource identifier (URI) to load resources from. + /// + public new Uri Source + { + get { return _sourceUri; } + set + { + _sourceUri = value; + + if (!_sharedDictionaries.ContainsKey(value)) + { + // If the dictionary is not yet loaded, load it by setting + // the source of the base class + base.Source = value; + + // add it to the cache + _sharedDictionaries.Add(value, this); + } + else + { + // If the dictionary is already loaded, get it from the cache + MergedDictionaries.Add(_sharedDictionaries[value]); + } + } + } + } +} diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.cs index a684cbf5a..4e1ced33b 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.cs @@ -203,6 +203,10 @@ namespace Tango.Touch.Controls _textBox.CaretIndex = _textBox.Text.Length; } } + else if (_textBox != null) + { + _textBox.Text = null; + } if (_popup != null) { diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchLoadingPanel.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchLoadingPanel.xaml index 4a4cdbba2..9a2a51017 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchLoadingPanel.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchLoadingPanel.xaml @@ -17,7 +17,7 @@ - + - - - + + diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs index 6c29e4652..bb715abba 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs @@ -256,7 +256,21 @@ namespace Tango.Touch.Controls public static readonly DependencyProperty NotificationBarVisibilityProperty = DependencyProperty.Register("NotificationBarVisibility", typeof(Visibility), typeof(TouchPanel), new PropertyMetadata(Visibility.Visible)); + public bool IsBusy + { + get { return (bool)GetValue(IsBusyProperty); } + set { SetValue(IsBusyProperty, value); } + } + public static readonly DependencyProperty IsBusyProperty = + DependencyProperty.Register("IsBusy", typeof(bool), typeof(TouchPanel), new PropertyMetadata(false)); + public String BusyMessage + { + get { return (String)GetValue(BusyMessageProperty); } + set { SetValue(BusyMessageProperty, value); } + } + public static readonly DependencyProperty BusyMessageProperty = + DependencyProperty.Register("BusyMessage", typeof(String), typeof(TouchPanel), new PropertyMetadata(null)); #region Attached Properties diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml index e80bd7daa..e7f822bb5 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml @@ -73,9 +73,9 @@ - - - + + + @@ -135,18 +135,18 @@ @@ -173,24 +173,24 @@ - + - + + - - - - - - - - - - + + + + + + + + + + - - + + CANCEL + OK + - + - + + + + + - + + + + + - - CANCEL - OK - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml index c00bd40b9..e6acda366 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml @@ -8,7 +8,7 @@ xmlns:local="clr-namespace:Tango.Touch.Controls"> - + diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentControl.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentControl.cs index 8e3db84fa..02240ecc8 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentControl.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentControl.cs @@ -72,28 +72,28 @@ namespace Tango.Touch.Controls private void ApplyOptimization() { - var _border_viewport = _scrollViewer.GetViewportBorder(); + //var _border_viewport = _scrollViewer.GetViewportBorder(); - if (_border_viewport.IsAncestorOf(this)) - { - //Point relativeLocation = this.TranslatePoint(new Point(0, 0), _border_viewport); - //Rect bounds = this.TransformToAncestor(_border_viewport).TransformBounds(new Rect(0.0, 0.0, this.ActualWidth, this.ActualHeight)); - //Rect rect = new Rect(0.0, 0.0, _border_viewport.ActualWidth, _border_viewport.ActualHeight); - if (_location.Y > _scrollViewer.GetScrollPosition() && _location.Y < _scrollViewer.GetScrollPosition() + _border_viewport.ActualHeight) - { - if (_innerBorder.Visibility == Visibility.Hidden) - { - _innerBorder.Visibility = Visibility.Visible; - } - } - else - { - if (_innerBorder.Visibility == Visibility.Visible) - { - _innerBorder.Visibility = Visibility.Hidden; - } - } - } + //if (_border_viewport.IsAncestorOf(this)) + //{ + // //Point relativeLocation = this.TranslatePoint(new Point(0, 0), _border_viewport); + // //Rect bounds = this.TransformToAncestor(_border_viewport).TransformBounds(new Rect(0.0, 0.0, this.ActualWidth, this.ActualHeight)); + // //Rect rect = new Rect(0.0, 0.0, _border_viewport.ActualWidth, _border_viewport.ActualHeight); + // if (_location.Y > _scrollViewer.GetScrollPosition() && _location.Y < _scrollViewer.GetScrollPosition() + _border_viewport.ActualHeight) + // { + // if (_innerBorder.Visibility == Visibility.Hidden) + // { + // _innerBorder.Visibility = Visibility.Visible; + // } + // } + // else + // { + // if (_innerBorder.Visibility == Visibility.Visible) + // { + // _innerBorder.Visibility = Visibility.Hidden; + // } + // } + //} } } } diff --git a/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml b/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml index 1a77b76be..c8a6d0e8d 100644 --- a/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml +++ b/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml @@ -52,7 +52,7 @@ #757373 #C3F2F5FA - #DDE7FD + #DDE7FD #4E5470 @@ -117,7 +117,7 @@ #121212 #F1F1F1 - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Resources/Fonts.xaml b/Software/Visual_Studio/Tango.Touch/Resources/Fonts.xaml index 387977e0a..a4732966e 100644 --- a/Software/Visual_Studio/Tango.Touch/Resources/Fonts.xaml +++ b/Software/Visual_Studio/Tango.Touch/Resources/Fonts.xaml @@ -13,8 +13,8 @@ 20 20 - 30 - 20 + 24 + 22 22 23 diff --git a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj index 3177f206d..7600d4c14 100644 --- a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj +++ b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj @@ -59,6 +59,7 @@ GlobalVersionInfo.cs + -- cgit v1.3.1