From c9d3c1a7408f6f7a4814c1a8f5cf58a2d13e1694 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 3 Jul 2018 12:03:55 +0300 Subject: Machine Studio. Implemented upload hardware configuration from connected machine view. Implemented process parameters dragging through developer module settings :/ --- .../Console/ConsoleWindowVM.cs | 17 ++++++++------ .../ViewModels/ConnectedMachineViewVM.cs | 19 +++++++++++++++ .../ViewModels/MainViewVM.cs | 27 ++++++++++++++++++++-- .../Views/ConnectedMachineView.xaml | 12 ++++++++-- 4 files changed, 64 insertions(+), 11 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs index 10b05bc64..777c488d7 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindowVM.cs @@ -24,6 +24,7 @@ namespace Tango.MachineStudio.UI.Console private INotificationProvider _notificatrion; private TextBox _txtLog; private String _currentFile; + private ScriptEngine _engine; /// @@ -160,22 +161,24 @@ namespace Tango.MachineStudio.UI.Console private void Stop() { - + if (_engine != null) + { + _engine.Stop(); + } } private async void Run() { - ScriptEngine engine = new ScriptEngine(new ConsoleOnExecuteParameters(new ConsoleManager(WriteLine))); - engine.Stop(); - engine.ReferencedAssemblies.Add(this.GetType()); - engine.ReferencedAssemblies.Add(typeof(INotificationProvider)); + _engine = new ScriptEngine(new ConsoleOnExecuteParameters(new ConsoleManager(WriteLine))); + _engine.ReferencedAssemblies.Add(this.GetType()); + _engine.ReferencedAssemblies.Add(typeof(INotificationProvider)); foreach (var module in _moduleLoader.AllModules) { - engine.ReferencedAssemblies.Add(module.GetType()); + _engine.ReferencedAssemblies.Add(module.GetType()); } - await engine.Run(Code, null); + await _engine.Run(Code, null); } private void WriteLine(String text) diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs index 9f84cfb53..76e138e0e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs @@ -13,6 +13,13 @@ namespace Tango.MachineStudio.UI.ViewModels { public class ConnectedMachineViewVM : DialogViewVM { + public enum ConnectedMachineVMResult + { + Cancel, + Disconnect, + UploadHardwareConfig, + } + private IStudioApplicationManager _applicationManager; public IStudioApplicationManager ApplicationManager { @@ -20,16 +27,28 @@ namespace Tango.MachineStudio.UI.ViewModels set { _applicationManager = value; RaisePropertyChangedAuto(); } } + public ConnectedMachineVMResult Result { get; set; } + public RelayCommand DisconnectCommand { get; set; } + public RelayCommand UploadHardwareConfigurationCommand { get; set; } + public ConnectedMachineViewVM(IStudioApplicationManager application) { ApplicationManager = application; DisconnectCommand = new RelayCommand(Disconnect); + UploadHardwareConfigurationCommand = new RelayCommand(UploadHardwareConfiguration); + } + + private void UploadHardwareConfiguration() + { + Result = ConnectedMachineVMResult.UploadHardwareConfig; + Accept(); } private void Disconnect() { + Result = ConnectedMachineVMResult.Disconnect; Accept(); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index aa0eedefb..45ae68cc5 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -502,9 +502,32 @@ namespace Tango.MachineStudio.UI.ViewModels } else { - _notificationProvider.ShowModalDialog((x) => + _notificationProvider.ShowModalDialog(async (x) => { - DisconnectFromMachine(); + if (x.Result == ConnectedMachineViewVM.ConnectedMachineVMResult.Disconnect) + { + DisconnectFromMachine(); + } + else if (x.Result == ConnectedMachineViewVM.ConnectedMachineVMResult.UploadHardwareConfig) + { + if (NotificationProvider.ShowQuestion("This will reset the machine hardware configuration to the database configuration. Are you sure?")) + { + using (NotificationProvider.PushTaskItem("Uploading hardware configuration...")) + { + try + { + var configuration = ApplicationManager.ConnectedMachine.Machine.Configuration; + await ApplicationManager.ConnectedMachine.UploadHardwareConfiguration(configuration.HardwareVersion, configuration); + NotificationProvider.ShowInfo("Hardware configuration uploaded successfully."); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error upload hardware configuration."); + NotificationProvider.ShowError("Error upload hardware configuration." + Environment.NewLine + ex.Message); + } + } + } + } }); } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml index 45f1c9b26..a4f253de3 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml @@ -40,7 +40,7 @@ - + @@ -116,7 +116,15 @@ - + + + + -- cgit v1.3.1 From 0b804fd5df94b66c6be119660581ab3978d31d59 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 4 Jul 2018 11:58:10 +0300 Subject: Fixed issue with machine studio update service version sorting. Added about dialog to machine studio with version information. Fixed issue with Stubs UI installer. Stubs UI v3.1 Machine Studio v1.0.0.10 --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1572864 -> 1572864 bytes .../StudioApplication/IStudioApplicationManager.cs | 15 + .../Properties/Resources.Designer.cs | 9 + .../Properties/Resources.resx | 17 +- .../Tango.MachineStudio.UI/Resources/BuildDate.txt | 1 + .../DefaultStudioApplicationManager.cs | 37 +- .../Tango.MachineStudio.UI.csproj | 35 +- .../Tango.MachineStudio.UI/ViewModelLocator.cs | 9 + .../ViewModels/AboutViewVM.cs | 20 + .../ViewModels/MainViewVM.cs | 15 + .../Tango.MachineStudio.UI/Views/AboutView.xaml | 63 +++ .../Tango.MachineStudio.UI/Views/AboutView.xaml.cs | 28 ++ .../Tango.MachineStudio.UI/Views/MainView.xaml | 7 + .../MachineStudioUpdateService.svc.cs | 6 +- .../Tango.SharedUI/Controls/TableGrid.cs | 28 +- Software/Visual_Studio/Tango.sln | 3 + .../Tango.Stubs.Installer.vdproj | 467 +++++++++++++++++++-- .../Tango.Stubs.UI/Properties/AssemblyInfo.cs | 4 +- .../Visual_Studio/Versioning/CoreChangeLog.txt | 2 + Software/Visual_Studio/Versioning/MachineStudio.cs | 4 +- .../Versioning/MachineStudioChangeLog.txt | 7 + Software/Visual_Studio/Versioning/PPCChangeLog.txt | 13 + 23 files changed, 725 insertions(+), 65 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/AboutViewVM.cs create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml.cs create mode 100644 Software/Visual_Studio/Versioning/CoreChangeLog.txt create mode 100644 Software/Visual_Studio/Versioning/MachineStudioChangeLog.txt create mode 100644 Software/Visual_Studio/Versioning/PPCChangeLog.txt (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index ecc1c16c7..7bea6e586 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 a7a61b46c..86e0318fa 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs index c5010cb26..00e67ff3b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs @@ -56,6 +56,21 @@ namespace Tango.MachineStudio.Common.StudioApplication /// String Version { get; } + /// + /// Gets the core libraries version. + /// + String CoreVersion { get; } + + /// + /// Gets the build date. + /// + String BuildDate { get; } + + /// + /// Gets the change log. + /// + String ChangeLog { get; } + /// /// Notify the application manager about an external opened window. /// When application exists. All registered windows will be closed. diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Resources.Designer.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Resources.Designer.cs index c035ee88d..5ff36aae1 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Resources.Designer.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Resources.Designer.cs @@ -59,5 +59,14 @@ namespace Tango.MachineStudio.UI.Properties { resourceCulture = value; } } + + /// + /// Looks up a localized string similar to . + /// + internal static string BuildDate { + get { + return ResourceManager.GetString("BuildDate", resourceCulture); + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Resources.resx b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Resources.resx index af7dbebba..32307e87f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Resources.resx +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Resources.resx @@ -46,7 +46,7 @@ mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with - : System.Serialization.Formatters.Binary.BinaryFormatter + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 @@ -60,6 +60,7 @@ : and then encoded with base64 encoding. --> + @@ -68,9 +69,10 @@ - + + @@ -85,9 +87,10 @@ - + + @@ -109,9 +112,13 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\BuildDate.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt new file mode 100644 index 000000000..c28e95490 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt @@ -0,0 +1 @@ +Wed 07/04/2018 11:49:44.08 diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index 48b0fdada..fdad31251 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -43,14 +43,14 @@ namespace Tango.MachineStudio.UI.StudioApplication _navigationManager = navigationManager; _openedWindows = new List(); - Task.Factory.StartNew(() => + Task.Factory.StartNew(() => { while (MainWindow.Instance == null) { Thread.Sleep(100); } - InvokeUI(() => + InvokeUI(() => { MainWindow.Instance.ContentRendered += (_, __) => { @@ -256,5 +256,38 @@ namespace Tango.MachineStudio.UI.StudioApplication window.Closed += (x, y) => { _openedWindows.Remove(window); }; } + + /// + /// Gets the core libraries version. + /// + public string CoreVersion + { + get + { + return typeof(ExtendedObject).Assembly.GetName().Version.ToString(); + } + } + + /// + /// Gets the build date. + /// + public string BuildDate + { + get + { + return Properties.Resources.BuildDate; + } + } + + /// + /// Gets the change log. + /// + public string ChangeLog + { + get + { + return EmbeddedResourceHelper.GetEmbeddedResourceText("Tango.MachineStudio.UI.ChangeLogs.MachineStudioChangeLog.txt") + Environment.NewLine + Environment.NewLine + Environment.NewLine + EmbeddedResourceHelper.GetEmbeddedResourceText("Tango.MachineStudio.UI.ChangeLogs.CoreChangeLog.txt"); + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index f21fe0919..4d581795b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -151,6 +151,11 @@ TextInputBoxWindow.xaml + + True + True + Resources.resx + @@ -163,6 +168,7 @@ + @@ -176,6 +182,9 @@ + + AboutView.xaml + ConnectedMachineView.xaml @@ -251,6 +260,10 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -313,20 +326,11 @@ - - True - True - Resources.resx - True Settings.settings True - - ResXFileCodeGenerator - Resources.Designer.cs - SettingsSingleFileGenerator @@ -484,9 +488,20 @@ + + ChangeLogs\CoreChangeLog.txt + + + ChangeLogs\MachineStudioChangeLog.txt + + + + ResXFileCodeGenerator + Resources.Designer.cs + @@ -494,6 +509,8 @@ if $(ConfigurationName) == Debug $(TargetDir)linkgen.exe -s "$(TargetPath)" -d "$(TargetDir)Utilities\Machine Studio.lnk" +echo %25date%25 %25time%25 > "$(ProjectDir)\Resources\BuildDate.txt" + RD /S /Q "$(TargetDir)cs\" RD /S /Q "$(TargetDir)da\" RD /S /Q "$(TargetDir)de\" diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs index 931130a05..8a5ce3d8b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs @@ -87,6 +87,7 @@ namespace Tango.MachineStudio.UI TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); + TangoIOC.Default.Register(); //Register View (Supervising Controller Pattern). //if (!ViewModelBase.IsInDesignModeStatic) @@ -167,5 +168,13 @@ namespace Tango.MachineStudio.UI return TangoIOC.Default.GetInstance(); } } + + public AboutViewVM AboutViewVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } } } \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/AboutViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/AboutViewVM.cs new file mode 100644 index 000000000..5fe3b06b8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/AboutViewVM.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.MachineStudio.Common.StudioApplication; +using Tango.SharedUI; + +namespace Tango.MachineStudio.UI.ViewModels +{ + public class AboutViewVM : DialogViewVM + { + public IStudioApplicationManager ApplicationManager { get; set; } + + public AboutViewVM(IStudioApplicationManager applicationManager) + { + ApplicationManager = applicationManager; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index 45ae68cc5..8eaa1f360 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -159,6 +159,11 @@ namespace Tango.MachineStudio.UI.ViewModels /// public RelayCommand OpenDeveloperConsoleCommand { get; set; } + /// + /// Gets or sets the about command. + /// + public RelayCommand AboutCommand { get; set; } + private IAuthenticationProvider _authenticationProvider; /// /// Gets or sets the authentication provider. @@ -319,6 +324,8 @@ namespace Tango.MachineStudio.UI.ViewModels OpenDeveloperConsoleCommand = new RelayCommand(OpenDeveloperConsole); TangoMessenger.Default.Register((x) => DisableCheckForUpdates = true); + + AboutCommand = new RelayCommand(ShowAboutDialog); } private void MachineEventsStateProvider_EventsResolved(object sender, IEnumerable e) @@ -683,6 +690,14 @@ namespace Tango.MachineStudio.UI.ViewModels } } + /// + /// Shows the about dialog. + /// + private void ShowAboutDialog() + { + NotificationProvider.ShowModalDialog((x) => { }); + } + private void ReportIssue() { _notificationProvider.ShowModalDialog(new ReportIssueViewVM(TFSClient.Project, TFSClient.CreateBug()), async (vm) => diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml new file mode 100644 index 000000000..2ac0df9de --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + This dialog contains information about your current version of Machine Studio. + + + + + + Machine Studio: + v + Core Libraries: + v + Build Date: + + + + + Change Log: + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml.cs new file mode 100644 index 000000000..79a7f3e2c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.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.MachineStudio.UI.Views +{ + /// + /// Interaction logic for AboutView.xaml + /// + public partial class AboutView : UserControl + { + public AboutView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml index 8417c70c8..e36a03ffe 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -202,6 +202,13 @@ + + - - - - - - - - - Forward Data - - - - - - - - - - - - + + COLOR ADJUSTMENT DATA + + + + + + CCT Data + + + + + - - + + @@ -218,11 +190,41 @@ - + + + + + + + + + , + + + + + - + @@ -286,7 +288,7 @@ COMPOSITE - + @@ -298,10 +300,10 @@ - + - + @@ -309,10 +311,10 @@ - + - + @@ -320,10 +322,10 @@ - + - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml.cs index d78750050..37dd61b18 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml.cs @@ -33,7 +33,6 @@ namespace Tango.MachineStudio.ColorLab.Views private void MainView_Loaded(object sender, RoutedEventArgs e) { _vm = DataContext as MainViewVM; - _vm.PutComboHiveControl(hiveCombo); } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt index 913df0fd0..5ae51fc02 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt @@ -1 +1 @@ -Wed 07/04/2018 12:08:14.82 +Thu 07/05/2018 16:44:59.08 diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.cpp b/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.cpp index 29368b743..d398453f8 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.cpp +++ b/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.cpp @@ -1034,9 +1034,10 @@ size_t Tango::ColorLib::ColorConverter::Convert(uint8_t * input_buffer, size_t i conversionInput = conversion_input__unpack(NULL, input_buffer_size, input_buffer); - //Filter and arrange colors (Should change from 3 to 4 if black ink is included) int expected_liquids = 3; + int original_input_liquids_count = conversionInput->inputcoordinates->n_inputliquids; + InputLiquid** original_input_liquids = conversionInput->inputcoordinates->inputliquids; InputLiquid** filteredInputLiquids = (InputLiquid**)malloc(sizeof(InputLiquid*) * expected_liquids); @@ -1046,15 +1047,15 @@ size_t Tango::ColorLib::ColorConverter::Convert(uint8_t * input_buffer, size_t i switch (liquid->liquidtype) { - case LIQUID_TYPE__Cyan: - filteredInputLiquids[0] = liquid; - break; - case LIQUID_TYPE__Magenta: - filteredInputLiquids[1] = liquid; - break; - case LIQUID_TYPE__Yellow: - filteredInputLiquids[2] = liquid; - break; + case LIQUID_TYPE__Cyan: + filteredInputLiquids[0] = liquid; + break; + case LIQUID_TYPE__Magenta: + filteredInputLiquids[1] = liquid; + break; + case LIQUID_TYPE__Yellow: + filteredInputLiquids[2] = liquid; + break; } } @@ -1068,6 +1069,8 @@ size_t Tango::ColorLib::ColorConverter::Convert(uint8_t * input_buffer, size_t i ConversionOutput *conversionOutput = (ConversionOutput*)malloc(sizeof(ConversionOutput)); conversion_output__init(conversionOutput); // ConversionOutput conversionOutput = CONVERSION_OUTPUT__INIT; + + size_t n_elements = 0; bool InGamut = false; m_WP.Set(0.9505, 1.00, 1.0888); //D65 @@ -1212,6 +1215,17 @@ size_t Tango::ColorLib::ColorConverter::Convert(uint8_t * input_buffer, size_t i output_buffer = (uint8_t*)malloc(conversion_output__get_packed_size(conversionOutput)); int size = conversion_output__pack(conversionOutput, output_buffer); +#pragma region Free Conversion Input & Output + + conversionInput->inputcoordinates->inputliquids = original_input_liquids; + conversionInput->inputcoordinates->n_inputliquids = original_input_liquids_count; + + conversion_input__free_unpacked(conversionInput, NULL); + + conversion_output__free_unpacked(conversionOutput, NULL); + +#pragma endregion + return (size); } diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj b/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj index 6aacdb863..506745a12 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj +++ b/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj @@ -74,6 +74,7 @@ true $(SolutionDir)Build\Debug\ $(ProjectDir);$(IncludePath) + false true diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml index f707397a4..69fb329a7 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml @@ -4,7 +4,6 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Tango.PPC.Jobs.Dialogs" - xmlns:models="clr-namespace:Tango.PPC.Jobs.Models" xmlns:hive="clr-namespace:Tango.Hive;assembly=Tango.Hive" xmlns:pmr="clr-namespace:Tango.PMR.ColorLab;assembly=Tango.PMR" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionViewVM.cs index fe510622c..3c05fc429 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionViewVM.cs @@ -3,8 +3,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.ColorConversion; using Tango.PMR.ColorLab; -using Tango.PPC.Jobs.Models; using Tango.SharedUI; namespace Tango.PPC.Jobs.Dialogs diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionView.xaml index 32759d292..9583d0738 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionView.xaml @@ -4,7 +4,6 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Tango.PPC.Jobs.Dialogs" - xmlns:models="clr-namespace:Tango.PPC.Jobs.Models" xmlns:pmr="clr-namespace:Tango.PMR.ColorLab;assembly=Tango.PMR" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" mc:Ignorable="d" @@ -45,7 +44,7 @@ - + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionViewVM.cs index 0012ac71d..a90851797 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionViewVM.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.ColorConversion; using Tango.BL.Entities; using Tango.Core.Commands; -using Tango.PPC.Jobs.Models; using Tango.SharedUI; namespace Tango.PPC.Jobs.Dialogs @@ -14,7 +14,7 @@ namespace Tango.PPC.Jobs.Dialogs { private bool _moreOptions; - public enum BasicColorCorrectionResult + public enum ColorCorrectionDialogResult { None, Confirmed, @@ -23,7 +23,7 @@ namespace Tango.PPC.Jobs.Dialogs public BrushStop InvalidBrushStop { get; set; } - public BasicColorCorrectionResult Result { get; private set; } + public ColorCorrectionDialogResult Result { get; private set; } public List Suggestions { get; set; } @@ -77,13 +77,13 @@ namespace Tango.PPC.Jobs.Dialogs protected override void Accept() { - Result = _moreOptions ? BasicColorCorrectionResult.MoreOptions : BasicColorCorrectionResult.Confirmed; + Result = _moreOptions ? ColorCorrectionDialogResult.MoreOptions : ColorCorrectionDialogResult.Confirmed; base.Accept(); } protected override void Cancel() { - Result = BasicColorCorrectionResult.None; + Result = ColorCorrectionDialogResult.None; base.Cancel(); } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Models/ColorConversionSuggestion.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Models/ColorConversionSuggestion.cs deleted file mode 100644 index 8d88070d7..000000000 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Models/ColorConversionSuggestion.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Media; -using Tango.Core; -using Tango.PMR.ColorLab; - -namespace Tango.PPC.Jobs.Models -{ - public class ColorConversionSuggestion : ExtendedObject - { - public Color Color - { - get - { - return Color.FromRgb((byte)Coordinates.Red, (byte)Coordinates.Green, (byte)Coordinates.Blue); - } - } - - public SolidColorBrush Brush - { - get { return new SolidColorBrush(Color); } - } - - private OutputCoordinates _coordinates; - public OutputCoordinates Coordinates - { - get { return _coordinates; } - set { _coordinates = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(Color)); RaisePropertyChanged(nameof(Brush)); } - } - - public int Column { get; set; } - - public int Row { get; set; } - - public bool DisplayIndices { get; set; } - - public ColorConversionSuggestion() - { - DisplayIndices = false; - } - } -} 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 935fdb77d..15087be43 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 @@ -138,7 +138,6 @@ - Code 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 1c4fec382..50ea04272 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 @@ -18,6 +18,9 @@ using System.Windows.Data; using Tango.PPC.Jobs.Dialogs; using Tango.PPC.Jobs.Views; using Tango.BL.Catalogs; +using System.Runtime.InteropServices; +using System.Threading; +using Tango.BL.ColorConversion; namespace Tango.PPC.Jobs.ViewModels { @@ -29,6 +32,7 @@ namespace Tango.PPC.Jobs.ViewModels { private ObservablesContext _db; private bool _can_navigate_back; + private Thread _check_gamut_thread; #region Properties @@ -198,6 +202,27 @@ namespace Tango.PPC.Jobs.ViewModels SaveJobCommand = new RelayCommand(SaveJob); ReplaceBrushStopCommand = new RelayCommand(InvokeColorAdjustmentForBrushStop); TwineCatalogFieldTapCommand = new RelayCommand(InvokeTwineCatalogForBrushStop); + + _check_gamut_thread = new Thread(CheckGamutThreadMethod); + _check_gamut_thread.IsBackground = true; + } + + private void CheckGamutThreadMethod() + { + while (true) + { + Thread.Sleep(1000); + + if (Job != null && IsVisible) + { + var brushStops = Job.Segments.SelectMany(x => x.BrushStops).ToList(); + + foreach (var stop in brushStops) + { + //stop.IsOutOfGamut = TangoColorConverter.IsOutOfGamut(stop); + } + } + } } #endregion @@ -321,27 +346,25 @@ namespace Tango.PPC.Jobs.ViewModels /// The brush stop. private async void InvokeColorAdjustmentForBrushStop(BrushStop brushStop) { - var basicVM = await NotificationProvider.ShowDialog(new BasicColorCorrectionViewVM() + var conversionOutput = TangoColorConverter.GetSuggestions(brushStop); + + BasicColorCorrectionViewVM vm = null; + + vm = await NotificationProvider.ShowDialog(new BasicColorCorrectionViewVM() { InvalidBrushStop = brushStop, + Suggestions = TangoColorConverter.CreateTrippletSuggestions(conversionOutput), }); - if (basicVM.Result == BasicColorCorrectionViewVM.BasicColorCorrectionResult.Confirmed) - { - brushStop.Color = basicVM.SelectedSuggestion.Color; - } - else if (basicVM.Result == BasicColorCorrectionViewVM.BasicColorCorrectionResult.MoreOptions) + if (vm.Result == BasicColorCorrectionViewVM.ColorCorrectionDialogResult.MoreOptions) { - var advancedVM = await NotificationProvider.ShowDialog(new AdvancedColorCorrectionViewVM() + vm = await NotificationProvider.ShowDialog(new AdvancedColorCorrectionViewVM() { InvalidBrushStop = brushStop, + Suggestions = TangoColorConverter.CreateHiveSuggestions(conversionOutput), }); - if (advancedVM.Result == BasicColorCorrectionViewVM.BasicColorCorrectionResult.Confirmed) - { - brushStop.Color = advancedVM.SelectedSuggestion.Color; - } - else if (advancedVM.Result == BasicColorCorrectionViewVM.BasicColorCorrectionResult.MoreOptions) + if (vm.Result == BasicColorCorrectionViewVM.ColorCorrectionDialogResult.MoreOptions) { _can_navigate_back = true; var catalogItem = await NavigationManager.NavigateForResult(brushStop); @@ -353,6 +376,11 @@ namespace Tango.PPC.Jobs.ViewModels } } } + + if (vm.Result == BasicColorCorrectionViewVM.ColorCorrectionDialogResult.Confirmed) + { + brushStop.Color = vm.SelectedSuggestion.Color; + } } private async void InvokeTwineCatalogForBrushStop(BrushStop brushStop) @@ -392,6 +420,11 @@ namespace Tango.PPC.Jobs.ViewModels SegmentsCollectionView = CollectionViewSource.GetDefaultView(Job.Segments); SegmentsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Segment.SegmentIndex), ListSortDirection.Ascending)); + + if (!_check_gamut_thread.IsAlive) + { + _check_gamut_thread.Start(); + } } #endregion diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/MainView.xaml index 6de05b01b..45dc535bb 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/MainView.xaml @@ -11,7 +11,7 @@ mc:Ignorable="d" d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> - + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs index e26abfc09..fae905b13 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs @@ -71,14 +71,14 @@ namespace Tango.PPC.Common private set { _settings = value; } } - private bool _visible; + private bool _isVisible; /// /// Gets or sets a value indicating whether this view is visible. /// - public bool Visible + public bool IsVisible { - get { return _visible; } - private set { _visible = value; RaisePropertyChangedAuto(); } + get { return _isVisible; } + private set { _isVisible = value; RaisePropertyChangedAuto(); } } /// @@ -99,7 +99,7 @@ namespace Tango.PPC.Common /// public virtual void OnNavigatedTo() { - Visible = true; + IsVisible = true; } /// @@ -107,7 +107,7 @@ namespace Tango.PPC.Common /// public virtual void OnNavigatedFrom() { - Visible = false; + IsVisible = false; } /// 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 dc1cc6d4b..d2763510a 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 @@ -308,6 +308,10 @@ DB\Tango.mdf PreserveNewest + + Tango.ColorLib.dll + PreserveNewest + 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 8df1bf959..dcb19dbee 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml @@ -34,7 +34,7 @@ - + diff --git a/Software/Visual_Studio/Tango.BL/ColorConversion/ColorConversionSuggestion.cs b/Software/Visual_Studio/Tango.BL/ColorConversion/ColorConversionSuggestion.cs new file mode 100644 index 000000000..f6704aa00 --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/ColorConversion/ColorConversionSuggestion.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using Tango.Core; +using Tango.PMR.ColorLab; + +namespace Tango.BL.ColorConversion +{ + public class ColorConversionSuggestion : ExtendedObject + { + public Color Color + { + get + { + return Color.FromRgb((byte)Coordinates.Red, (byte)Coordinates.Green, (byte)Coordinates.Blue); + } + } + + public SolidColorBrush Brush + { + get { return new SolidColorBrush(Color); } + } + + private OutputCoordinates _coordinates; + public OutputCoordinates Coordinates + { + get { return _coordinates; } + set { _coordinates = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(Color)); RaisePropertyChanged(nameof(Brush)); } + } + + public int Column { get; set; } + + public int Row { get; set; } + + public bool DisplayIndices { get; set; } + + public ColorConversionSuggestion() + { + DisplayIndices = false; + } + + public ColorConversionSuggestion(OutputCoordinates coordinates, int row, int column) + { + Coordinates = coordinates; + Row = row; + Column = column; + } + } +} diff --git a/Software/Visual_Studio/Tango.BL/ColorConversion/TangoColorConverter.cs b/Software/Visual_Studio/Tango.BL/ColorConversion/TangoColorConverter.cs new file mode 100644 index 000000000..d80accb6a --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/ColorConversion/TangoColorConverter.cs @@ -0,0 +1,129 @@ +using Google.Protobuf; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.PMR; +using Tango.PMR.ColorLab; + +namespace Tango.BL.ColorConversion +{ + public static class TangoColorConverter + { + [DllImport("Tango.ColorLib.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "Convert")] + private static extern int Convert(IntPtr data, int size, ref IntPtr output); + + public static ConversionOutput GetSuggestions(BrushStop brushStop) + { + ConversionInput conversionInput = CreateConversionInput(brushStop); + + NativePMR nativePMR = new NativePMR(Convert); + ConversionOutput output = nativePMR.Invoke(conversionInput); + return output; + } + + public static ConversionOutput GetSuggestions(ConversionInput conversionInput) + { + NativePMR nativePMR = new NativePMR(Convert); + ConversionOutput output = nativePMR.Invoke(conversionInput); + return output; + } + + public static List CreateHiveSuggestions(ConversionOutput conversionOutput) + { + List suggestions = new List(); + + suggestions.Add(new ColorConversionSuggestion(conversionOutput.HiveCoordinates[1], 0, 1)); + suggestions.Add(new ColorConversionSuggestion(conversionOutput.HiveCoordinates[2], 0, 2)); + suggestions.Add(new ColorConversionSuggestion(conversionOutput.HiveCoordinates[3], 0, 3)); + + suggestions.Add(new ColorConversionSuggestion(conversionOutput.HiveCoordinates[5], 1, 0)); + suggestions.Add(new ColorConversionSuggestion(conversionOutput.HiveCoordinates[6], 1, 1)); + suggestions.Add(new ColorConversionSuggestion(conversionOutput.HiveCoordinates[7], 1, 2)); + suggestions.Add(new ColorConversionSuggestion(conversionOutput.HiveCoordinates[8], 1, 3)); + suggestions.Add(new ColorConversionSuggestion(conversionOutput.HiveCoordinates[9], 1, 4)); + + suggestions.Add(new ColorConversionSuggestion(conversionOutput.HiveCoordinates[10], 2, 0)); + suggestions.Add(new ColorConversionSuggestion(conversionOutput.HiveCoordinates[11], 2, 1)); + suggestions.Add(new ColorConversionSuggestion(conversionOutput.HiveCoordinates[12], 2, 2)); + suggestions.Add(new ColorConversionSuggestion(conversionOutput.HiveCoordinates[13], 2, 3)); + suggestions.Add(new ColorConversionSuggestion(conversionOutput.HiveCoordinates[14], 2, 4)); + + suggestions.Add(new ColorConversionSuggestion(conversionOutput.HiveCoordinates[15], 3, 0)); + suggestions.Add(new ColorConversionSuggestion(conversionOutput.HiveCoordinates[16], 3, 1)); + suggestions.Add(new ColorConversionSuggestion(conversionOutput.HiveCoordinates[17], 3, 2)); + suggestions.Add(new ColorConversionSuggestion(conversionOutput.HiveCoordinates[18], 3, 3)); + suggestions.Add(new ColorConversionSuggestion(conversionOutput.HiveCoordinates[19], 3, 4)); + + suggestions.Add(new ColorConversionSuggestion(conversionOutput.HiveCoordinates[22], 4, 2)); + + return suggestions; + } + + public static List CreateTrippletSuggestions(ConversionOutput conversionOutput) + { + List suggestions = new List(); + + suggestions.Add(new ColorConversionSuggestion(conversionOutput.TripleCoordinates[0], 0, 0)); + suggestions.Add(new ColorConversionSuggestion(conversionOutput.TripleCoordinates[1], 0, 0)); + suggestions.Add(new ColorConversionSuggestion(conversionOutput.TripleCoordinates[2], 0, 0)); + + return suggestions; + } + + public static bool IsOutOfGamut(BrushStop brushStop) + { + return GetSuggestions(brushStop).OutOfGamut; + } + + private static ConversionInput CreateConversionInput(BrushStop brushStop) + { + ConversionInput conversionInput = new ConversionInput(); + + conversionInput.ColorSpace = (PMR.ColorLab.ColorSpace)brushStop.ColorSpace.Code; + conversionInput.InputCoordinates = new InputCoordinates(); + + conversionInput.SegmentLength = 10; //TODO: for gradient ? + + conversionInput.InputCoordinates.Red = Math.Max(brushStop.Red, 1); + conversionInput.InputCoordinates.Green = Math.Max(brushStop.Green, 1); + conversionInput.InputCoordinates.Blue = Math.Max(brushStop.Blue, 1); + + //conversionInput.InputCoordinates.Red = 50; + //conversionInput.InputCoordinates.Green = 100; + //conversionInput.InputCoordinates.Blue = 200; + + conversionInput.InputCoordinates.L = brushStop.L; + conversionInput.InputCoordinates.A = brushStop.A; + conversionInput.InputCoordinates.B = brushStop.B; + + conversionInput.InputCoordinates.Cyan = brushStop.Cyan; + conversionInput.InputCoordinates.Magenta = brushStop.Magenta; + conversionInput.InputCoordinates.Yellow = brushStop.Yellow; + conversionInput.InputCoordinates.Key = brushStop.Black; + + conversionInput.ThreadL = 92.1815;//brushStop.Segment.Job.Rml.MediaColor.L; + conversionInput.ThreadA = 2.2555;//brushStop.Segment.Job.Rml.MediaColor.A; + conversionInput.ThreadB = -10.9325;//brushStop.Segment.Job.Rml.MediaColor.B; + + conversionInput.ForwardData = ByteString.CopyFrom(File.ReadAllBytes(@"D:\Development\Tango\Software\ColorData\CCT\test.cct")); //ByteString.CopyFrom(brushStop.Segment.Job.Rml.Ccts.FirstOrDefault().ForwardData); + + foreach (var ids_pack in brushStop.Segment.Job.Machine.Configuration.IdsPacks.OrderBy(x => x.PackIndex)) + { + conversionInput.InputCoordinates.InputLiquids.Add(new InputLiquid() + { + LiquidType = (PMR.ColorLab.LiquidType)ids_pack.LiquidType.Code, + MaxNanoliterPerCentimeter = ids_pack.LiquidType.LiquidTypesRmls.Single(x => x.Rml == brushStop.Segment.Job.Rml).MaxNlPerCm, + Volume = brushStop.GetVolume(ids_pack.PackIndex), + CalibrationData = Cat.CreateDemoCalibrationData((PMR.ColorLab.LiquidType)ids_pack.LiquidType.Code), //ids_pack.LiquidType.Cats.Single(x => x.Rml == brushStop.Segment.Job.Rml && x.Machine == brushStop.Segment.Job.Machine).GetCalibrationData() + }); + } + + return conversionInput; + } + } +} diff --git a/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs b/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs index 3e679c490..d60812604 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs @@ -466,6 +466,26 @@ namespace Tango.BL.Entities } + protected Boolean _corrected; + /// + /// Gets or sets the brushstop corrected. + /// + [Column("CORRECTED")] + + public Boolean Corrected + { + get + { + return _corrected; + } + + set + { + _corrected = value; RaisePropertyChanged(nameof(Corrected)); + } + + } + protected String _colorcatalogguid; /// /// Gets or sets the brushstop color catalog guid. diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs index 571067c7f..fad528bea 100644 --- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs +++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs @@ -194,17 +194,6 @@ namespace Tango.BL.Entities } } - private bool _performColorConversion; - /// - /// Gets or sets a value indicating whether to perform color conversion. - /// - [NotMapped] - public bool PerformColorConversion - { - get { return _performColorConversion; } - set { _performColorConversion = value; RaisePropertyChangedAuto(); } - } - #endregion #region Public Methods @@ -348,68 +337,6 @@ namespace Tango.BL.Entities //TODO: Remove this.. IsOutOfGamut = _red > 250; - - - - //if (Segment != null && Segment.Job != null && Segment.Job.Rml != null) - //{ - // var rml = Segment.Job.Rml; - - // ConversionInput conversionInput = new ConversionInput(); - - // conversionInput.ColorSpace = (PMR.ColorLab.ColorSpace)ColorSpace.Code; - // conversionInput.InputCoordinates = new InputCoordinates(); - - // conversionInput.SegmentLength = Segment.Length; - - // conversionInput.InputCoordinates.Red = _red; - // conversionInput.InputCoordinates.Green = _green; - // conversionInput.InputCoordinates.Blue = _blue; - - // conversionInput.InputCoordinates.L = _l; - // conversionInput.InputCoordinates.A = _a; - // conversionInput.InputCoordinates.B = _b; - - // conversionInput.InputCoordinates.Cyan = _cyan; - // conversionInput.InputCoordinates.Magenta = _magenta; - // conversionInput.InputCoordinates.Yellow = _yellow; - // conversionInput.InputCoordinates.Key = _black; - - // conversionInput.ThreadL = rml.MediaColor.L; - // conversionInput.ThreadA = rml.MediaColor.A; - // conversionInput.ThreadB = rml.MediaColor.B; - - // var cct = rml.Ccts.LastOrDefault(); - - // conversionInput.ForwardData = ByteString.CopyFrom(cct.ForwardData); - // conversionInput.InverseData = ByteString.CopyFrom(cct.InverseData); - - // var configuration = Segment.Job.Machine.Configuration; - - // List factors = configuration.NoneEmptyIdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == rml.Guid).ToList(); - - // foreach (var idsPack in configuration.NoneEmptyIdsPacks.OrderBy(x => x.PackIndex)) - // { - // InputLiquid inputLiquid = new InputLiquid(); - // inputLiquid.LiquidType = idsPack.LiquidType.ToColorLibLiquidType(); - - // inputLiquid.MaxNanoliterPerCentimeter = factors[idsPack.PackIndex].MaxNlPerCm; - // inputLiquid.CalibrationData = idsPack.LiquidType.Cats.SingleOrDefault(x => x.Machine == Segment.Job.Machine && x.Rml == rml).GetCalibrationData(); - // inputLiquid.Volume = GetVolume(idsPack.PackIndex); - - // conversionInput.InputCoordinates.InputLiquids.Add(inputLiquid); - // } - - // NativePMR nativePMR = new NativePMR(Convert); - // ConversionOutput output = nativePMR.Invoke(conversionInput); - - // SetLiquidVolumes( - // Segment.Job.Machine.Configuration, - // Segment.Job.Rml, - // Segment.Job.Rml.ProcessParametersTablesGroups.Last().ProcessParametersTables.Single(x => x.TableIndex == output.SingleCoordinates.ProcessParametersTableIndex)); - - // IsOutOfGamut = output.OutOfGamut; - //} } #endregion diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Cat.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Cat.cs index bc7ca1901..9c389bdb2 100644 --- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Cat.cs +++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Cat.cs @@ -19,19 +19,18 @@ namespace Tango.BL.Entities Data = data.ToBytes(); } - public CalibrationData CreateDemoCalibrationData() + public static CalibrationData CreateDemoCalibrationData(PMR.ColorLab.LiquidType liquidType) { CalibrationData data = new CalibrationData(); + data.LiquidType = liquidType; - for (int i = 0; i < 10; i++) + for (int i = 0; i < 101; i++) { - for (int j = 0; j < 10; j++) + data.CalibrationPoints.Add(new CalibrationPoint() { - data.CalibrationPoints.Add(new CalibrationPoint() - { - X = i, Y = j - }); - } + X = i, + Y = i, + }); } return data; diff --git a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj index 5d4a9880b..19acce5ce 100644 --- a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj +++ b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj @@ -86,6 +86,8 @@ + + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/BRUSH_STOPS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/BRUSH_STOPS.cs index 6a65552db..6ea990b99 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/BRUSH_STOPS.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/BRUSH_STOPS.cs @@ -39,6 +39,7 @@ namespace Tango.DAL.Remote.DB public double V5 { get; set; } public double V6 { get; set; } public double V7 { get; set; } + public bool CORRECTED { get; set; } public string COLOR_CATALOG_GUID { get; set; } public int COLOR_CATALOG_CODE { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx index 17fd2d960..ddf4ad915 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -101,6 +101,7 @@ + @@ -2842,6 +2843,7 @@ + @@ -4949,6 +4951,7 @@ + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram index 26bca2d15..ea52dad2b 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,78 +5,78 @@ - - - - - - - - + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - + + + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.Hive/HexList.cs b/Software/Visual_Studio/Tango.Hive/HexList.cs index cd611eae1..1a53f2948 100644 --- a/Software/Visual_Studio/Tango.Hive/HexList.cs +++ b/Software/Visual_Studio/Tango.Hive/HexList.cs @@ -10,6 +10,14 @@ namespace Tango.Hive DefaultStyleKeyProperty.OverrideMetadata(typeof(HexList), new FrameworkPropertyMetadata(typeof(HexList))); } + public bool UseHexItemHasContainer + { + get { return (bool)GetValue(UseHexItemHasContainerProperty); } + set { SetValue(UseHexItemHasContainerProperty, value); } + } + public static readonly DependencyProperty UseHexItemHasContainerProperty = + DependencyProperty.Register("UseHexItemHasContainer", typeof(bool), typeof(HexList), new PropertyMetadata(false)); + public static readonly DependencyProperty OrientationProperty = HexGrid.OrientationProperty.AddOwner(typeof (HexList)); public static readonly DependencyProperty RowCountProperty = HexGrid.RowCountProperty.AddOwner(typeof (HexList)); @@ -38,5 +46,17 @@ namespace Tango.Hive { return (item is HexItem); } + + protected override DependencyObject GetContainerForItemOverride() + { + if (UseHexItemHasContainer) + { + return new HexItem(); + } + else + { + return base.GetContainerForItemOverride(); + } + } } } diff --git a/Software/Visual_Studio/Tango.Hive/Themes/Generic.xaml b/Software/Visual_Studio/Tango.Hive/Themes/Generic.xaml index 49308e512..ce4bb52cd 100644 --- a/Software/Visual_Studio/Tango.Hive/Themes/Generic.xaml +++ b/Software/Visual_Studio/Tango.Hive/Themes/Generic.xaml @@ -47,7 +47,7 @@ - + diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/ObjectToObjectTypeConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/ObjectToObjectTypeConverter.cs new file mode 100644 index 000000000..add54d0e2 --- /dev/null +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/ObjectToObjectTypeConverter.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.SharedUI.Converters +{ + public class ObjectToObjectTypeConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null) return value.GetType(); + return null; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj index 2f418ff4a..0e74f78e4 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj +++ b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj @@ -99,6 +99,7 @@ + diff --git a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs index 1a9008d03..46c49efd2 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs @@ -573,11 +573,14 @@ namespace Tango.Touch.Controls DateTime cur_time = DateTime.Now; + Debug.WriteLine("FROM: " + _grid_content.Margin.Top + " TO: " + (_grid_content.Margin.Top + (pixels_per_second) / 100)); + _move_timer = new DispatcherTimer(); _move_timer.Interval = TimeSpan.FromMilliseconds(10); _move_timer.Tick += (x, y) => { double to = _grid_content.Margin.Top + (pixels_per_second) / 100; + _grid_content.Margin = new Thickness(0, to, 0, 0); if (DateTime.Now > cur_time.AddMilliseconds(300 * strengh)) { @@ -585,29 +588,11 @@ namespace Tango.Touch.Controls if (_grid_content.Margin.Top > 0 || (_grid_content.Margin.Top - _border_viewport.ActualHeight < -_grid_content.ActualHeight)) { + _move_timer.Stop(); + SnapContentToBounds(); + Debug.WriteLine("INERTIA STOPPED BY SNAPPING!"); return; } - else - { - ThicknessAnimation ani = new ThicknessAnimation(); - ani.To = new Thickness(0, to, 0, 0); - ani.Duration = TimeSpan.FromMilliseconds(10); - _grid_content.BeginAnimation(Grid.MarginProperty, ani, HandoffBehavior.Compose); - } - } - else - { - _grid_content.BeginAnimation(Grid.MarginProperty, null); - _grid_content.Margin = new Thickness(0, to, 0, 0); - } - - if (_grid_content.Margin.Top > 0 || (_grid_content.Margin.Top - _border_viewport.ActualHeight < -_grid_content.ActualHeight)) - { - _move_timer.Stop(); - _grid_content.BeginAnimation(Grid.MarginProperty, null); - SnapContentToBounds(); - Debug.WriteLine("INERTIA STOPPED BY SNAPPING!"); - return; } SetThumbPosition(); -- cgit v1.3.1 From 466b54210bc5066e6e29107d6c8f996f360b1426 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 5 Jul 2018 19:24:36 +0300 Subject: Done some work on color catalog. Removed manipulation enabled from everywhere! Implemented "DelayCommand for TouchButton".. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1572864 -> 1572864 bytes .../Tango.MachineStudio.UI/Resources/BuildDate.txt | 2 +- .../Controls/TwineCatalogViewer.xaml | 2 +- .../Dialogs/AdvancedColorCorrectionView.xaml | 2 +- .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 42 +++++++++++++-------- .../Tango.PPC.Jobs/ViewModels/JobsViewVM.cs | 7 ++-- .../Controls/TwineCatalogControl.xaml | 4 +- .../Controls/TwineCatalogControl.xaml.cs | 28 +++++++++++--- .../PPC/Tango.PPC.UI/Views/LoginView.xaml | 2 +- .../Tango.DragAndDrop/DragAndDropService.cs | 2 +- .../Tango.Touch/Controls/TouchButton.cs | 30 +++++++++++++++ .../Tango.Touch/Controls/TouchComboBox.xaml | 2 +- .../Tango.Touch/Controls/TouchNotificationBar.cs | 2 +- 14 files changed, 93 insertions(+), 32 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 8d94608cb..6b3e124d2 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 05e2d088a..63cda9afe 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt index 5ae51fc02..a8100d53a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt @@ -1 +1 @@ -Thu 07/05/2018 16:44:59.08 +Thu 07/05/2018 18:36:01.68 diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/TwineCatalogViewer.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/TwineCatalogViewer.xaml index b698c4fad..de1bbea0b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/TwineCatalogViewer.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/TwineCatalogViewer.xaml @@ -22,6 +22,6 @@ - + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml index 69fb329a7..1c11512bb 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/AdvancedColorCorrectionView.xaml @@ -21,7 +21,7 @@ Color is out of range - + 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 50ea04272..bb8e31723 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 @@ -21,6 +21,7 @@ using Tango.BL.Catalogs; using System.Runtime.InteropServices; using System.Threading; using Tango.BL.ColorConversion; +using Tango.SharedUI.Helpers; namespace Tango.PPC.Jobs.ViewModels { @@ -404,27 +405,38 @@ namespace Tango.PPC.Jobs.ViewModels /// Handles the job selected message. /// /// The message. - private void HandleJobSelectedMessage(JobSelectedMessage message) + private async void HandleJobSelectedMessage(JobSelectedMessage message) { - if (_db != null) + await Task.Factory.StartNew(() => { - _db.Dispose(); - } + if (_db != null) + { + _db.Dispose(); + } + + _db = ObservablesContext.CreateDefault(); + Job = _db.Jobs.SingleOrDefault(x => x.Guid == message.Job.Guid); + var machine = Job.Machine; + + while (machine == null) + { + Thread.Sleep(10); + UIHelper.DoEvents(); + } - _db = ObservablesContext.CreateDefault(); - Job = _db.Jobs.SingleOrDefault(x => x.Guid == message.Job.Guid); - Rmls = _db.Rmls.ToList(); - ColorSpaces = _db.ColorSpaces.ToList(); - SpoolTypes = _db.SpoolTypes.ToList(); - Customers = _db.Customers.Where(x => x.OrganizationGuid == Job.Machine.Organization.Guid).ToList(); + Rmls = _db.Rmls.ToList(); + ColorSpaces = _db.ColorSpaces.ToList(); + SpoolTypes = _db.SpoolTypes.ToList(); + Customers = _db.Customers.Where(x => x.OrganizationGuid == machine.OrganizationGuid).ToList(); + + if (!_check_gamut_thread.IsAlive) + { + _check_gamut_thread.Start(); + } + }); SegmentsCollectionView = CollectionViewSource.GetDefaultView(Job.Segments); SegmentsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Segment.SegmentIndex), ListSortDirection.Ascending)); - - if (!_check_gamut_thread.IsAlive) - { - _check_gamut_thread.Start(); - } } #endregion 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 396eb1461..699744d5a 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 @@ -200,10 +200,11 @@ namespace Tango.PPC.Jobs.ViewModels /// Selects the job. /// /// The job. - public void SelectJob(Job job) + public async void SelectJob(Job job) { + await Task.Delay(300); + await NavigationManager.NavigateTo(nameof(JobSummeryView)); RaiseMessage(new JobSelectedMessage() { Job = job }); - NavigationManager.NavigateTo(nameof(JobSummeryView)); } /// @@ -228,7 +229,7 @@ namespace Tango.PPC.Jobs.ViewModels InvokeUI(() => { - Jobs = _db.Jobs.Where(x => x.Machine.Guid == ApplicationManager.Machine.Guid).ToObservableCollection(); + Jobs = jobs.Where(x => x.Machine.Guid == ApplicationManager.Machine.Guid).ToObservableCollection(); JobsCollectionView = CollectionViewSource.GetDefaultView(Jobs); JobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending)); FilterJobCategory(FilterCategory); 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 66db7bc10..baf971430 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml @@ -16,11 +16,11 @@ - + - + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs index 024f47f58..f2a90a454 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs @@ -13,6 +13,7 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using Tango.BL.Catalogs; +using Tango.Touch.Controls; namespace Tango.PPC.Common.Controls { @@ -39,14 +40,25 @@ namespace Tango.PPC.Common.Controls InitializeComponent(); Loaded += TwineCatalogControl_Loaded; - DataContextChanged += (x, y) => { _catalog = DataContext as Catalog; }; + DataContextChanged += (x, y) => + { + _catalog = DataContext as Catalog; + + if (list.ScrollViewer != null && _catalog != null) + { + list.ScrollViewer.ScrollToTop(); + _preventChange = true; + slider.Value = _catalog.Groups.Count; + _preventChange = false; + } + }; } private void ScrollViewer_Scrolling(object sender, Touch.Controls.DoubleValueChangedEventArgs e) { if (!_preventChange) { - if (e.Value > _lastScrollPosition + 10 || e.Value < _lastScrollPosition - 10) + if (e.Value > _lastScrollPosition + 60 || e.Value < _lastScrollPosition - 60) { var group = list.ScrollViewer.GetMostVisibleElementDataContext(); @@ -56,9 +68,9 @@ namespace Tango.PPC.Common.Controls slider.Value = slider.Maximum - _catalog.Groups.IndexOf(group); _preventChange = false; } - } - _lastScrollPosition = e.Value; + _lastScrollPosition = e.Value; + } } } @@ -89,7 +101,7 @@ namespace Tango.PPC.Common.Controls } } - if (_catalog != null) + if (_catalog != null && _catalog.Groups.Count > _catalog.Groups.Count - 1 - (int)e.NewValue && _catalog.Groups.Count - 1 - (int)e.NewValue > -1) { slider.Foreground = new SolidColorBrush(_catalog.Groups.ElementAt(_catalog.Groups.Count - 1 - (int)e.NewValue).Color); } @@ -106,5 +118,11 @@ namespace Tango.PPC.Common.Controls _preventChange = false; } } + + public TouchListBox TouchListBox + { + get { return list; } + } + } } 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 b6f6f4432..3347a20d6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoginView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoginView.xaml @@ -21,7 +21,7 @@ Keep me logged in. - LOGIN + LOGIN Forgot password? diff --git a/Software/Visual_Studio/Tango.DragAndDrop/DragAndDropService.cs b/Software/Visual_Studio/Tango.DragAndDrop/DragAndDropService.cs index 26a89911e..586071363 100644 --- a/Software/Visual_Studio/Tango.DragAndDrop/DragAndDropService.cs +++ b/Software/Visual_Studio/Tango.DragAndDrop/DragAndDropService.cs @@ -574,7 +574,7 @@ namespace Tango.DragAndDrop element.RegisterForPreviewMouseOrTouchDown(Draggable_PreviewMouseDown); element.RegisterForMouseOrTouchMove(Draggable_MouseMove); element.PreviewMouseUp += Draggable_PreviewMouseUp; - element.IsManipulationEnabled = true; + //element.IsManipulationEnabled = true; //element.AddHandler(FrameworkElement.PreviewMouseDownEvent, (MouseButtonEventHandler)Draggable_PreviewMouseDown, true); //element.AddHandler(FrameworkElement.MouseMoveEvent, (MouseEventHandler)Draggable_MouseMove, true); diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs index 15f92bb97..ddf4c61a1 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchButton.cs @@ -78,6 +78,21 @@ namespace Tango.Touch.Controls public static readonly DependencyProperty RippleBrushProperty = DependencyProperty.Register("RippleBrush", typeof(Brush), typeof(TouchButton), new PropertyMetadata(new SolidColorBrush(Colors.White) { Opacity = 0.5 })); + public ICommand DelayCommand + { + get { return (ICommand)GetValue(DelayCommandProperty); } + set { SetValue(DelayCommandProperty, value); } + } + public static readonly DependencyProperty DelayCommandProperty = + DependencyProperty.Register("DelayCommand", typeof(ICommand), typeof(TouchButton), new PropertyMetadata(null)); + + public Duration DelayCommandDuration + { + get { return (Duration)GetValue(DelayCommandDurationProperty); } + set { SetValue(DelayCommandDurationProperty, value); } + } + public static readonly DependencyProperty DelayCommandDurationProperty = + DependencyProperty.Register("DelayCommandDuration", typeof(Duration), typeof(TouchButton), new PropertyMetadata(new Duration(TimeSpan.FromSeconds(0.5)))); #endregion @@ -86,6 +101,21 @@ namespace Tango.Touch.Controls } + protected override void OnClick() + { + base.OnClick(); + PerformDelayCommand(); + } + + private async void PerformDelayCommand() + { + if (DelayCommand != null) + { + await Task.Delay(DelayCommandDuration.TimeSpan); + DelayCommand.Execute(CommandParameter); + } + } + static TouchButton() { DefaultStyleKeyProperty.OverrideMetadata(typeof(TouchButton), new FrameworkPropertyMetadata(typeof(TouchButton))); diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml index 273cc2639..5ea529c70 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml @@ -23,7 +23,7 @@ - + diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs index 9a2ca465f..d2a935fe1 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs @@ -99,7 +99,7 @@ namespace Tango.Touch.Controls border_notifications = GetTemplateChild("PART_BorderNotifications") as Border; grid_container = GetTemplateChild("PART_Grid_Container") as Grid; - border_notifications.IsManipulationEnabled = true; + //border_notifications.IsManipulationEnabled = true; border_notifications.RegisterForPreviewMouseOrTouchDown(GridNotificationMouseDown); border_notifications.RegisterForMouseOrTouchMove(GridNotificationMouseMove); border_notifications.RegisterForPreviewMouseOrTouchUp(GridNotificationMouseUp); -- cgit v1.3.1 From 4ca8cee91fb46977b75e8329c18d9b6a4654b12e Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sat, 7 Jul 2018 15:02:20 +0300 Subject: Working on PPC jobs loading performance... --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1572864 -> 1572864 bytes .../Tango.MachineStudio.UI/Resources/BuildDate.txt | 2 +- .../Native/Tango.ColorLib/Tango.ColorLib.vcxproj | 2 +- .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 23 ++- .../Tango.PPC.Jobs/ViewModels/JobsViewVM.cs | 2 +- .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 2 +- .../Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs | 8 +- .../Controls/AsyncAdornerControl.cs | 205 +++++++++++++++++++++ .../ExtensionMethods/IListExtensions.cs | 26 +++ .../ObservableCollectionExtensions.cs | 53 ++++++ .../Notifications/INotificationProvider.cs | 21 +++ .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 5 + .../Controls/HeaderLoadingControl.xaml | 16 ++ .../Controls/HeaderLoadingControl.xaml.cs | 28 +++ .../Notifications/DefaultNotificationProvider.cs | 35 ++++ .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 8 + .../PPC/Tango.PPC.UI/Views/LayoutView.xaml | 24 +++ .../Tango.BL/EntitiesExtensions/BrushStop.cs | 64 ++++--- .../Components/FrameworkElementSerializer.cs | 124 +++++++++++++ .../Visual_Studio/Tango.Core/ExtendedObject.cs | 10 + .../Visual_Studio/Tango.Core/Tango.Core.csproj | 1 + .../Tango.SharedUI/Controls/NavigationControl.cs | 2 +- .../Converters/SegmentLengthToWidthConverter.cs | 4 +- .../Tango.Touch/Controls/TouchListBox.xaml | 2 +- 25 files changed, 625 insertions(+), 42 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/AsyncAdornerControl.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/ExtensionMethods/IListExtensions.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/ExtensionMethods/ObservableCollectionExtensions.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/HeaderLoadingControl.xaml create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/HeaderLoadingControl.xaml.cs create mode 100644 Software/Visual_Studio/Tango.Core/Components/FrameworkElementSerializer.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index f83f0de4f..33d333496 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 b4729c4ef..18972bbe8 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt index a8100d53a..f5ca2ed87 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt @@ -1 +1 @@ -Thu 07/05/2018 18:36:01.68 +Sat 07/07/2018 1:27:31.31 diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj b/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj index 506745a12..bed1cc7bb 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj +++ b/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj @@ -23,7 +23,7 @@ {625B2A26-97A9-45C9-8BCF-6BD30F593E17} Win32Proj TangoColorLib - 10.0.15063.0 + 10.0.16299.0 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 a22e1fdf4..52f2b8f6e 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 @@ -419,13 +419,28 @@ namespace Tango.PPC.Jobs.ViewModels SpoolTypes = await _db.SpoolTypes.ToListAsync(); Customers = await _db.Customers.Where(x => x.OrganizationGuid == ApplicationManager.Machine.OrganizationGuid).ToListAsync(); - if (!_check_gamut_thread.IsAlive) - { - _check_gamut_thread.Start(); - } + //if (!_check_gamut_thread.IsAlive) + //{ + // _check_gamut_thread.Start(); + //} + + //Job.Segments.ReloadAsyncIdle((current, total) => + //{ + + // NotificationProvider.SetGlobalBusyMessage(String.Format("Loading job segment {0}/{1}...", current, total)); + + //}, () => + //{ + + //}); SegmentsCollectionView = CollectionViewSource.GetDefaultView(Job.Segments); SegmentsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Segment.SegmentIndex), ListSortDirection.Ascending)); + + InvokeUIOnIdle(() => + { + NotificationProvider.ReleaseGlobalBusyMessage(); + }); } #endregion 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 699744d5a..1275248eb 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 @@ -202,7 +202,7 @@ namespace Tango.PPC.Jobs.ViewModels /// The job. public async void SelectJob(Job job) { - await Task.Delay(300); + NotificationProvider.SetGlobalBusyMessage("Loading job..."); await NavigationManager.NavigateTo(nameof(JobSummeryView)); RaiseMessage(new JobSelectedMessage() { Job = 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 a55e5a7d3..0ac903b1d 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 @@ -70,7 +70,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 c3e3ab688..1e6ef30ed 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 @@ -12,17 +12,23 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using static Tango.SharedUI.Controls.NavigationControl; namespace Tango.PPC.Jobs.Views { /// /// Interaction logic for JobView.xaml /// - public partial class JobView : UserControl + public partial class JobView : UserControl ,INavigationView { public JobView() { InitializeComponent(); } + + public void OnNavigated() + { + scrollViewer.ScrollToTop(); + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/AsyncAdornerControl.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/AsyncAdornerControl.cs new file mode 100644 index 000000000..b20e93ff9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/AsyncAdornerControl.cs @@ -0,0 +1,205 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Interop; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.Core.Components; + +namespace Tango.PPC.Common.Controls +{ + public partial class AsyncAdornerControl : ContentControl + { + private bool _loaded; + + public enum GWL + { + ExStyle = -20 + } + + public enum WS_EX + { + Transparent = 0x20, + Layered = 0x80000 + } + + public enum LWA + { + ColorKey = 0x1, + Alpha = 0x2 + } + + [DllImport("user32.dll", EntryPoint = "GetWindowLong")] + public static extern int GetWindowLong(IntPtr hWnd, GWL nIndex); + + [DllImport("user32.dll", EntryPoint = "SetWindowLong")] + public static extern int SetWindowLong(IntPtr hWnd, GWL nIndex, int dwNewLong); + + [DllImport("user32.dll", EntryPoint = "SetLayeredWindowAttributes")] + public static extern bool SetLayeredWindowAttributes(IntPtr hWnd, int crKey, byte alpha, LWA dwFlags); + + private Window _window; + + public AsyncAdornerControl() + { + Loaded += AsyncAdornerControl_Loaded; + LayoutUpdated += AsyncAdornerControl_LayoutUpdated; + IsVisibleChanged += AsyncAdornerControl_IsVisibleChanged; + } + + private void AsyncAdornerControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) + { + if (Visibility == Visibility.Visible) + { + ShowWindow(); + } + else + { + HideWindow(); + } + } + + private void AsyncAdornerControl_LayoutUpdated(object sender, EventArgs e) + { + SyncBounds(); + } + + public Type ViewType + { + get { return (Type)GetValue(ViewTypeProperty); } + set { SetValue(ViewTypeProperty, value); } + } + public static readonly DependencyProperty ViewTypeProperty = + DependencyProperty.Register("ViewType", typeof(Type), typeof(AsyncAdornerControl), new PropertyMetadata(null)); + + protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) + { + base.OnRenderSizeChanged(sizeInfo); + SyncBounds(); + } + + private void AsyncAdornerControl_Loaded(object sender, RoutedEventArgs e) + { + if (!this.IsInDesignMode()) + { + if (_loaded) return; + + _loaded = true; + + var handle = new WindowInteropHelper(System.Windows.Application.Current.MainWindow).Handle; + + System.Windows.Application.Current.MainWindow.LocationChanged += MainWindow_LocationChanged; + + Visibility v = Visibility; + Type type = ViewType; + + var xaml = FrameworkElementSerializer.Serialize(Content as FrameworkElement); + object dc = this.DataContext; + Content = null; + + Thread thread = new Thread(() => + { + _window = new Window(); + _window.WindowStyle = WindowStyle.None; + _window.ResizeMode = ResizeMode.NoResize; + _window.ShowInTaskbar = false; + _window.AllowsTransparency = true; + _window.Background = Brushes.Transparent; + _window.WindowStartupLocation = WindowStartupLocation.Manual; + SyncBounds(); + + if (v != Visibility.Visible) + { + _window.Opacity = 0; + } + + new WindowInteropHelper(_window).Owner = handle; + + _window.ShowActivated = false; + + //FrameworkElement element = Activator.CreateInstance(type) as FrameworkElement; + + var cloned = FrameworkElementSerializer.Deserialize(xaml); + cloned.DataContext = dc; + + _window.Content = cloned; + + _window.Show(); + + int wl = GetWindowLong(handle, GWL.ExStyle); + wl = wl | 0x80000 | 0x20; + SetWindowLong(handle, GWL.ExStyle, wl); + SetLayeredWindowAttributes(handle, 0, 128, LWA.Alpha); + + SyncBounds(); + + System.Windows.Threading.Dispatcher.Run(); + }); + + thread.SetApartmentState(ApartmentState.STA); + thread.IsBackground = true; + thread.Start(); + } + } + + private void MainWindow_LocationChanged(object sender, EventArgs e) + { + SyncBounds(); + } + + private void SyncBounds() + { + if (_window != null) + { + this.BeginInvoke(() => + { + Point location = PointToScreen(new Point(0, 0)); + Size size = new Size(ActualWidth, ActualHeight); + + _window.BeginInvoke(() => + { + _window.Top = location.Y; + _window.Left = location.X; + _window.Width = size.Width; + _window.Height = size.Height; + }); + }); + } + } + + private void HideWindow() + { + if (_window != null) + { + _window.BeginInvoke(() => + { + _window.Hide(); + }); + } + } + + private void ShowWindow() + { + if (_window != null) + { + _window.BeginInvoke(() => + { + _window.Opacity = 1; + _window.Show(); + }); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/ExtensionMethods/IListExtensions.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/ExtensionMethods/IListExtensions.cs new file mode 100644 index 000000000..fdf07ccff --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/ExtensionMethods/IListExtensions.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Threading; + +public static class IListExtensions +{ + public static IList ToListAsyncIdle(this IList source) + { + var copy = source.ToList(); + IList result = new List(); + + foreach (var item in copy) + { + Application.Current.Dispatcher.BeginInvoke(new Action(() => + { + result.Add(item); + }), DispatcherPriority.ContextIdle); + } + + return result; + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/ExtensionMethods/ObservableCollectionExtensions.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/ExtensionMethods/ObservableCollectionExtensions.cs new file mode 100644 index 000000000..c539273d9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/ExtensionMethods/ObservableCollectionExtensions.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Threading; + +public static class ObservableCollectionExtensions +{ + public static ObservableCollection ToObservableCollectionAsyncIdle(this ObservableCollection source) + { + var copy = source.ToList(); + ObservableCollection result = new ObservableCollection(); + + foreach (var item in copy) + { + Application.Current.Dispatcher.BeginInvoke(new Action(() => + { + result.Add(item); + }), DispatcherPriority.ContextIdle); + } + + return result; + } + + public static void ReloadAsyncIdle(this ObservableCollection source, Action onProgress, Action onComplete = null) + { + var copy = source.ToList(); + source.Clear(); + + int count = copy.Count; + int completed = 0; + + foreach (var item in copy) + { + Application.Current.Dispatcher.BeginInvoke(new Action(() => + { + source.Add(item); + completed++; + + onProgress?.Invoke(completed, count); + + if (completed == count) + { + onComplete?.Invoke(); + } + }), DispatcherPriority.ContextIdle); + } + } +} + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs index 96de08447..f7fb67a19 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs @@ -128,5 +128,26 @@ namespace Tango.PPC.Common.Notifications /// Gets the pop notification command. /// RelayCommand PopNotificationCommand { get; } + + /// + /// Gets a value indicating whether this instance is in global busy state. + /// + bool IsInGlobalBusyState { get; } + + /// + /// Sets the global busy message. + /// + /// The message. + void SetGlobalBusyMessage(String message); + + /// + /// Releases the global busy message. + /// + void ReleaseGlobalBusyMessage(); + + /// + /// Gets the current global busy message. + /// + String GlobalBusyMessage { get; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index 98210a76f..192658560 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -75,6 +75,8 @@ ..\..\packages\System.Data.SQLite.Linq.1.0.108.0\lib\net46\System.Data.SQLite.Linq.dll True + + @@ -92,9 +94,12 @@ PPC.cs + TwineCatalogControl.xaml + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/HeaderLoadingControl.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/HeaderLoadingControl.xaml new file mode 100644 index 000000000..5b07e1fa2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/HeaderLoadingControl.xaml @@ -0,0 +1,16 @@ + + + + + Loading... + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/HeaderLoadingControl.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/HeaderLoadingControl.xaml.cs new file mode 100644 index 000000000..540e829c9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/HeaderLoadingControl.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.PPC.UI.Controls +{ + /// + /// Interaction logic for HeaderLoadingControl.xaml + /// + public partial class HeaderLoadingControl : UserControl + { + public HeaderLoadingControl() + { + InitializeComponent(); + } + } +} 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 ae777839b..aaa5a9cf3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs @@ -386,5 +386,40 @@ namespace Tango.PPC.UI.Notifications { return ShowDialog(Activator.CreateInstance()); } + + /// + /// Sets the global busy message. + /// + /// The message. + public void SetGlobalBusyMessage(string message) + { + GlobalBusyMessage = message; + IsInGlobalBusyState = true; + + RaisePropertyChanged(nameof(IsInGlobalBusyState)); + RaisePropertyChanged(nameof(GlobalBusyMessage)); + } + + /// + /// Releases the global busy message. + /// + public void ReleaseGlobalBusyMessage() + { + GlobalBusyMessage = null; + IsInGlobalBusyState = false; + + RaisePropertyChanged(nameof(IsInGlobalBusyState)); + RaisePropertyChanged(nameof(GlobalBusyMessage)); + } + + /// + /// Gets the current global busy message. + /// + public string GlobalBusyMessage { get; private set; } + + /// + /// Gets a value indicating whether this instance is in global busy state. + /// + public bool IsInGlobalBusyState { get; private set; } } } 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 d2763510a..eaf53b993 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 @@ -101,6 +101,7 @@ + @@ -111,6 +112,9 @@ PPC.cs + + HeaderLoadingControl.xaml + @@ -140,6 +144,10 @@ MainView.xaml + + Designer + MSBuild:Compile + MSBuild:Compile Designer 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 c7d019981..7d170d04f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml @@ -4,12 +4,14 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Tango.PPC.UI.Views" + xmlns:localControls="clr-namespace:Tango.PPC.UI.Controls" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:fa="http://schemas.fontawesome.io/icons/" xmlns:vm="clr-namespace:Tango.PPC.UI.ViewModels" xmlns:global="clr-namespace:Tango.PPC.UI" xmlns:localConverters="clr-namespace:Tango.PPC.UI.Converters" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:commonControls="clr-namespace:Tango.PPC.Common.Controls;assembly=Tango.PPC.Common" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:keyboard="clr-namespace:Tango.Touch.Keyboard;assembly=Tango.Touch" mc:Ignorable="d" @@ -110,6 +112,28 @@ + + + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs index fad528bea..352437c34 100644 --- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs +++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs @@ -16,6 +16,7 @@ using Tango.PMR.ColorLab; using Google.Protobuf; using System.Runtime.InteropServices; using Tango.PMR; +using System.Diagnostics; namespace Tango.BL.Entities { @@ -302,41 +303,44 @@ namespace Tango.BL.Entities /// private void SynchronizeColorSpaces() { - Rgb rgb = new Rgb(Red, Green, Blue); - Cmyk cmyk = new Cmyk(Cyan, Magenta, Yellow, Black); - Lab lab = new Lab(L, A, B); - - switch ((ColorSpaces)ColorSpace.Code) + Task.Factory.StartNew(() => { - case ColorSpaces.RGB: - cmyk = rgb.To(); - lab = rgb.To(); - break; - case ColorSpaces.CMYK: - rgb = cmyk.To(); - lab = cmyk.To(); - break; - case ColorSpaces.LAB: - rgb = lab.To(); - cmyk = lab.To(); - break; - } + Rgb rgb = new Rgb(Red, Green, Blue); + Cmyk cmyk = new Cmyk(Cyan, Magenta, Yellow, Black); + Lab lab = new Lab(L, A, B); + + switch ((ColorSpaces)ColorSpace.Code) + { + case ColorSpaces.RGB: + cmyk = rgb.To(); + lab = rgb.To(); + break; + case ColorSpaces.CMYK: + rgb = cmyk.To(); + lab = cmyk.To(); + break; + case ColorSpaces.LAB: + rgb = lab.To(); + cmyk = lab.To(); + break; + } - _red = (int)rgb.R; - _green = (int)rgb.G; - _blue = (int)rgb.B; + _red = (int)rgb.R; + _green = (int)rgb.G; + _blue = (int)rgb.B; - _cyan = cmyk.C; - _magenta = cmyk.M; - _yellow = cmyk.Y; - _black = cmyk.K; + _cyan = cmyk.C; + _magenta = cmyk.M; + _yellow = cmyk.Y; + _black = cmyk.K; - _l = lab.L; - _a = lab.A; - _b = lab.B; + _l = lab.L; + _a = lab.A; + _b = lab.B; - //TODO: Remove this.. - IsOutOfGamut = _red > 250; + //TODO: Remove this.. + IsOutOfGamut = _red > 250; + }); } #endregion diff --git a/Software/Visual_Studio/Tango.Core/Components/FrameworkElementSerializer.cs b/Software/Visual_Studio/Tango.Core/Components/FrameworkElementSerializer.cs new file mode 100644 index 000000000..8f0c6a266 --- /dev/null +++ b/Software/Visual_Studio/Tango.Core/Components/FrameworkElementSerializer.cs @@ -0,0 +1,124 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; +using System.Xml; + +namespace Tango.Core.Components +{ + public static class FrameworkElementSerializer + { + private class BindingConvertor : ExpressionConverter + { + public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) + { + if (destinationType == typeof(MarkupExtension)) + return true; + else return false; + } + public override object ConvertTo(ITypeDescriptorContext context, + System.Globalization.CultureInfo culture, + object value, Type destinationType) + { + if (destinationType == typeof(MarkupExtension)) + { + BindingExpression bindingExpression = value as BindingExpression; + if (bindingExpression == null) + throw new Exception(); + return bindingExpression.ParentBinding; + } + + return base.ConvertTo(context, culture, value, destinationType); + } + + public static void Register() + { + Attribute[] attr = new Attribute[1]; + TypeConverterAttribute vConv = new TypeConverterAttribute(typeof(TC)); + attr[0] = vConv; + TypeDescriptor.AddAttributes(typeof(T), attr); + } + } + + static FrameworkElementSerializer() + { + BindingConvertor.Register(); + } + + /// + /// Clones the specified element. + /// + /// The element. + /// + public static FrameworkElement Clone(FrameworkElement element) + { + var sb = new StringBuilder(); + var writer = XmlWriter.Create(sb, new XmlWriterSettings + { + Indent = true, + ConformanceLevel = ConformanceLevel.Fragment, + OmitXmlDeclaration = true, + NamespaceHandling = NamespaceHandling.OmitDuplicates, + }); + var mgr = new XamlDesignerSerializationManager(writer); + + // HERE BE MAGIC!!! + mgr.XamlWriterMode = XamlWriterMode.Expression; + // THERE WERE MAGIC!!! + + XamlWriter.Save(element, mgr); + String xaml = sb.ToString(); + + StringReader stringReader = new StringReader(xaml); + XmlReader xmlReader = XmlReader.Create(stringReader); + FrameworkElement cloned = (FrameworkElement)XamlReader.Load(xmlReader) as FrameworkElement; + return cloned; + } + + /// + /// Serializes the specified element. + /// + /// The element. + /// + public static String Serialize(FrameworkElement element) + { + var sb = new StringBuilder(); + var writer = XmlWriter.Create(sb, new XmlWriterSettings + { + Indent = true, + ConformanceLevel = ConformanceLevel.Fragment, + OmitXmlDeclaration = true, + NamespaceHandling = NamespaceHandling.OmitDuplicates, + }); + var mgr = new XamlDesignerSerializationManager(writer); + + // HERE BE MAGIC!!! + mgr.XamlWriterMode = XamlWriterMode.Expression; + // THERE WERE MAGIC!!! + + XamlWriter.Save(element, mgr); + String xaml = sb.ToString(); + + return xaml; + } + + /// + /// Deserializes the specified xaml. + /// + /// The xaml. + /// + public static FrameworkElement Deserialize(String xaml) + { + StringReader stringReader = new StringReader(xaml); + XmlReader xmlReader = XmlReader.Create(stringReader); + FrameworkElement cloned = (FrameworkElement)XamlReader.Load(xmlReader) as FrameworkElement; + return cloned; + } + } +} diff --git a/Software/Visual_Studio/Tango.Core/ExtendedObject.cs b/Software/Visual_Studio/Tango.Core/ExtendedObject.cs index 30179c3bf..cafafef4f 100644 --- a/Software/Visual_Studio/Tango.Core/ExtendedObject.cs +++ b/Software/Visual_Studio/Tango.Core/ExtendedObject.cs @@ -8,6 +8,7 @@ using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; using System.Windows; +using System.Windows.Threading; using Tango.Core.Commands; using Tango.Core.IO; using Tango.Logging; @@ -111,6 +112,15 @@ namespace Tango.Core Application.Current.Dispatcher.BeginInvoke(action); } + /// + /// Invokes the specified action on the UI Thread when context is idle. + /// + /// The action. + protected virtual void InvokeUIOnIdle(Action action) + { + Application.Current.Dispatcher.BeginInvoke(action, DispatcherPriority.ContextIdle); + } + /// /// Invokes the specified action on the UI Thread. /// diff --git a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj index 7523fe7e5..864f4f797 100644 --- a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj +++ b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj @@ -62,6 +62,7 @@ Core.cs + diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs index aae75532c..2b59bb663 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs @@ -222,7 +222,7 @@ namespace Tango.SharedUI.Controls #region Attached Properties - #region Draggable + #region NavigationName /// /// Determines the element navigation name. diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/SegmentLengthToWidthConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/SegmentLengthToWidthConverter.cs index 64699e053..e3d5db01d 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Converters/SegmentLengthToWidthConverter.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/SegmentLengthToWidthConverter.cs @@ -27,7 +27,9 @@ namespace Tango.SharedUI.Converters double segmentLength = System.Convert.ToDouble(values[3]); double totalLength = job.Length; - return (segmentLength / totalLength) * elementWidth; + double result = (segmentLength / totalLength) * elementWidth; + + return double.IsInfinity(result) ? 0d : result; } else { diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchListBox.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchListBox.xaml index 92279d5e6..61342fc0b 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchListBox.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchListBox.xaml @@ -40,7 +40,7 @@ - + -- cgit v1.3.1 From f4688d6113dc33deac114bd6999967fec246b8c0 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sun, 8 Jul 2018 09:07:39 +0300 Subject: Working on PPC segments loading performance. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1572864 -> 1572864 bytes .../Tango.MachineStudio.UI/Resources/BuildDate.txt | 2 +- .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 71 +++++++++++++-------- .../Tango.PPC.Jobs/ViewModels/JobsViewVM.cs | 1 - .../Tango.BL/EntitiesExtensions/BrushStop.cs | 52 +++++++++++---- .../Tango.BL/EntitiesExtensions/Job.cs | 24 ++++++- .../Tango.BL/EntitiesExtensions/Segment.cs | 55 ++++++++-------- .../Tango.Touch/Controls/TouchNumericTextBox.cs | 13 +++- 9 files changed, 147 insertions(+), 71 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 33d333496..6c0e0cf74 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 18972bbe8..4d6ecff99 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt index f5ca2ed87..0d0ef0a18 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt @@ -1 +1 @@ -Sat 07/07/2018 1:27:31.31 +Sun 07/08/2018 0:25:00.31 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 52f2b8f6e..260670e08 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 @@ -34,6 +34,7 @@ namespace Tango.PPC.Jobs.ViewModels private ObservablesContext _db; private bool _can_navigate_back; private Thread _check_gamut_thread; + private Job _job_to_load; #region Properties @@ -405,15 +406,40 @@ namespace Tango.PPC.Jobs.ViewModels /// Handles the job selected message. /// /// The message. - private async void HandleJobSelectedMessage(JobSelectedMessage message) + private void HandleJobSelectedMessage(JobSelectedMessage message) { + _job_to_load = message.Job; + } + + #endregion + + #region IPPC ViewModel Overrides + + /// + /// Called when the application has been started. + /// + public override void OnApplicationStarted() + { + + } + + /// + /// Called when the navigation system has navigated to this VM view. + /// + public async override void OnNavigatedTo() + { + NotificationProvider.SetGlobalBusyMessage("Loading job details..."); + + _can_navigate_back = false; + base.OnNavigatedTo(); + if (_db != null) { _db.Dispose(); } _db = ObservablesContext.CreateDefault(); - Job = await _db.Jobs.SingleOrDefaultAsync(x => x.Guid == message.Job.Guid); + Job = await _db.Jobs.SingleOrDefaultAsync(x => x.Guid == _job_to_load.Guid); Rmls = await _db.Rmls.ToListAsync(); ColorSpaces = await _db.ColorSpaces.ToListAsync(); SpoolTypes = await _db.SpoolTypes.ToListAsync(); @@ -437,42 +463,33 @@ namespace Tango.PPC.Jobs.ViewModels SegmentsCollectionView = CollectionViewSource.GetDefaultView(Job.Segments); SegmentsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Segment.SegmentIndex), ListSortDirection.Ascending)); - InvokeUIOnIdle(() => + InvokeUIOnIdle(() => { NotificationProvider.ReleaseGlobalBusyMessage(); }); } - #endregion - - #region IPPC ViewModel Overrides - - /// - /// Called when the application has been started. - /// - public override void OnApplicationStarted() - { - - } - - /// - /// Called when the navigation system has navigated to this VM view. - /// - public override void OnNavigatedTo() - { - _can_navigate_back = false; - base.OnNavigatedTo(); - } - /// /// Called before the navigation system navigates from this object. /// Return false to abort the navigation. /// /// - public override Task OnNavigateOutRequest() + public async override Task OnNavigateOutRequest() { - if (_can_navigate_back) return Task.FromResult(true); - return NotificationProvider.ShowQuestion("Are you sure you want to exit this job?"); + bool result = true; + + if (!_can_navigate_back) + { + result = await NotificationProvider.ShowQuestion("Are you sure you want to exit this job?"); + } + + if (result) + { + Job = null; + SegmentsCollectionView = null; + } + + return result; } #endregion 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 1275248eb..d2c229187 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 @@ -202,7 +202,6 @@ namespace Tango.PPC.Jobs.ViewModels /// The job. public async void SelectJob(Job job) { - NotificationProvider.SetGlobalBusyMessage("Loading job..."); await NavigationManager.NavigateTo(nameof(JobSummeryView)); RaiseMessage(new JobSelectedMessage() { Job = job }); } diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs index 352437c34..fa5dc4acb 100644 --- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs +++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs @@ -26,14 +26,34 @@ namespace Tango.BL.Entities /// public partial class BrushStop { - [DllImport("Tango.ColorLib.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "Convert")] - public static extern int Convert(IntPtr data, int size, ref IntPtr output); - [NotMapped] private bool _ignorePropChanged; + private static List _colorPropertyNames; + + static BrushStop() + { + _colorPropertyNames = new List(); + + _colorPropertyNames.Add(nameof(Red)); + _colorPropertyNames.Add(nameof(Green)); + _colorPropertyNames.Add(nameof(Blue)); + + _colorPropertyNames.Add(nameof(L)); + _colorPropertyNames.Add(nameof(A)); + _colorPropertyNames.Add(nameof(B)); + + _colorPropertyNames.Add(nameof(Cyan)); + _colorPropertyNames.Add(nameof(Magenta)); + _colorPropertyNames.Add(nameof(Yellow)); + _colorPropertyNames.Add(nameof(Black)); + + _colorPropertyNames.Add(nameof(Color)); + } + #region Properties + private ObservableCollection _liquidVolumes; /// /// Gets or sets the collection of this brush stop liquid volumes. @@ -172,6 +192,7 @@ namespace Tango.BL.Entities if (Segment != null) { OffsetPercent = (value / Segment.Length) * 100d; + RaisePropertyChangedAuto(); } } } @@ -261,22 +282,31 @@ namespace Tango.BL.Entities if (!_ignorePropChanged && propName != nameof(ColorSpace) && ColorSpace != null) { + if (_colorPropertyNames.Contains(propName)) + { + SynchronizeColorSpaces(); - SynchronizeColorSpaces(); + _ignorePropChanged = true; - _ignorePropChanged = true; + foreach (var prop in _colorPropertyNames) + { + RaisePropertyChanged(prop); + } - foreach (var prop in typeof(BrushStop).GetProperties(BindingFlags.Instance | BindingFlags.Public)) - { - RaisePropertyChanged(prop.Name); - } + if (Segment != null) + { + Segment.RaiseSegmentBrushChanged(); + } + _ignorePropChanged = false; + } + } + if (propName == nameof(OffsetPercent)) + { if (Segment != null) { Segment.RaiseSegmentBrushChanged(); } - - _ignorePropChanged = false; } } diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs index 52f123f7a..68cd371fd 100644 --- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs +++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs @@ -20,6 +20,8 @@ namespace Tango.BL.Entities /// public partial class Job { + private double _lastLength; + /// /// Initializes a new instance of the class. /// @@ -46,7 +48,11 @@ namespace Tango.BL.Entities [JsonIgnore] public double Length { - get { return Segments.Sum(x => x.Length) + (EnableInterSegment ? (InterSegmentLength * (Segments.Count > 0 ? Segments.Count - 1 : Segments.Count)) : 0); } + get + { + _lastLength = GetLength(); + return _lastLength; + } } /// @@ -183,8 +189,11 @@ namespace Tango.BL.Entities /// protected virtual void OnLengthChanged() { - RaisePropertyChanged(nameof(Length)); - LengthChanged?.Invoke(this, new EventArgs()); + if (_lastLength != GetLength()) + { + RaisePropertyChanged(nameof(Length)); + LengthChanged?.Invoke(this, new EventArgs()); + } } #endregion @@ -255,6 +264,15 @@ namespace Tango.BL.Entities #endregion + #region Private Methods + + private double GetLength() + { + return Segments.Sum(x => x.Length) + (EnableInterSegment ? (InterSegmentLength * (Segments.Count > 0 ? Segments.Count - 1 : Segments.Count)) : 0); + } + + #endregion + #region Public Methods public BitmapSource CreateSegmentsPie(double width, double height) diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Segment.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Segment.cs index 82596129e..f94a9de41 100644 --- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Segment.cs +++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Segment.cs @@ -14,6 +14,9 @@ namespace Tango.BL.Entities { public partial class Segment { + private double _lastLength; + private LinearGradientBrush _brush; + public override void Save(ObservablesContext context) { for (int i = 0; i < BrushStops.Count; i++) @@ -28,9 +31,10 @@ namespace Tango.BL.Entities { base.RaisePropertyChanged(propName); - if (propName == nameof(Length)) + if (propName == nameof(Length) && _lastLength != Length) { BrushStops.ToList().ForEach(x => x.RaiseOffsetChanged()); + _lastLength = Length; } if (propName == nameof(BrushStops)) @@ -102,20 +106,7 @@ namespace Tango.BL.Entities { get { - GradientStopCollection stops = new GradientStopCollection(); - - foreach (var stop in BrushStops.OrderBy(x => x.StopIndex)) - { - stops.Add(new GradientStop(stop.Color, stop.OffsetPercent / 100d)); - } - - LinearGradientBrush brush = new LinearGradientBrush(); - brush.StartPoint = new Point(0, 0); - brush.EndPoint = new Point(1, 0); - - brush.GradientStops = stops; - - return brush; + return GetSegmentBrush(); } } @@ -160,20 +151,34 @@ namespace Tango.BL.Entities public LinearGradientBrush GetSegmentBrush() { - GradientStopCollection stops = new GradientStopCollection(); - - foreach (var stop in BrushStops.OrderBy(x => x.StopIndex)) + if (_brush == null || _brush.GradientStops.Count != BrushStops.Count) { - stops.Add(new GradientStop(stop.Color, stop.OffsetPercent / 100d)); - } + GradientStopCollection stops = new GradientStopCollection(); - LinearGradientBrush brush = new LinearGradientBrush(); - brush.StartPoint = new Point(0, 0); - brush.EndPoint = new Point(1, 0); + foreach (var stop in BrushStops.OrderBy(x => x.StopIndex)) + { + stops.Add(new GradientStop(stop.Color, stop.OffsetPercent / 100d)); + } - brush.GradientStops = stops; + LinearGradientBrush brush = new LinearGradientBrush(); + brush.StartPoint = new Point(0, 0); + brush.EndPoint = new Point(1, 0); + + brush.GradientStops = stops; - return brush; + _brush = brush; + return brush; + } + else + { + for (int i = 0; i < BrushStops.Count; i++) + { + _brush.GradientStops[i].Color = BrushStops[i].Color; + _brush.GradientStops[i].Offset = BrushStops[i].OffsetPercent / 100d; + } + + return _brush; + } } public System.Drawing.Brush CreateGdiBrush(int width, int height) diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs index 09b5e8f96..50c478acc 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs @@ -21,6 +21,7 @@ namespace Tango.Touch.Controls private TextBox _text_box; private bool _prevent_text_change; private TextBlock _text_block; + private double _lastValue; Regex regex_integer = new Regex(@"^[0-9]*(?:[0-9]*)?$"); Regex regex_double = new Regex(@"^[0-9]*(?:\.[0-9]*)?$"); @@ -179,10 +180,16 @@ namespace Tango.Touch.Controls } } - BindingExpression b = GetBindingExpression(ValueProperty); - if (b != null) + if (Value != _lastValue) { - b.UpdateSource(); + BindingExpression b = GetBindingExpression(ValueProperty); + + if (b != null) + { + b.UpdateSource(); + } + + _lastValue = Value; } } -- cgit v1.3.1 From 36d1edb4f9cc4fbd9c134d3b387bcfec05424537 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 8 Jul 2018 17:55:46 +0300 Subject: Doing some work on PPC + Mirta integration. --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 0 -> 1048576 bytes Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1572864 -> 1572864 bytes .../Tango.MachineStudio.UI/Resources/BuildDate.txt | 2 +- .../Native/Tango.ColorLib/ColorConverter.cpp | 2 +- .../Native/Tango.ColorLib/Tango.ColorLib.vcxproj | 2 +- .../Native/Tango.ColorLib/Utils/GBD.cpp | 110 ++++++++------------- .../Native/Tango.ColorLib/Utils/GBD.h | 6 +- .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 10 +- .../Controls/AsyncAdornerControl.cs | 48 ++------- .../Controls/TwineCatalogControl.xaml.cs | 3 +- .../PPC/Tango.PPC.UI/MainWindow.xaml.cs | 2 +- .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 13 ++- .../PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs | 17 ++++ .../PPC/Tango.PPC.UI/Views/LayoutView.xaml | 2 +- .../PPC/Tango.PPC.UI/Views/LoginView.xaml | 21 +++- .../Referenced Assemblies/mscoree.dll | Bin 0 -> 324096 bytes .../Referenced Assemblies/msvcp140d.dll | Bin 0 -> 742216 bytes .../Referenced Assemblies/ucrtbased.dll | Bin 0 -> 1505600 bytes .../Referenced Assemblies/vcruntime140.dll | Bin 0 -> 83792 bytes .../Referenced Assemblies/vcruntime140d.dll | Bin 0 -> 110424 bytes .../ColorConversion/TangoColorConverter.cs | 10 +- .../Tango.BL/EntitiesExtensions/BrushStop.cs | 2 +- .../Tango.Touch/Controls/LightTouchScrollViewer.cs | 27 ++--- 25 files changed, 128 insertions(+), 149 deletions(-) create mode 100644 Software/DB/PPC/Tango_log.ldf create mode 100644 Software/Visual_Studio/Referenced Assemblies/mscoree.dll create mode 100644 Software/Visual_Studio/Referenced Assemblies/msvcp140d.dll create mode 100644 Software/Visual_Studio/Referenced Assemblies/ucrtbased.dll create mode 100644 Software/Visual_Studio/Referenced Assemblies/vcruntime140.dll create mode 100644 Software/Visual_Studio/Referenced Assemblies/vcruntime140d.dll (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index 73b7beea4..2084948f9 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 new file mode 100644 index 000000000..54bf4553c Binary files /dev/null and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 6c0e0cf74..a5e112137 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 4d6ecff99..ce811b928 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt index 0d0ef0a18..e53f275f3 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt @@ -1 +1 @@ -Sun 07/08/2018 0:25:00.31 +Sun 07/08/2018 16:34:22.22 diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.cpp b/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.cpp index d398453f8..2b8131657 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.cpp +++ b/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.cpp @@ -1267,7 +1267,7 @@ bool Tango::ColorLib::ColorConverter::IsInGamut(double *InLab, SURROUND sur) VectorXd V1(3); VectorXd V2(3); V1 << JLab[0], JLab[1], JLab[2]; - V1 << xCoord[0], xCoord[1], xCoord[2]; + V2 << xCoord[0], xCoord[1], xCoord[2]; double dECMC; m_Conv02->SymmetricaldECMC(V1, V2, dECMC); if (dECMC < dETol) diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj b/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj index bed1cc7bb..506745a12 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj +++ b/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj @@ -23,7 +23,7 @@ {625B2A26-97A9-45C9-8BCF-6BD30F593E17} Win32Proj TangoColorLib - 10.0.16299.0 + 10.0.15063.0 diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/Utils/GBD.cpp b/Software/Visual_Studio/Native/Tango.ColorLib/Utils/GBD.cpp index 0a21d5f25..43132ab20 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/Utils/GBD.cpp +++ b/Software/Visual_Studio/Native/Tango.ColorLib/Utils/GBD.cpp @@ -36,7 +36,7 @@ GBD::~GBD() { } -void GBD::TriangleRayIntersection(double *origin, double *direction, bool intersect, double *xCoor) +void GBD::TriangleRayIntersection(double *origin, double *direction, bool &intersect, double *xCoor) { int i, j; @@ -47,23 +47,36 @@ void GBD::TriangleRayIntersection(double *origin, double *direction, bool inters double t = LargeNumber; double u = t; double v = t; - double *edge1 = new double[3]; - double *edge2 = new double[3]; - double *tvec = new double[3]; // vector from vert0 to ray origin - double *pvec = new double[3]; - double *qvec = new double[3]; + //double *edge1 = new double[3]; + //double *edge2 = new double[3]; + VectorXd tvec(3); + VectorXd qvec(3); + VectorXd pvec(3); + VectorXd edge1(3); + VectorXd edge2(3); + VectorXd VDirection(3); + VDirection << direction[0], direction[1], direction[2]; + //double *tvec = new double[3]; // vector from vert0 to ray origin + //double *pvec = new double[3]; + //double *qvec = new double[3]; double det = 0; bool angleOK = false; for (i = 0; i < m_nTriangles; ++i) { for (j = 0; j < 3; ++j) { - edge1[j] = m_vert1[i][j] - m_vert0[i][j]; - edge2[j] = m_vert2[i][j] - m_vert0[i][j]; - tvec[j] = origin[j] - m_vert0[i][j]; + edge1(j)= m_vert1[i][j] - m_vert0[i][j]; + edge2(j) = m_vert2[i][j] - m_vert0[i][j]; + tvec(j) = origin[j] - m_vert0[i][j]; } - crossProduct(direction, edge2, pvec); + crossProduct(VDirection, edge2, pvec); det = dotProduct(edge1, pvec); + //std::cout << "edge1 " << edge1(0) <<" "<< edge1(1) <<" "<< edge1(2) << "\n"; + //std::cout << "edge2 " << edge2(0) << " " << edge2(1) << " " << edge2(2)<< "\n"; + //std::cout << "tvec " << tvec(0) << " " << tvec(1) << " " << tvec(2) << "\n"; + //std::cout << "crossProduct " << pvec(0) << " " << pvec(1) << " " << pvec(2)<< "\n"; + //std::cout << "Det " << det << "\n"; + switch (rtri) { case TwoSided: @@ -81,9 +94,14 @@ void GBD::TriangleRayIntersection(double *origin, double *direction, bool inters { u = dotProduct(tvec, pvec) / det; crossProduct(tvec, edge1, qvec); - v = dotProduct(direction, qvec) / det; + v = dotProduct(VDirection, qvec) / det; t = dotProduct(edge2, qvec) / det; ok = (angleOK && (u >= -eps) && (v >= -eps) && ((u + v) <= 1 + eps)); + //std::cout << "u " << u << "\n"; + //std::cout << "v " << v << "\n"; + //std::cout << "Qvec " << qvec(0) << " " << qvec(1) << " " << qvec(2) << "\n"; + //std::cout << "t " << t << "\n"; + //std::cout << "OK " << ok << "\n"; } else ok = false; @@ -106,60 +124,11 @@ void GBD::TriangleRayIntersection(double *origin, double *direction, bool inters if (intersect) { for (j = 0; j < 3; ++j) - xCoor[j] = m_vert0[i][j] + edge1[j] * u + edge2[j] * v; - if (edge1 != NULL) - { - delete[]edge1; - edge1 = NULL; - } - if (edge2 != NULL) - { - delete[]edge2; - edge2 = NULL; - } - if (tvec != NULL) - { - delete[]tvec; - tvec = NULL; - } - if (qvec != NULL) - { - delete[]qvec; - qvec = NULL; - } - if (pvec != NULL) - { - delete[]pvec; - pvec = NULL; - } + xCoor[j] = m_vert0[i][j] + edge1(j) * u + edge2(j) * v; return; } } - if (edge1 != NULL) - { - delete[]edge1; - edge1 = NULL; - } - if (edge2 != NULL) - { - delete[]edge2; - edge2 = NULL; - } - if (tvec != NULL) - { - delete[]tvec; - tvec = NULL; - } - if (qvec != NULL) - { - delete[]qvec; - qvec = NULL; - } - if (pvec != NULL) - { - delete[]pvec; - pvec = NULL; - } + return; } @@ -289,23 +258,24 @@ void GBD::InitData(unsigned char* colorTransformBuffer, long colorTransformFileS // dot product of two vectors. -double GBD::dotProduct(double *vect_A, double*vect_B) +double GBD::dotProduct(VectorXd vect_A, VectorXd vect_B) { - int product = 0; + double product = 0.0; // Loop for calculate dot product - int n = sizeof(vect_A); + + int n = vect_A.size(); for (int i = 0; i < n; i++) - product = product + vect_A[i] * vect_B[i]; + product = product + vect_A(i) * vect_B(i); return (product); } // cross product of two vectors -void GBD::crossProduct(double *vect_A, double* vect_B,double *cross_P) +void GBD::crossProduct(VectorXd vect_A, VectorXd vect_B, VectorXd &cross_P) { - cross_P[0] = vect_A[1] * vect_B[2] - vect_A[2] * vect_B[1]; - cross_P[1] = vect_A[0] * vect_B[2] - vect_A[2] * vect_B[0]; - cross_P[2] = vect_A[0] * vect_B[1] - vect_A[1] * vect_B[0]; + cross_P(0) = vect_A(1) * vect_B(2) - vect_A(2) * vect_B(1); + cross_P(1) = -vect_A(0) * vect_B(2) + vect_A(2) * vect_B(0); + cross_P(2) = vect_A(0) * vect_B(1) - vect_A(1) * vect_B(0); return; } diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/Utils/GBD.h b/Software/Visual_Studio/Native/Tango.ColorLib/Utils/GBD.h index 6ef4d3a51..61aadf37a 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/Utils/GBD.h +++ b/Software/Visual_Studio/Native/Tango.ColorLib/Utils/GBD.h @@ -14,7 +14,7 @@ public: int GetNTriangles() { return(m_nTriangles); }; C_RGB_XYZ_Lab getCenter(){ return(m_CenterLab);}; void InitData(unsigned char* colorTransformBuffer, long colorTransformFileSize); - void TriangleRayIntersection(double *origin, double *direction, bool intersect, double *xCoor); + void TriangleRayIntersection(double *origin, double *direction, bool &intersect, double *xCoor); private: int m_prec; int m_nDevChan; @@ -31,8 +31,8 @@ private: void SetNDev_Channels(int nDevChan) { m_nDevChan = nDevChan; }; void SetNTriangles(int nTriangles) { m_nTriangles = nTriangles; }; //void SetCenter( C_RGB_XYZ_Lab CenterLab); - double dotProduct(double *vect_A, double*vect_B); - void crossProduct(double *vect_A, double* vect_B, double *cross_P); + double dotProduct(VectorXd vect_A, VectorXd vect_B); + void crossProduct(VectorXd vect_A, VectorXd vect_B, VectorXd &cross_P); }; #endif 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 260670e08..039c01771 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 @@ -221,7 +221,7 @@ namespace Tango.PPC.Jobs.ViewModels foreach (var stop in brushStops) { - //stop.IsOutOfGamut = TangoColorConverter.IsOutOfGamut(stop); + stop.IsOutOfGamut = TangoColorConverter.IsOutOfGamut(stop); } } } @@ -445,10 +445,10 @@ namespace Tango.PPC.Jobs.ViewModels SpoolTypes = await _db.SpoolTypes.ToListAsync(); Customers = await _db.Customers.Where(x => x.OrganizationGuid == ApplicationManager.Machine.OrganizationGuid).ToListAsync(); - //if (!_check_gamut_thread.IsAlive) - //{ - // _check_gamut_thread.Start(); - //} + if (!_check_gamut_thread.IsAlive) + { + _check_gamut_thread.Start(); + } //Job.Segments.ReloadAsyncIdle((current, total) => //{ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/AsyncAdornerControl.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/AsyncAdornerControl.cs index b20e93ff9..36779c571 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/AsyncAdornerControl.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/AsyncAdornerControl.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Runtime.InteropServices; using System.Text; @@ -23,39 +24,11 @@ namespace Tango.PPC.Common.Controls public partial class AsyncAdornerControl : ContentControl { private bool _loaded; - - public enum GWL - { - ExStyle = -20 - } - - public enum WS_EX - { - Transparent = 0x20, - Layered = 0x80000 - } - - public enum LWA - { - ColorKey = 0x1, - Alpha = 0x2 - } - - [DllImport("user32.dll", EntryPoint = "GetWindowLong")] - public static extern int GetWindowLong(IntPtr hWnd, GWL nIndex); - - [DllImport("user32.dll", EntryPoint = "SetWindowLong")] - public static extern int SetWindowLong(IntPtr hWnd, GWL nIndex, int dwNewLong); - - [DllImport("user32.dll", EntryPoint = "SetLayeredWindowAttributes")] - public static extern bool SetLayeredWindowAttributes(IntPtr hWnd, int crKey, byte alpha, LWA dwFlags); - private Window _window; public AsyncAdornerControl() { Loaded += AsyncAdornerControl_Loaded; - LayoutUpdated += AsyncAdornerControl_LayoutUpdated; IsVisibleChanged += AsyncAdornerControl_IsVisibleChanged; } @@ -71,11 +44,6 @@ namespace Tango.PPC.Common.Controls } } - private void AsyncAdornerControl_LayoutUpdated(object sender, EventArgs e) - { - SyncBounds(); - } - public Type ViewType { get { return (Type)GetValue(ViewTypeProperty); } @@ -94,6 +62,8 @@ namespace Tango.PPC.Common.Controls { if (!this.IsInDesignMode()) { + var startTime = Process.GetCurrentProcess().StartTime; + if (_loaded) return; _loaded = true; @@ -111,6 +81,11 @@ namespace Tango.PPC.Common.Controls Thread thread = new Thread(() => { + if (DateTime.Now < startTime.AddSeconds(5)) + { + Thread.Sleep(5000); + } + _window = new Window(); _window.WindowStyle = WindowStyle.None; _window.ResizeMode = ResizeMode.NoResize; @@ -129,8 +104,6 @@ namespace Tango.PPC.Common.Controls _window.ShowActivated = false; - //FrameworkElement element = Activator.CreateInstance(type) as FrameworkElement; - var cloned = FrameworkElementSerializer.Deserialize(xaml); cloned.DataContext = dc; @@ -138,11 +111,6 @@ namespace Tango.PPC.Common.Controls _window.Show(); - int wl = GetWindowLong(handle, GWL.ExStyle); - wl = wl | 0x80000 | 0x20; - SetWindowLong(handle, GWL.ExStyle, wl); - SetLayeredWindowAttributes(handle, 0, 128, LWA.Alpha); - SyncBounds(); System.Windows.Threading.Dispatcher.Run(); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs index f2a90a454..6df09856e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs @@ -39,7 +39,8 @@ namespace Tango.PPC.Common.Controls { InitializeComponent(); - Loaded += TwineCatalogControl_Loaded; + list.ApplyTemplate(); + list.Loaded += TwineCatalogControl_Loaded; DataContextChanged += (x, y) => { _catalog = DataContext as Catalog; 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 ca26b7761..181c05145 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs @@ -37,7 +37,7 @@ namespace Tango.PPC.UI WindowStyle = WindowStyle.None; ResizeMode = ResizeMode.NoResize; WindowStartupLocation = WindowStartupLocation.Manual; - Topmost = true; // sure? + Topmost = false; // sure? var screens = System.Windows.Forms.Screen.AllScreens; 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 eaf53b993..4f6221144 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 @@ -316,6 +316,11 @@ DB\Tango.mdf PreserveNewest + + DB\Tango_log.ldf + Always + Tango.mdf + Tango.ColorLib.dll PreserveNewest @@ -375,6 +380,12 @@ RD /S /Q "$(TargetDir)zh-Hant\" RD /S /Q "$(TargetDir)bg\" RD /S /Q "$(TargetDir)bn-BD\" RD /S /Q "$(TargetDir)nb-NO\" -RD /S /Q "$(TargetDir)pt-BR\" +RD /S /Q "$(TargetDir)pt-BR\" + +copy /Y "$(SolutionDir)Referenced Assemblies\mscoree.dll" "$(TargetDir)" +copy /Y "$(SolutionDir)Referenced Assemblies\msvcp140d.dll" "$(TargetDir)" +copy /Y "$(SolutionDir)Referenced Assemblies\ucrtbased.dll" "$(TargetDir)" +copy /Y "$(SolutionDir)Referenced Assemblies\vcruntime140.dll" "$(TargetDir)" +copy /Y "$(SolutionDir)Referenced Assemblies\vcruntime140d.dll" "$(TargetDir)" \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs index 293435d0b..dd54873ce 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs @@ -8,6 +8,7 @@ using Tango.PPC.Common; using Tango.PPC.Common.Navigation; using SimpleValidator.Extensions; using System.ComponentModel.DataAnnotations; +using Tango.SharedUI.Helpers; namespace Tango.PPC.UI.ViewModels { @@ -32,6 +33,17 @@ namespace Tango.PPC.UI.ViewModels set { _password = value; RaisePropertyChangedAuto(); } } + private bool _isLoading; + /// + /// Gets or sets a value indicating whether the application is busy with loading modules. + /// + public bool IsLoading + { + get { return _isLoading; } + set { _isLoading = value; RaisePropertyChangedAuto(); } + } + + public LoginViewVM() { LoginCommand = new RelayCommand(Login); @@ -49,10 +61,14 @@ namespace Tango.PPC.UI.ViewModels { if (Validate()) { + IsLoading = true; + UIHelper.DoEvents(); + var user = AuthenticationProvider.Login(Email, Password); if (user == null) { + IsLoading = false; NotificationProvider.ShowWarning("Email or password are incorrect."); } @@ -60,6 +76,7 @@ namespace Tango.PPC.UI.ViewModels { await Task.Delay(500); await NavigationManager.NavigateTo(NavigationView.HomeModule); + IsLoading = false; }; } } 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 7d170d04f..621bfabdb 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml @@ -129,7 +129,7 @@ - + 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 6fbf713e9..74bb85e7d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoginView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoginView.xaml @@ -5,6 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:vm="clr-namespace:Tango.PPC.UI.ViewModels" xmlns:global="clr-namespace:Tango.PPC.UI" + xmlns:controls="clr-namespace:Tango.PPC.Common.Controls;assembly=Tango.PPC.Common" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:keyboard="clr-namespace:Tango.Touch.Keyboard;assembly=Tango.Touch" xmlns:local="clr-namespace:Tango.PPC.UI.Views" @@ -16,14 +17,24 @@ Login to your account - - + + + - Keep me logged in. + Keep me logged in. - LOGIN + LOGIN - Forgot password? + Forgot password? + + + + + + Logging in... + + + diff --git a/Software/Visual_Studio/Referenced Assemblies/mscoree.dll b/Software/Visual_Studio/Referenced Assemblies/mscoree.dll new file mode 100644 index 000000000..9b0a8636d Binary files /dev/null and b/Software/Visual_Studio/Referenced Assemblies/mscoree.dll differ diff --git a/Software/Visual_Studio/Referenced Assemblies/msvcp140d.dll b/Software/Visual_Studio/Referenced Assemblies/msvcp140d.dll new file mode 100644 index 000000000..255a33137 Binary files /dev/null and b/Software/Visual_Studio/Referenced Assemblies/msvcp140d.dll differ diff --git a/Software/Visual_Studio/Referenced Assemblies/ucrtbased.dll b/Software/Visual_Studio/Referenced Assemblies/ucrtbased.dll new file mode 100644 index 000000000..53f9d814f Binary files /dev/null and b/Software/Visual_Studio/Referenced Assemblies/ucrtbased.dll differ diff --git a/Software/Visual_Studio/Referenced Assemblies/vcruntime140.dll b/Software/Visual_Studio/Referenced Assemblies/vcruntime140.dll new file mode 100644 index 000000000..2f8ef29c6 Binary files /dev/null and b/Software/Visual_Studio/Referenced Assemblies/vcruntime140.dll differ diff --git a/Software/Visual_Studio/Referenced Assemblies/vcruntime140d.dll b/Software/Visual_Studio/Referenced Assemblies/vcruntime140d.dll new file mode 100644 index 000000000..4bde6e99b Binary files /dev/null and b/Software/Visual_Studio/Referenced Assemblies/vcruntime140d.dll differ diff --git a/Software/Visual_Studio/Tango.BL/ColorConversion/TangoColorConverter.cs b/Software/Visual_Studio/Tango.BL/ColorConversion/TangoColorConverter.cs index d80accb6a..210d4d3e8 100644 --- a/Software/Visual_Studio/Tango.BL/ColorConversion/TangoColorConverter.cs +++ b/Software/Visual_Studio/Tango.BL/ColorConversion/TangoColorConverter.cs @@ -1,6 +1,7 @@ using Google.Protobuf; using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices; @@ -23,6 +24,7 @@ namespace Tango.BL.ColorConversion NativePMR nativePMR = new NativePMR(Convert); ConversionOutput output = nativePMR.Invoke(conversionInput); + return output; } @@ -87,16 +89,12 @@ namespace Tango.BL.ColorConversion conversionInput.ColorSpace = (PMR.ColorLab.ColorSpace)brushStop.ColorSpace.Code; conversionInput.InputCoordinates = new InputCoordinates(); - conversionInput.SegmentLength = 10; //TODO: for gradient ? + conversionInput.SegmentLength = brushStop.Segment.Length; //TODO: for gradient ? conversionInput.InputCoordinates.Red = Math.Max(brushStop.Red, 1); conversionInput.InputCoordinates.Green = Math.Max(brushStop.Green, 1); conversionInput.InputCoordinates.Blue = Math.Max(brushStop.Blue, 1); - //conversionInput.InputCoordinates.Red = 50; - //conversionInput.InputCoordinates.Green = 100; - //conversionInput.InputCoordinates.Blue = 200; - conversionInput.InputCoordinates.L = brushStop.L; conversionInput.InputCoordinates.A = brushStop.A; conversionInput.InputCoordinates.B = brushStop.B; @@ -110,7 +108,7 @@ namespace Tango.BL.ColorConversion conversionInput.ThreadA = 2.2555;//brushStop.Segment.Job.Rml.MediaColor.A; conversionInput.ThreadB = -10.9325;//brushStop.Segment.Job.Rml.MediaColor.B; - conversionInput.ForwardData = ByteString.CopyFrom(File.ReadAllBytes(@"D:\Development\Tango\Software\ColorData\CCT\test.cct")); //ByteString.CopyFrom(brushStop.Segment.Job.Rml.Ccts.FirstOrDefault().ForwardData); + conversionInput.ForwardData = ByteString.CopyFrom(brushStop.Segment.Job.Rml.Ccts.FirstOrDefault().ForwardData); foreach (var ids_pack in brushStop.Segment.Job.Machine.Configuration.IdsPacks.OrderBy(x => x.PackIndex)) { diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs index fa5dc4acb..1eda2b300 100644 --- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs +++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs @@ -369,7 +369,7 @@ namespace Tango.BL.Entities _b = lab.B; //TODO: Remove this.. - IsOutOfGamut = _red > 250; + //IsOutOfGamut = _red > 250; }); } diff --git a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs index 46c49efd2..74b8458bf 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs @@ -711,23 +711,26 @@ namespace Tango.Touch.Controls public void ScrollToPosition(double y) { - if (_grid_content.ActualHeight > _border_viewport.ActualHeight) + if (_grid_content != null) { - if (y < 0) + if (_grid_content.ActualHeight > _border_viewport.ActualHeight) { - y = 0; - } - if (-y - _border_viewport.ActualHeight < -_grid_content.ActualHeight) - { - y = (_grid_content.ActualHeight - _border_viewport.ActualHeight); - } + if (y < 0) + { + y = 0; + } + if (-y - _border_viewport.ActualHeight < -_grid_content.ActualHeight) + { + y = (_grid_content.ActualHeight - _border_viewport.ActualHeight); + } - _grid_content.BeginAnimation(Grid.MarginProperty, null); + _grid_content.BeginAnimation(Grid.MarginProperty, null); - _grid_content.Margin = new Thickness(0, -y, 0, 0); - } + _grid_content.Margin = new Thickness(0, -y, 0, 0); + } - SnapContentToBounds(); + SnapContentToBounds(); + } } public double GetScrollPosition() -- cgit v1.3.1