From 48f781d037a83c51fdd555fb6c9d1c2b4e424efe Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 11 Dec 2018 19:43:35 +0200 Subject: Working on PPC hotspot and external bridge. --- .../Tango.PPC.MachineSettings.csproj | 6 +- .../ViewModels/MainViewVM.cs | 97 +++++++++++++++++++++- .../Tango.PPC.MachineSettings/Views/MainView.xaml | 13 ++- 3 files changed, 109 insertions(+), 7 deletions(-) (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj index 9d44a6a63..e8d5b49d6 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj @@ -121,6 +121,10 @@ {b112d89a-a106-41ae-a0c1-4abc84c477f5} Tango.DragAndDrop + + {4206ac58-3b57-4699-8835-90bf6db01a61} + Tango.Integration + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} Tango.Logging @@ -160,7 +164,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs index 6bbe1c47b..267012e2e 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.ComponentModel; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -43,6 +44,33 @@ namespace Tango.PPC.MachineSettings.ViewModels set { _selectedJobTypes = value; RaisePropertyChangedAuto(); } } + private bool _enableHotSpot; + public bool EnableHotSpot + { + get { return _enableHotSpot; } + set { _enableHotSpot = value; RaisePropertyChangedAuto(); OnEnableHotSpotChanged(); } + } + + private String _hotSpotPassword; + public String HotSpotPassword + { + get { return _hotSpotPassword; } + set { _hotSpotPassword = value; RaisePropertyChangedAuto(); } + } + + private bool _enableExternalBridge; + public bool EnableExternalBridge + { + get { return _enableExternalBridge; } + set { _enableExternalBridge = value; RaisePropertyChangedAuto(); OnEnableExternalBridgeChanged(); } + } + + private String _externalBridgePassword; + public String ExternalBridgePassword + { + get { return _externalBridgePassword; } + set { _externalBridgePassword = value; RaisePropertyChangedAuto(); } + } #endregion @@ -73,10 +101,25 @@ namespace Tango.PPC.MachineSettings.ViewModels private async void Save() { - Machine.SupportedJobTypes = SelectedJobTypes.SynchedSource.ToList(); - Machine.ShallowCopyTo(MachineProvider.Machine); - await MachineProvider.SaveMachine(); - await NavigationManager.NavigateBack(); + if (Validate()) + { + Machine.SupportedJobTypes = SelectedJobTypes.SynchedSource.ToList(); + Machine.ShallowCopyTo(MachineProvider.Machine); + + Settings.EnableHotSpot = EnableHotSpot; + Settings.HotSpotPassword = HotSpotPassword; + Settings.EnableExternalBridge = EnableExternalBridge; + Settings.ExternalBridgePassword = ExternalBridgePassword; + Settings.Save(); + + await MachineProvider.SaveMachine(); + await NavigationManager.NavigateBack(); + } + } + + protected override void OnValidating() + { + base.OnValidating(); } /// @@ -94,8 +137,54 @@ namespace Tango.PPC.MachineSettings.ViewModels Machine = new Machine(); MachineProvider.Machine.ShallowCopyTo(Machine); RaisePropertyChanged(nameof(Machine)); + _enableHotSpot = ConnectivityProvider.IsHotspotActive; + RaisePropertyChanged(nameof(EnableHotSpot)); + SelectedJobTypes = new SelectedObjectCollection(Enum.GetValues(typeof(JobTypes)).Cast().ToObservableCollection(), Machine.SupportedJobTypes.ToObservableCollection()); } + + private async void OnEnableHotSpotChanged() + { + if (EnableHotSpot) + { + if (HotSpotPassword == null || HotSpotPassword.Length < 8 || HotSpotPassword.Length > 16) + { + await NotificationProvider.ShowError("Hot spot requires a password of 8 to 16 characters."); + _enableHotSpot = false; + RaisePropertyChanged(nameof(EnableHotSpot)); + return; + } + + try + { + await ConnectivityProvider.EnableHotSpot(HotSpotPassword); + } + catch + { + await NotificationProvider.ShowError("An error occurred while trying to activate the hot spot network. Please check your device settings and try again."); + _enableHotSpot = false; + } + } + else + { + try + { + await ConnectivityProvider.DisableHotSpot(); + } + catch + { + await NotificationProvider.ShowError("An error occurred while trying to deactivate the hot spot network."); + _enableHotSpot = true; + } + } + + RaisePropertyChanged(nameof(EnableHotSpot)); + } + + private void OnEnableExternalBridgeChanged() + { + ExternalBridgeService.Enabled = EnableExternalBridge; + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index 4823f0811..7a64891c9 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -43,6 +43,15 @@ + + + Enable Hot Spot + + + + Hot Spot Password + + @@ -50,10 +59,10 @@ Enable External Bridge Service - + External Bridge Password - + -- cgit v1.3.1 From d9a89773f2f283fbf5596799dd4d50d231817203 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 12 Dec 2018 18:23:24 +0200 Subject: IHotSpot Provider & IRemoteAssistance Provider. --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 20578304 -> 20578304 bytes Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 20578304 -> 20578304 bytes .../Build/Shortcuts/Machine Emulator.lnk | Bin 1445 -> 1471 bytes .../Build/Shortcuts/Machine Studio.lnk | Bin 1516 -> 1516 bytes .../Build/Shortcuts/Proto Compiler GUI.lnk | Bin 1444 -> 1464 bytes .../Views/JobView.xaml | 6 +- .../ViewModels/MainViewVM.cs | 54 +++++++++- .../Tango.PPC.MachineSettings/Views/MainView.xaml | 8 ++ .../Connectivity/IConnectivityProvider.cs | 18 ---- .../HotSpot/DefaultHotSpotProvider.cs | 114 ++++++++++++++++++++ .../Tango.PPC.Common/HotSpot/IHotSpotProvider.cs | 32 ++++++ .../MachineSetup/MachineSetupManager.cs | 88 ++++++++++------ .../PPC/Tango.PPC.Common/PPCSettings.cs | 5 + .../PPC/Tango.PPC.Common/PPCViewModel.cs | 14 +++ .../DefaultRemoteAssistanceProvider.cs | 115 +++++++++++++++++++++ .../RemoteAssistance/IRemoteAssistanceProvider.cs | 39 +++++++ .../PPC/Tango.PPC.Common/Scripting/CmdCommand.cs | 1 + .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 6 +- .../Connectivity/DefaultConnectivityProvider.cs | 57 ---------- .../PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs | 2 +- .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 6 +- .../PPC/Tango.PPC.UI/ViewModelLocator.cs | 6 ++ .../Visual_Studio/PPC/Tango.PPC.UI/app.manifest | 76 ++++++++++++++ .../PPC/Tango.PPC.Updater/Tango.PPC.Updater.csproj | 4 + .../PPC/Tango.PPC.Updater/app.manifest | 76 ++++++++++++++ 27 files changed, 612 insertions(+), 115 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/HotSpot/DefaultHotSpotProvider.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/HotSpot/IHotSpotProvider.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/DefaultRemoteAssistanceProvider.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/IRemoteAssistanceProvider.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Updater/app.manifest (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index 3c8c5f764..8f59fd29d 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index 7acf221ab..c8d82d51f 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 6ebeed357..9ce9473be 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 266c1d998..63d4bebf6 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk index 2577f9a96..83636b215 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk index fe3b0d60c..fdcc9c9f3 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk index a1cb5f5c1..bbe8a4be2 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk and b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index b9c27e4f9..4fba0cc0b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -740,7 +740,11 @@ Segment Length - + + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs index 267012e2e..7c6bed928 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -72,6 +72,13 @@ namespace Tango.PPC.MachineSettings.ViewModels set { _externalBridgePassword = value; RaisePropertyChangedAuto(); } } + private bool _enableRemoteAssistance; + public bool EnableRemoteAssistance + { + get { return _enableRemoteAssistance; } + set { _enableRemoteAssistance = value; RaisePropertyChangedAuto(); OnEnableRemoteAssistanceChanged(); } + } + #endregion #region Commands @@ -137,13 +144,54 @@ namespace Tango.PPC.MachineSettings.ViewModels Machine = new Machine(); MachineProvider.Machine.ShallowCopyTo(Machine); RaisePropertyChanged(nameof(Machine)); - _enableHotSpot = ConnectivityProvider.IsHotspotActive; + + _enableHotSpot = HotSpotProvider.IsEnabled; RaisePropertyChanged(nameof(EnableHotSpot)); + HotSpotPassword = Settings.HotSpotPassword; + + _enableExternalBridge = ExternalBridgeService.Enabled; + RaisePropertyChanged(nameof(EnableExternalBridge)); + + ExternalBridgePassword = Settings.ExternalBridgePassword; + + _enableRemoteAssistance = RemoteAssistanceProvider.IsEnabled; + RaisePropertyChanged(nameof(EnableRemoteAssistance)); + SelectedJobTypes = new SelectedObjectCollection(Enum.GetValues(typeof(JobTypes)).Cast().ToObservableCollection(), Machine.SupportedJobTypes.ToObservableCollection()); } + private async void OnEnableRemoteAssistanceChanged() + { + if (EnableRemoteAssistance) + { + try + { + await RemoteAssistanceProvider.EnableRemoteAssistance(); + } + catch + { + await NotificationProvider.ShowError("An error occurred while trying to activate the remote assistance service. Please check your device settings and try again."); + _enableRemoteAssistance = false; + } + } + else + { + try + { + await RemoteAssistanceProvider.DisableRemoteAssistance(); + } + catch + { + await NotificationProvider.ShowError("An error occurred while trying to deactivate the remote assistance service. Please check your device settings and try again."); + _enableRemoteAssistance = true; + } + } + + RaisePropertyChanged(nameof(EnableRemoteAssistance)); + } + private async void OnEnableHotSpotChanged() { if (EnableHotSpot) @@ -158,7 +206,7 @@ namespace Tango.PPC.MachineSettings.ViewModels try { - await ConnectivityProvider.EnableHotSpot(HotSpotPassword); + await HotSpotProvider.EnableHotSpot(HotSpotPassword); } catch { @@ -170,7 +218,7 @@ namespace Tango.PPC.MachineSettings.ViewModels { try { - await ConnectivityProvider.DisableHotSpot(); + await HotSpotProvider.DisableHotSpot(); } catch { diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index 7a64891c9..337647790 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -108,6 +108,14 @@ + + + + + Enable Remote Assistance + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/IConnectivityProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/IConnectivityProvider.cs index 077f05110..85c25128a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/IConnectivityProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/IConnectivityProvider.cs @@ -79,23 +79,5 @@ namespace Tango.PPC.Common.Connectivity /// The network. /// void Disconnect(WiFiNetwork network); - - /// - /// Gets a value indicating whether the hot spot network is active. - /// - bool IsHotspotActive { get; } - - /// - /// Enables the hot spot. - /// - /// The password. - /// - Task EnableHotSpot(String password); - - /// - /// Disables the hot spot. - /// - /// - Task DisableHotSpot(); } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/HotSpot/DefaultHotSpotProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/HotSpot/DefaultHotSpotProvider.cs new file mode 100644 index 000000000..1126a84bc --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/HotSpot/DefaultHotSpotProvider.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.PPC.Common.Application; +using Tango.PPC.Common.Connection; +using Tango.PPC.Common.Scripting; +using Tango.Settings; + +namespace Tango.PPC.Common.HotSpot +{ + /// + /// Represents the default hot spot provider. + /// + /// + /// + public class DefaultHotSpotProvider : ExtendedObject, IHotSpotProvider + { + private IMachineProvider _machineProvider; + + private bool _isEnabled; + /// + /// Gets a value indicating whether the hot spot network is active. + /// + public bool IsEnabled + { + get { return _isEnabled; } + private set { _isEnabled = value; RaisePropertyChangedAuto(); } + } + + /// + /// Initializes a new instance of the class. + /// + /// The application manager. + /// The machine provider. + public DefaultHotSpotProvider(IPPCApplicationManager applicationManager, IMachineProvider machineProvider) + { + _machineProvider = machineProvider; + applicationManager.ApplicationReady += ApplicationManager_ApplicationReady; + } + + /// + /// Handles the ApplicationReady event of the ApplicationManager. + /// + /// The source of the event. + /// The instance containing the event data. + private void ApplicationManager_ApplicationReady(object sender, EventArgs e) + { + Task.Factory.StartNew(async () => + { + var settings = SettingsManager.Default.GetOrCreate(); + + if (settings.EnableHotSpot) + { + try + { + await EnableHotSpot(settings.HotSpotPassword); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error starting on application startup."); + } + } + }); + } + + /// + /// Enables the hot spot. + /// + /// The password. + /// + public async Task EnableHotSpot(string password) + { + if (!IsEnabled) + { + try + { + CmdCommand command = new CmdCommand("netsh", $"wlan set hostednetwork mode=allow ssid='{"Tango_" + _machineProvider.Machine.SerialNumber}' key='{password}'"); + await command.Run(); + IsEnabled = true; + } + catch (Exception ex) + { + LogManager.Log(ex, "Error activating hot spot."); + throw; + } + } + } + + /// + /// Disables the hot spot. + /// + /// + public async Task DisableHotSpot() + { + if (IsEnabled) + { + try + { + CmdCommand command = new CmdCommand("netsh", "wlan stop hosted network"); + await command.Run(); + IsEnabled = false; + } + catch (Exception ex) + { + LogManager.Log(ex, "Error deactivating hot spot."); + throw; + } + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/HotSpot/IHotSpotProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/HotSpot/IHotSpotProvider.cs new file mode 100644 index 000000000..1a4dabae3 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/HotSpot/IHotSpotProvider.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Common.HotSpot +{ + /// + /// Represents a hot-spot network provider. + /// + public interface IHotSpotProvider + { + /// + /// Gets a value indicating whether the hot spot network is active. + /// + bool IsEnabled { get; } + + /// + /// Enables the hot spot. + /// + /// The password. + /// + Task EnableHotSpot(String password); + + /// + /// Disables the hot spot. + /// + /// + Task DisableHotSpot(); + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs index 3c70e0744..3d816c89a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -74,14 +74,25 @@ namespace Tango.PPC.Common.MachineSetup { LogManager.Log($"Starting machine setup for serial number {serialNumber}..."); - //Connecting to machine... - LogManager.Log("Initiating machine connection..."); + IMachineOperator op = null; - UpdateProgress("Connecting to machine", "Connecting..."); - IMachineOperator op = await DefaultMachineProvider.CreateMinimalMachineOperator((msg) => + var demoMode = SettingsManager.Default.GetOrCreate().DemoMode; + + if (!demoMode) { - UpdateProgress("Connecting to machine", msg); - }); + //Connecting to machine... + LogManager.Log("Initiating machine connection..."); + + UpdateProgress("Connecting to machine", "Connecting..."); + op = await DefaultMachineProvider.CreateMinimalMachineOperator((msg) => + { + UpdateProgress("Connecting to machine", msg); + }); + } + else + { + LogManager.Log("Application in demo mode. Skipping machine connection..."); + } //Connect to machine service and get matching packages for this machine. UpdateProgress("Downloading software package", "Connecting to machine service..."); @@ -238,39 +249,50 @@ namespace Tango.PPC.Common.MachineSetup throw LogManager.Log(ex, "Setup manager error while trying to synchronize database."); } - //Updating firmware - UpdateProgress("Updating Firmware", "Connecting to firmware device..."); - LogManager.Log(""); - LogManager.Log("-------------------------------------------------------------------------"); - LogManager.Log("Updating Firmware..."); - - UpdateProgress("Updating Firmware", "Loading firmware package..."); - var tfpPath = Path.Combine(_newPackageTempFolder, "firmware_package.tfp"); - var stream = new FileStream(tfpPath, FileMode.Open); - var handler = await op.UpgradeFirmware(stream); - handler.Failed += (_, ex) => + if (!demoMode) { - stream.Dispose(); - result.SetException(ex); - }; - handler.Completed += (_, __) => + //Updating firmware + UpdateProgress("Updating Firmware", "Connecting to firmware device..."); + LogManager.Log(""); + LogManager.Log("-------------------------------------------------------------------------"); + LogManager.Log("Updating Firmware..."); + + UpdateProgress("Updating Firmware", "Loading firmware package..."); + var tfpPath = Path.Combine(_newPackageTempFolder, "firmware_package.tfp"); + var stream = new FileStream(tfpPath, FileMode.Open); + var handler = await op.UpgradeFirmware(stream); + handler.Failed += (_, ex) => + { + stream.Dispose(); + result.SetException(ex); + }; + handler.Completed += (_, __) => + { + UpdateProgress("Updating Firmware", "Firmware update completed successfully."); + stream.Dispose(); + result.SetResult(new MachineSetupResult() + { + UpdatePackagePath = _newPackageTempFolder, + }); + }; + handler.Canceled += (_, __) => + { + stream.Dispose(); + result.SetException(new Exception("The operation has been canceled.")); + }; + handler.Progress += (_, e) => + { + UpdateProgress("Updating Firmware", e.Message, false, e.Current, e.Total); + }; + } + else { - UpdateProgress("Updating Firmware", "Firmware update completed successfully."); - stream.Dispose(); + LogManager.Log("Application in demo mode. Skipping firmware upgrade..."); result.SetResult(new MachineSetupResult() { UpdatePackagePath = _newPackageTempFolder, }); - }; - handler.Canceled += (_, __) => - { - stream.Dispose(); - result.SetException(new Exception("The operation has been canceled.")); - }; - handler.Progress += (_, e) => - { - UpdateProgress("Updating Firmware", e.Message, false, e.Current, e.Total); - }; + } } catch (Exception ex) { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index b6ab9c163..142c3afe9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -80,6 +80,11 @@ namespace Tango.PPC.Common /// public String HotSpotPassword { get; set; } + /// + /// Gets or sets a value indicating whether to enable team viewer service. + /// + public bool EnableRemoteAssistance { get; set; } + /// /// Initializes a new instance of the class. /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs index dc67d2137..289683855 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs @@ -11,9 +11,11 @@ using Tango.PPC.Common.Connection; using Tango.PPC.Common.Connectivity; using Tango.PPC.Common.EventLogging; using Tango.PPC.Common.ExternalBridge; +using Tango.PPC.Common.HotSpot; using Tango.PPC.Common.Navigation; using Tango.PPC.Common.Notifications; using Tango.PPC.Common.Printing; +using Tango.PPC.Common.RemoteAssistance; using Tango.PPC.Common.Storage; using Tango.Settings; using Tango.SharedUI; @@ -83,6 +85,18 @@ namespace Tango.PPC.Common [TangoInject] public IConnectivityProvider ConnectivityProvider { get; set; } + /// + /// Gets or sets the hot spot provider. + /// + [TangoInject] + public IHotSpotProvider HotSpotProvider { get; set; } + + /// + /// Gets or sets the remote assistance provider. + /// + [TangoInject] + public IRemoteAssistanceProvider RemoteAssistanceProvider { get; set; } + /// /// Gets or sets the storage provider. /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/DefaultRemoteAssistanceProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/DefaultRemoteAssistanceProvider.cs new file mode 100644 index 000000000..53596544a --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/DefaultRemoteAssistanceProvider.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.PPC.Common.Connection; +using Tango.PPC.Common.Scripting; + +namespace Tango.PPC.Common.RemoteAssistance +{ + /// + /// Represents the default remote assistance provider. + /// + /// + /// + public class DefaultRemoteAssistanceProvider : ExtendedObject, IRemoteAssistanceProvider + { + private IMachineProvider _machineProvider; + + private bool _isEnabled; + /// + /// Gets a value indicating whether the remote assistance service is enabled. + /// + public bool IsEnabled + { + get { return _isEnabled; } + private set { _isEnabled = value; RaisePropertyChangedAuto(); } + } + + /// + /// Initializes a new instance of the class. + /// + /// The machine provider. + public DefaultRemoteAssistanceProvider(IMachineProvider machineProvider) + { + _machineProvider = machineProvider; + } + + /// + /// Enables the remote assistance. + /// + /// + public async Task EnableRemoteAssistance() + { + if (!IsEnabled) + { + try + { + CmdCommand command = new CmdCommand("sc.exe", "config TeamViewer start=auto"); + command.Timeout = TimeSpan.FromSeconds(10); + await command.Run(); + + command = new CmdCommand("net", "start TeamViewer"); + command.Timeout = TimeSpan.FromSeconds(10); + await command.Run(); + + IsEnabled = true; + } + catch (Exception ex) + { + LogManager.Log(ex, "Error enabling remote assistance."); + throw; + } + } + } + + /// + /// Disables the remote assistance. + /// + /// + public async Task DisableRemoteAssistance() + { + if (IsEnabled) + { + try + { + CmdCommand command = new CmdCommand("sc.exe", "config TeamViewer start=disabled"); + command.Timeout = TimeSpan.FromSeconds(10); + await command.Run(); + + command = new CmdCommand("net", "stop TeamViewer"); + command.Timeout = TimeSpan.FromSeconds(10); + await command.Run(); + IsEnabled = false; + } + catch (Exception ex) + { + LogManager.Log(ex, "Error disabling remote assistance."); + throw; + } + } + } + + /// + /// Installs the remote assistance. + /// + /// Name of the group. + /// Name of the computer. + /// + public async Task InstallRemoteAssistance(string groupName, string computerName) + { + try + { + CmdCommand command = new CmdCommand("msiexec.exe", $"/i \"C:\\Program Files(x86)\\TeamViewer\\TeamViewer_Host.msi\" /qn CUSTOMCONFIGID=ke43ann APITOKEN=4765529-gon1LwO1N1TTrlLI21ji ASSIGNMENTOPTIONS=\" --reassign --alias {"TANGO-" + _machineProvider.Machine.SerialNumber} --grant-easy-access\""); + await command.Run(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error installing remote assistance."); + throw; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/IRemoteAssistanceProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/IRemoteAssistanceProvider.cs new file mode 100644 index 000000000..288b5c652 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/RemoteAssistance/IRemoteAssistanceProvider.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Common.RemoteAssistance +{ + /// + /// Represents a remote assistance provider. + /// + public interface IRemoteAssistanceProvider + { + /// + /// Gets a value indicating whether the remote assistance service is enabled. + /// + bool IsEnabled { get; } + + /// + /// Enables the remote assistance. + /// + /// + Task EnableRemoteAssistance(); + + /// + /// Disables the remote assistance. + /// + /// + Task DisableRemoteAssistance(); + + /// + /// Installs the remote assistance. + /// + /// Name of the group. + /// Name of the computer. + /// + Task InstallRemoteAssistance(String groupName, String computerName); + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Scripting/CmdCommand.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Scripting/CmdCommand.cs index 2ee0d83d9..abae98f06 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Scripting/CmdCommand.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Scripting/CmdCommand.cs @@ -29,6 +29,7 @@ namespace Tango.PPC.Common.Scripting _process.StartInfo.RedirectStandardError = true; _process.StartInfo.RedirectStandardOutput = true; _process.StartInfo.Arguments = arguments; + _process.StartInfo.Verb = "runas"; Arguments = arguments; } 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 b9d9c7620..2f95d5060 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 @@ -128,6 +128,8 @@ + + @@ -158,6 +160,8 @@ + + @@ -326,7 +330,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs index fbc619e12..a05e66f10 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs @@ -138,18 +138,6 @@ namespace Tango.PPC.UI.Connectivity { await Connect(auto_connect_network); } - - if (settings.EnableHotSpot) - { - try - { - await EnableHotSpot(settings.HotSpotPassword); - } - catch (Exception ex) - { - LogManager.Log(ex, "Error starting on application startup."); - } - } }); } @@ -289,50 +277,5 @@ namespace Tango.PPC.UI.Connectivity IsConnected = connected; ConnectionStateChanged?.Invoke(this, new ConnectionStateEventArgs() { IsConnected = connected }); } - - /// - /// Enables the hot spot. - /// - /// The password. - /// - public async Task EnableHotSpot(string password) - { - if (!IsHotspotActive) - { - try - { - CmdCommand command = new CmdCommand("netsh", $"wlan set hostednetwork mode=allow ssid='{"Tango_" + _machineProvider.Machine.SerialNumber}' key='{password}'"); - await command.Run(); - IsHotspotActive = true; - } - catch (Exception ex) - { - LogManager.Log(ex, "Error activating hot spot."); - throw; - } - } - } - - /// - /// Disables the hot spot. - /// - /// - public async Task DisableHotSpot() - { - if (IsHotspotActive) - { - try - { - CmdCommand command = new CmdCommand("netsh", "wlan stop hosted network"); - await command.Run(); - IsHotspotActive = false; - } - catch (Exception ex) - { - LogManager.Log(ex, "Error deactivating hot spot."); - throw; - } - } - } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index c21f513ae..740b0d203 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango PPC Application")] -[assembly: AssemblyVersion("2.0.13.1608")] +[assembly: AssemblyVersion("2.0.15.1608")] 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 786eca0c9..406568f71 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 @@ -50,6 +50,9 @@ prompt 4 + + app.manifest + ..\..\packages\ControlzEx.3.0.2.4\lib\net45\ControlzEx.dll @@ -253,6 +256,7 @@ ResXFileCodeGenerator Resources.Designer.cs + SettingsSingleFileGenerator @@ -468,7 +472,7 @@ del "$(TargetDir)firmware_package.tfp" - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs index 11751d822..645456216 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs @@ -10,12 +10,14 @@ using Tango.PPC.Common.Connectivity; using Tango.PPC.Common.Diagnostics; using Tango.PPC.Common.EventLogging; using Tango.PPC.Common.ExternalBridge; +using Tango.PPC.Common.HotSpot; using Tango.PPC.Common.MachineSetup; using Tango.PPC.Common.MachineUpdate; using Tango.PPC.Common.Modules; using Tango.PPC.Common.Navigation; using Tango.PPC.Common.Notifications; using Tango.PPC.Common.Printing; +using Tango.PPC.Common.RemoteAssistance; using Tango.PPC.Common.Storage; using Tango.PPC.Common.Threading; using Tango.PPC.UI.Authentication; @@ -60,6 +62,8 @@ namespace Tango.PPC.UI TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); + TangoIOC.Default.Unregister(); + TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); TangoIOC.Default.Register(new DefaultDispatcherProvider(Application.Current.Dispatcher)); @@ -77,6 +81,8 @@ namespace Tango.PPC.UI TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); + TangoIOC.Default.Register(); + TangoIOC.Default.Register(); TangoIOC.Default.Register(); //TangoIOC.Default.Register(new TeamFoundationServiceExtendedClient("https://twinetfs.visualstudio.com", String.Empty, "szzfokrceo4rhd4eqi5qpmxn3pa5iwl3q7tlqd36l2m7smz2ynoa")); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest new file mode 100644 index 000000000..d72e75011 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Updater/Tango.PPC.Updater.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Updater/Tango.PPC.Updater.csproj index 11cc17854..3f232c4d2 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Updater/Tango.PPC.Updater.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Updater/Tango.PPC.Updater.csproj @@ -33,6 +33,9 @@ prompt 4 + + app.manifest + @@ -87,6 +90,7 @@ ResXFileCodeGenerator Resources.Designer.cs + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Updater/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.Updater/app.manifest new file mode 100644 index 000000000..d72e75011 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Updater/app.manifest @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.3.1 From b5692b2f28929e7473ec73be0a1b5124149b8e2e Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 25 Dec 2018 14:32:42 +0200 Subject: Some work on PPC and database! --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 20578304 -> 53673984 bytes .../SQLExaminer Projects/Override Tables.sdeproj | 8 +- .../SQLExaminer Projects/Provision Machine.sdeproj | 14 +- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 20578304 -> 20578304 bytes .../Tango.PPC.Jobs/Dialogs/JobCreationView.xaml | 84 ++++++++++++ .../Tango.PPC.Jobs/Dialogs/JobCreationView.xaml.cs | 34 +++++ .../Tango.PPC.Jobs/Dialogs/JobCreationViewVM.cs | 66 +++++++++ .../Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml | 49 ------- .../Dialogs/JobTypePickerView.xaml.cs | 34 ----- .../Tango.PPC.Jobs/Dialogs/JobTypePickerViewVM.cs | 56 -------- .../Modules/Tango.PPC.Jobs/JobsModuleSettings.cs | 11 ++ .../Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj | 10 +- .../Tango.PPC.Jobs/ViewModels/JobsViewVM.cs | 40 +++++- .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 13 +- .../ViewModels/MainViewVM.cs | 9 ++ .../Tango.PPC.MachineSettings/Views/MainView.xaml | 32 ++++- .../PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs | 2 +- .../PPC/Tango.PPC.UI/Views/LayoutView.xaml | 4 +- .../Visual_Studio/Tango.BL/Entities/ColorSpace.cs | 30 +++++ .../Visual_Studio/Tango.BL/Entities/Machine.cs | 67 +++++---- .../Tango.BL/EntitiesExtensions/Machine.cs | 36 +++++ .../ExtensionMethods/ColorSpacesExtensions.cs | 19 +++ .../Tango.BL/ObservablesStaticCollections.cs | 62 ++++----- Software/Visual_Studio/Tango.BL/Tango.BL.csproj | 3 +- .../Tango.DAL.Remote/DB/COLOR_SPACES.cs | 1 + .../Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs | 2 +- .../Tango.DAL.Remote/DB/RemoteADO.edmx | 9 +- .../Tango.DAL.Remote/DB/RemoteADO.edmx.diagram | 150 ++++++++++----------- .../ExaminerConfigurationBuilder.cs | 15 ++- .../SQLExaminer/Configurations/OverrideData.xml | Bin 79236 -> 79462 bytes .../Configurations/ProvisionMachine.xml | Bin 61232 -> 61872 bytes .../Tango.Touch/Controls/LightTouchDataGrid.cs | 31 +++-- .../Tango.Touch/Controls/LightTouchDataGridRow.cs | 7 +- .../Tango.Touch/Controls/TouchStaticListBox.cs | 8 +- .../Tango.Touch/Resources/Colors.xaml | 2 +- 37 files changed, 573 insertions(+), 335 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobCreationView.xaml create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobCreationView.xaml.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobCreationViewVM.cs delete mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml delete mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml.cs delete mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerViewVM.cs create mode 100644 Software/Visual_Studio/Tango.BL/ExtensionMethods/ColorSpacesExtensions.cs (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index 0652c7b97..2d30577a7 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index 4897c62e5..591c53bdf 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/SQLExaminer Projects/Override Tables.sdeproj b/Software/DB/SQLExaminer Projects/Override Tables.sdeproj index 932ea95fb..f18e1d4b8 100644 --- a/Software/DB/SQLExaminer Projects/Override Tables.sdeproj +++ b/Software/DB/SQLExaminer Projects/Override Tables.sdeproj @@ -176,6 +176,7 @@ + @@ -635,11 +636,11 @@ - + @@ -677,6 +678,9 @@ + + + @@ -834,6 +838,8 @@ + + diff --git a/Software/DB/SQLExaminer Projects/Provision Machine.sdeproj b/Software/DB/SQLExaminer Projects/Provision Machine.sdeproj index 267cf1abb..91e2a0ab8 100644 --- a/Software/DB/SQLExaminer Projects/Provision Machine.sdeproj +++ b/Software/DB/SQLExaminer Projects/Provision Machine.sdeproj @@ -176,6 +176,7 @@ + @@ -635,11 +636,11 @@ - + @@ -677,6 +678,9 @@ + + + @@ -834,6 +838,8 @@ + + @@ -1405,7 +1411,9 @@ WHERE MACHINES.SERIAL_NUMBER = '@' + + @@ -1417,6 +1425,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@' + @@ -1473,7 +1482,9 @@ WHERE MACHINES.SERIAL_NUMBER = '@' + + @@ -1485,6 +1496,7 @@ WHERE MACHINES.SERIAL_NUMBER = '@' + diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 1ee39ad51..0aae88c19 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 a331de793..ad98e5f9b 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobCreationView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobCreationView.xaml new file mode 100644 index 000000000..1f48474aa --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobCreationView.xaml @@ -0,0 +1,84 @@ + + + + + + + + + + + + CANCEL + CREATE + + + + NEW JOB + Please select the job application and color space/catalog and press 'CREATE'. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobCreationView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobCreationView.xaml.cs new file mode 100644 index 000000000..4d57794d7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobCreationView.xaml.cs @@ -0,0 +1,34 @@ +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; +using Tango.BL.Enumerations; + +namespace Tango.PPC.Jobs.Dialogs +{ + /// + /// Represents the new job creation dialog. + /// + /// + /// + public partial class JobCreationView : UserControl + { + /// + /// Initializes a new instance of the class. + /// + public JobCreationView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobCreationViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobCreationViewVM.cs new file mode 100644 index 000000000..e2176c6af --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobCreationViewVM.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Enumerations; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Dialogs +{ + /// + /// Represents the a job type picker view model + /// + /// + public class JobCreationViewVM : DialogViewVM + { + /// + /// Gets or sets the supported job types. + /// + public List SupportedJobTypes { get; set; } + + private JobTypes _selectedJobType; + /// + /// Gets or sets the type of the selected job. + /// + public JobTypes SelectedJobType + { + get { return _selectedJobType; } + set + { + _selectedJobType = value; + RaisePropertyChangedAuto(); + } + } + + /// + /// Gets or sets the supported color spaces. + /// + public List SupportedColorSpaces { get; set; } + + private ColorSpaces _selectedColorSpace; + /// + /// Gets or sets the selected color space. + /// + public ColorSpaces SelectedColorSpace + { + get { return _selectedColorSpace; } + set + { + _selectedColorSpace = value; + RaisePropertyChangedAuto(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// The supported job types. + /// The supported color spaces + public JobCreationViewVM(List supportedJobTypes,List supportedColorSpaces) : base() + { + SupportedJobTypes = supportedJobTypes; + SupportedColorSpaces = supportedColorSpaces; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml deleted file mode 100644 index 814f73eb1..000000000 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml.cs deleted file mode 100644 index 217ee5c9c..000000000 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml.cs +++ /dev/null @@ -1,34 +0,0 @@ -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; -using Tango.BL.Enumerations; - -namespace Tango.PPC.Jobs.Dialogs -{ - /// - /// Represents the JobType selection dialog. - /// - /// - /// - public partial class JobTypePickerView : UserControl - { - /// - /// Initializes a new instance of the class. - /// - public JobTypePickerView() - { - InitializeComponent(); - } - } -} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerViewVM.cs deleted file mode 100644 index db5737013..000000000 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerViewVM.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.BL.Enumerations; -using Tango.SharedUI; - -namespace Tango.PPC.Jobs.Dialogs -{ - /// - /// Represents the a job type picker view model - /// - /// - public class JobTypePickerViewVM : DialogViewVM - { - /// - /// Gets or sets the supported job types. - /// - public List SupportedJobTypes { get; set; } - - private JobTypes? _selectedJobType; - /// - /// Gets or sets the type of the selected job. - /// - public JobTypes? SelectedJobType - { - get { return _selectedJobType; } - set - { - _selectedJobType = value; - OnSelectedJobTypeChanged(); - } - } - - /// - /// Initializes a new instance of the class. - /// - /// The supported job types. - public JobTypePickerViewVM(List supportedJobTypes) : base() - { - SupportedJobTypes = supportedJobTypes; - } - - /// - /// Called when the selected job type has been changed - /// - private void OnSelectedJobTypeChanged() - { - if (SelectedJobType.HasValue) - { - Accept(); - } - } - } -} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/JobsModuleSettings.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/JobsModuleSettings.cs index 3387477ed..259f6031b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/JobsModuleSettings.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/JobsModuleSettings.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Enumerations; using Tango.Settings; namespace Tango.PPC.Jobs @@ -18,6 +19,16 @@ namespace Tango.PPC.Jobs /// public List RecentTwineCatalogColors { get; set; } + /// + /// Gets or sets the last job color space. + /// + public ColorSpaces? LastJobColorSpace { get; set; } + + /// + /// Gets or sets the new job last type. + /// + public JobTypes? LastJobType { get; set; } + /// /// Initializes a new instance of the class. /// 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 8021e146f..242fbee53 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 @@ -100,7 +100,7 @@ Designer MSBuild:Compile - + Designer MSBuild:Compile @@ -176,10 +176,10 @@ ImportJobView.xaml - - JobTypePickerView.xaml + + JobCreationView.xaml - + SpoolChangeView.xaml @@ -386,7 +386,7 @@ - + \ No newline at end of file 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 8c1466c26..03644bdee 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 @@ -27,6 +27,7 @@ using Tango.Explorer; using System.IO; using Google.Protobuf; using Tango.PMR.Exports; +using Tango.Settings; namespace Tango.PPC.Jobs.ViewModels { @@ -303,18 +304,47 @@ namespace Tango.PPC.Jobs.ViewModels var machine = MachineProvider.Machine; - JobTypePickerViewVM vm = new JobTypePickerViewVM(machine.SupportedJobTypes.Count > 0 ? machine.SupportedJobTypes : Enum.GetValues(typeof(JobTypes)).Cast().ToList()); + JobCreationViewVM vm = new JobCreationViewVM( + machine.SupportedJobTypes.Count > 0 ? machine.SupportedJobTypes : Enum.GetValues(typeof(JobTypes)).Cast().ToList(), + machine.SupportedColorSpaces.Count > 0 ? machine.SupportedColorSpaces : Enum.GetValues(typeof(ColorSpaces)).Cast().Where(x => x.IsUserSpace()).ToList() + ); - if (machine.SupportedJobTypes.Count != 1) + var settings = SettingsManager.Default.GetOrCreate(); + + if (settings.LastJobType != null) + { + vm.SelectedJobType = settings.LastJobType.Value; + } + else + { + vm.SelectedJobType = machine.SupportedJobTypes.FirstOrDefault(); + } + + if (settings.LastJobColorSpace != null) { - vm = await NotificationProvider.ShowDialog(vm); + vm.SelectedColorSpace = settings.LastJobColorSpace.Value; + } + else + { + var space = machine.SupportedColorSpaces.FirstOrDefault(); + vm.SelectedColorSpace = space.IsUserSpace() ? space : ColorSpaces.Twine; + } + + if (machine.SupportedJobTypes.Count != 1 && machine.SupportedColorSpaces.Count != 1) + { + vm = await NotificationProvider.ShowDialog(vm); if (!vm.DialogResult) return; } else { vm.SelectedJobType = machine.SupportedJobTypes.First(); + vm.SelectedColorSpace = machine.SupportedColorSpaces.First(); } + settings.LastJobType = vm.SelectedJobType; + settings.LastJobColorSpace = vm.SelectedColorSpace; + settings.Save(); + Job job = new Job(); job.Name = "untitled"; job.NumberOfHeads = 1; @@ -322,8 +352,8 @@ namespace Tango.PPC.Jobs.ViewModels job.SampleUnitsOrMeters = 1; job.CreationDate = DateTime.UtcNow; job.JobStatus = JobStatuses.Draft; - job.JobType = vm.SelectedJobType.Value; - job.ColorSpaceGuid = machine.DefaultColorSpace != null ? machine.DefaultColorSpaceGuid : Adapter.ColorSpaces.FirstOrDefault(x => x.Code == ColorSpaces.RGB.ToInt32()).Guid; + job.JobType = vm.SelectedJobType; + job.ColorSpaceGuid = Adapter.ColorSpaces.FirstOrDefault(x => x.Code == vm.SelectedColorSpace.ToInt32()).Guid; job.MachineGuid = MachineProvider.Machine.Guid; job.UserGuid = AuthenticationProvider.CurrentUser.Guid; job.RmlGuid = machine.DefaultRml != null ? machine.DefaultRmlGuid : Adapter.Rmls.FirstOrDefault().Guid; 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 9fb7ff5c0..22c42eed7 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 @@ -374,7 +374,10 @@ Job Details - + + , + + @@ -459,10 +462,10 @@ - + @@ -522,10 +525,10 @@ Output - + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs index 7c6bed928..7896367ec 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -44,6 +44,13 @@ namespace Tango.PPC.MachineSettings.ViewModels set { _selectedJobTypes = value; RaisePropertyChangedAuto(); } } + private SelectedObjectCollection _selectedColorSpaces; + public SelectedObjectCollection SelectedColorSpaces + { + get { return _selectedColorSpaces; } + set { _selectedColorSpaces = value; RaisePropertyChangedAuto(); } + } + private bool _enableHotSpot; public bool EnableHotSpot { @@ -111,6 +118,7 @@ namespace Tango.PPC.MachineSettings.ViewModels if (Validate()) { Machine.SupportedJobTypes = SelectedJobTypes.SynchedSource.ToList(); + Machine.SupportedColorSpaces = SelectedColorSpaces.SynchedSource.ToList(); Machine.ShallowCopyTo(MachineProvider.Machine); Settings.EnableHotSpot = EnableHotSpot; @@ -160,6 +168,7 @@ namespace Tango.PPC.MachineSettings.ViewModels SelectedJobTypes = new SelectedObjectCollection(Enum.GetValues(typeof(JobTypes)).Cast().ToObservableCollection(), Machine.SupportedJobTypes.ToObservableCollection()); + SelectedColorSpaces = new SelectedObjectCollection(Enum.GetValues(typeof(ColorSpaces)).Cast().Where(x => x.IsUserSpace()).ToObservableCollection(), Machine.SupportedColorSpaces.ToObservableCollection()); } private async void OnEnableRemoteAssistanceChanged() diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index 337647790..d1de12664 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -94,14 +94,36 @@ + Supported Color Spaces/Catalogs + + + + + + + + + + + + + + + + + Default Media - Default Color Space/Catalog - - - Default Spool - + Default Segment Length diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index efd2a15b8..d4951edda 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango PPC Application")] -[assembly: AssemblyVersion("2.0.17.1608")] +[assembly: AssemblyVersion("2.0.18.1608")] 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 042faaba8..872b6b71e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml @@ -94,9 +94,7 @@ - - - + diff --git a/Software/Visual_Studio/Tango.BL/Entities/ColorSpace.cs b/Software/Visual_Studio/Tango.BL/Entities/ColorSpace.cs index c11c0531d..16e3b1ead 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/ColorSpace.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/ColorSpace.cs @@ -31,6 +31,8 @@ namespace Tango.BL.Entities public event EventHandler DescriptionChanged; + public event EventHandler IsCatalogChanged; + public event EventHandler> BrushStopsChanged; public event EventHandler> ColorCatalogsChanged; @@ -123,6 +125,34 @@ namespace Tango.BL.Entities } } + protected Boolean _iscatalog; + + /// + /// Gets or sets the colorspace is catalog. + /// + + [Column("IS_CATALOG")] + + public Boolean IsCatalog + { + get + { + return _iscatalog; + } + + set + { + if (_iscatalog != value) + { + _iscatalog = value; + + IsCatalogChanged?.Invoke(this, value); + + RaisePropertyChanged(nameof(IsCatalog)); + } + } + } + protected SynchronizedObservableCollection _brushstops; /// diff --git a/Software/Visual_Studio/Tango.BL/Entities/Machine.cs b/Software/Visual_Studio/Tango.BL/Entities/Machine.cs index 38926d3e4..8e5e9f204 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Machine.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Machine.cs @@ -21,11 +21,6 @@ using Tango.Core; namespace Tango.BL.Entities { - - /// - /// - /// - [Table("MACHINES")] public partial class Machine : ObservableEntity { @@ -38,6 +33,8 @@ namespace Tango.BL.Entities public event EventHandler TargetJobTypesChanged; + public event EventHandler TargetColorSpaceCodesChanged; + public event EventHandler DefaultSegmentLengthChanged; public event EventHandler SynchedChanged; @@ -60,8 +57,6 @@ namespace Tango.BL.Entities public event EventHandler IsDemoChanged; - public event EventHandler EnvironmentChanged; - public event EventHandler> CatsChanged; public event EventHandler DefaultColorSpaceChanged; @@ -323,6 +318,34 @@ namespace Tango.BL.Entities } } + protected String _targetcolorspacecodes; + + /// + /// Gets or sets the machine target color space codes. + /// + + [Column("TARGET_COLOR_SPACE_CODES")] + + public String TargetColorSpaceCodes + { + get + { + return _targetcolorspacecodes; + } + + set + { + if (_targetcolorspacecodes != value) + { + _targetcolorspacecodes = value; + + TargetColorSpaceCodesChanged?.Invoke(this, value); + + RaisePropertyChanged(nameof(TargetColorSpaceCodes)); + } + } + } + protected String _defaultcolorspaceguid; /// @@ -683,36 +706,6 @@ namespace Tango.BL.Entities } } - protected Int32 _environment; - - /// - /// 0 = DEV - /// 1 = TEST - /// 2 = PROD - /// - - [Column("ENVIRONMENT")] - - public Int32 Environment - { - get - { - return _environment; - } - - set - { - if (_environment != value) - { - _environment = value; - - EnvironmentChanged?.Invoke(this, value); - - RaisePropertyChanged(nameof(Environment)); - } - } - } - protected SynchronizedObservableCollection _cats; /// diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Machine.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Machine.cs index 2e6cbb222..96edacde6 100644 --- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Machine.cs +++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Machine.cs @@ -47,6 +47,38 @@ namespace Tango.BL.Entities } } + /// + /// Gets or sets the property as a collection of . + /// + [NotMapped] + [JsonIgnore] + public List SupportedColorSpaces + { + get + { + try + { + if (!String.IsNullOrWhiteSpace(TargetColorSpaceCodes)) + { + return TargetColorSpaceCodes.Split(',').Select(x => (ColorSpaces)int.Parse(x)).ToList(); + } + else + { + return new List(); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Could not parse machine target color space codes!"); + return new List(); + } + } + set + { + TargetColorSpaceCodes = String.Join(",", value.Select(x => x.ToInt32())); + } + } + #endregion protected override void RaisePropertyChanged(string propName) @@ -57,6 +89,10 @@ namespace Tango.BL.Entities { RaisePropertyChanged(nameof(SupportedJobTypes)); } + else if (propName == nameof(TargetColorSpaceCodes)) + { + RaisePropertyChanged(nameof(SupportedColorSpaces)); + } } /// diff --git a/Software/Visual_Studio/Tango.BL/ExtensionMethods/ColorSpacesExtensions.cs b/Software/Visual_Studio/Tango.BL/ExtensionMethods/ColorSpacesExtensions.cs new file mode 100644 index 000000000..67128680d --- /dev/null +++ b/Software/Visual_Studio/Tango.BL/ExtensionMethods/ColorSpacesExtensions.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Enumerations; + +public static class ColorSpacesExtensions +{ + /// + /// Determines whether the specified color space is allowed to be used by standard user. + /// + /// The color space. + public static bool IsUserSpace(this ColorSpaces colorspace) + { + return colorspace != ColorSpaces.Volume && colorspace != ColorSpaces.CMYK; + } +} + diff --git a/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs b/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs index 085d939a5..a0af4eb57 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesStaticCollections.cs @@ -52,50 +52,50 @@ namespace Tango.BL WindingMethods = db.WindingMethods.ToObservableCollection(); - sequencer.Add(() => ColorSpaces = db.ColorSpaces.ToObservableCollection()); - sequencer.Add(() => SpoolTypes = db.SpoolTypes.ToObservableCollection()); + ColorSpaces = db.ColorSpaces.ToObservableCollection(); + SpoolTypes = db.SpoolTypes.ToObservableCollection(); - sequencer.Add(() => ActionTypes = db.ActionTypes.ToObservableCollection()); - sequencer.Add(() => EventTypes = db.EventTypes.ToObservableCollection()); - sequencer.Add(() => EventTypesActions = db.EventTypesActions.ToObservableCollection()); - sequencer.Add(() => EventTypesCategories = db.EventTypesCategories.ToObservableCollection()); - sequencer.Add(() => EventTypesGroups = db.EventTypesGroups.ToObservableCollection()); + ActionTypes = db.ActionTypes.ToObservableCollection(); + EventTypes = db.EventTypes.ToObservableCollection(); + EventTypesActions = db.EventTypesActions.ToObservableCollection(); + EventTypesCategories = db.EventTypesCategories.ToObservableCollection(); + EventTypesGroups = db.EventTypesGroups.ToObservableCollection(); - sequencer.Add(() => HardwareBlowerTypes = db.HardwareBlowerTypes.ToObservableCollection()); - sequencer.Add(() => HardwareBlowers = db.HardwareBlowers.ToObservableCollection()); + HardwareBlowerTypes = db.HardwareBlowerTypes.ToObservableCollection(); + HardwareBlowers = db.HardwareBlowers.ToObservableCollection(); - sequencer.Add(() => HardwareBreakSensorTypes = db.HardwareBreakSensorTypes.ToObservableCollection()); - sequencer.Add(() => HardwareBreakSensors = db.HardwareBreakSensors.ToObservableCollection()); + HardwareBreakSensorTypes = db.HardwareBreakSensorTypes.ToObservableCollection(); + HardwareBreakSensors = db.HardwareBreakSensors.ToObservableCollection(); - sequencer.Add(() => HardwareDancerTypes = db.HardwareDancerTypes.ToObservableCollection()); - sequencer.Add(() => HardwareDancers = db.HardwareDancers.ToObservableCollection()); + HardwareDancerTypes = db.HardwareDancerTypes.ToObservableCollection(); + HardwareDancers = db.HardwareDancers.ToObservableCollection(); - sequencer.Add(() => HardwareMotorTypes = db.HardwareMotorTypes.ToObservableCollection()); - sequencer.Add(() => HardwareMotors = db.HardwareMotors.ToObservableCollection()); + HardwareMotorTypes = db.HardwareMotorTypes.ToObservableCollection(); + HardwareMotors = db.HardwareMotors.ToObservableCollection(); - sequencer.Add(() => HardwarePidControlTypes = db.HardwarePidControlTypes.ToObservableCollection()); - sequencer.Add(() => HardwarePidControls = db.HardwarePidControls.ToObservableCollection()); + HardwarePidControlTypes = db.HardwarePidControlTypes.ToObservableCollection(); + HardwarePidControls = db.HardwarePidControls.ToObservableCollection(); - sequencer.Add(() => HardwareSpeedSensorTypes = db.HardwareSpeedSensorTypes.ToObservableCollection()); - sequencer.Add(() => HardwareSpeedSensors = db.HardwareSpeedSensors.ToObservableCollection()); + HardwareSpeedSensorTypes = db.HardwareSpeedSensorTypes.ToObservableCollection(); + HardwareSpeedSensors = db.HardwareSpeedSensors.ToObservableCollection(); - sequencer.Add(() => HardwareWinderTypes = db.HardwareWinderTypes.ToObservableCollection()); - sequencer.Add(() => HardwareWinders = db.HardwareWinders.ToObservableCollection()); + HardwareWinderTypes = db.HardwareWinderTypes.ToObservableCollection(); + HardwareWinders = db.HardwareWinders.ToObservableCollection(); - sequencer.Add(() => TechControllers = db.TechControllers.ToObservableCollection()); - sequencer.Add(() => TechDispensers = db.TechDispensers.ToObservableCollection()); - sequencer.Add(() => TechIos = db.TechIos.ToObservableCollection()); - sequencer.Add(() => TechMonitors = db.TechMonitors.ToObservableCollection()); - sequencer.Add(() => TechValves = db.TechValves.ToObservableCollection()); - sequencer.Add(() => TechHeaters = db.TechHeaters.ToObservableCollection()); + TechControllers = db.TechControllers.ToObservableCollection(); + TechDispensers = db.TechDispensers.ToObservableCollection(); + TechIos = db.TechIos.ToObservableCollection(); + TechMonitors = db.TechMonitors.ToObservableCollection(); + TechValves = db.TechValves.ToObservableCollection(); + TechHeaters = db.TechHeaters.ToObservableCollection(); - sequencer.Add(() => Machines = db.Machines.Include(x => x.Organization).ToObservableCollection()); + Machines = db.Machines.Include(x => x.Organization).ToObservableCollection(); - sequencer.Add(() => Users = db.Users.Include(x => x.Contact).ToObservableCollection()); + Users = db.Users.Include(x => x.Contact).ToObservableCollection(); - sequencer.Add(() => MachineVersions = db.MachineVersions.ToObservableCollection()); + MachineVersions = db.MachineVersions.ToObservableCollection(); - sequencer.Run(); + //Load later... Task.Factory.StartNew(() => diff --git a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj index 65da88936..1d2d60604 100644 --- a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj +++ b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj @@ -175,6 +175,7 @@ + @@ -349,7 +350,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/COLOR_SPACES.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/COLOR_SPACES.cs index 9e0bfb19f..9689d7003 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/COLOR_SPACES.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/COLOR_SPACES.cs @@ -29,6 +29,7 @@ namespace Tango.DAL.Remote.DB public int CODE { get; set; } public string NAME { get; set; } public string DESCRIPTION { get; set; } + public bool IS_CATALOG { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection BRUSH_STOPS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs index f49eba95a..00f8277e9 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs @@ -35,6 +35,7 @@ namespace Tango.DAL.Remote.DB public string DEFAULT_RML_GUID { get; set; } public string LOADED_RML_GUID { get; set; } public string TARGET_JOB_TYPES { get; set; } + public string TARGET_COLOR_SPACE_CODES { get; set; } public string DEFAULT_COLOR_SPACE_GUID { get; set; } public double DEFAULT_SEGMENT_LENGTH { get; set; } public string DEFAULT_SPOOL_TYPE_GUID { get; set; } @@ -48,7 +49,6 @@ namespace Tango.DAL.Remote.DB public bool SETUP_FIRMWARE { get; set; } public bool SETUP_FPGA { get; set; } public bool IS_DEMO { get; set; } - public int ENVIRONMENT { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection CATS { 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 c51caf219..6eba91c41 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -175,6 +175,7 @@ + @@ -702,6 +703,7 @@ + @@ -715,7 +717,6 @@ - @@ -3185,6 +3186,7 @@ + @@ -3799,6 +3801,7 @@ + @@ -3812,7 +3815,6 @@ - @@ -5507,6 +5509,7 @@ + @@ -6065,7 +6068,6 @@ - @@ -6079,6 +6081,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 4c3b4610a..68da85ad2 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram @@ -5,81 +5,81 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/Tango.SQLExaminer/ExaminerConfigurationBuilder.cs b/Software/Visual_Studio/Tango.SQLExaminer/ExaminerConfigurationBuilder.cs index dbed95b77..5adc7a4a4 100644 --- a/Software/Visual_Studio/Tango.SQLExaminer/ExaminerConfigurationBuilder.cs +++ b/Software/Visual_Studio/Tango.SQLExaminer/ExaminerConfigurationBuilder.cs @@ -43,13 +43,16 @@ namespace Tango.SQLExaminer d1.ID = 1; d1.DataBase = dataSource.Catalog; d1.Server = dataSource.Address; - d1.UserName = dataSource.UserName; - d1.Password = dataSource.Password; if (dataSource.IntegratedSecurity) { d1.IntegratedSecurity = "True"; } + else + { + d1.UserName = dataSource.UserName; + d1.Password = dataSource.Password; + } if (dataSource.Type == Core.DataSourceType.Azure) { @@ -72,14 +75,16 @@ namespace Tango.SQLExaminer d2.ID = 2; d2.DataBase = dataSource.Catalog; d2.Server = dataSource.Address; - d2.UserName = dataSource.UserName; - d2.Password = dataSource.Password; - if (dataSource.IntegratedSecurity) { d2.IntegratedSecurity = "True"; } + else + { + d2.UserName = dataSource.UserName; + d2.Password = dataSource.Password; + } if (dataSource.Type == Core.DataSourceType.Azure) { diff --git a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/OverrideData.xml b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/OverrideData.xml index 61ca6aedb..e665a27bd 100644 Binary files a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/OverrideData.xml and b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/OverrideData.xml differ diff --git a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml index 003d76bde..f93f1af8c 100644 Binary files a/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml and b/Software/Visual_Studio/Tango.SQLExaminer/SQLExaminer/Configurations/ProvisionMachine.xml differ diff --git a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.cs b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.cs index 94a158f83..f098af31d 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.cs @@ -366,25 +366,28 @@ namespace Tango.Touch.Controls private void OnSelectedItemChanged() { - if (SelectedItem != null) + if (!IsMultiSelecting) { - foreach (var row in GetRows()) + if (SelectedItem != null) { - if (row.DataContext == SelectedItem) + foreach (var row in GetRows()) { - row.IsSelected = true; + if (row.DataContext == SelectedItem) + { + row.IsSelected = true; + } + else + { + row.IsSelected = false; + } } - else - { - row.IsSelected = false; - } - } - SelectionChanged?.Invoke(this, new EventArgs()); - } - else - { - ClearSelectedItems(); + SelectionChanged?.Invoke(this, new EventArgs()); + } + else + { + ClearSelectedItems(); + } } } diff --git a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGridRow.cs b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGridRow.cs index c0bb2c45d..cc9ef1d42 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGridRow.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGridRow.cs @@ -22,7 +22,12 @@ namespace Tango.Touch.Controls set { SetValue(IsSelectedProperty, value); } } public static readonly DependencyProperty IsSelectedProperty = - DependencyProperty.Register("IsSelected", typeof(bool), typeof(LightTouchDataGridRow), new PropertyMetadata(false)); + DependencyProperty.Register("IsSelected", typeof(bool), typeof(LightTouchDataGridRow), new PropertyMetadata(false,(d,e) => (d as LightTouchDataGridRow).OnSelectedChanged())); + + private void OnSelectedChanged() + { + var a = IsSelected; + } public DataTemplate SelectedMaskTemplate { diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchStaticListBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchStaticListBox.cs index de363bac5..023395006 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchStaticListBox.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchStaticListBox.cs @@ -78,6 +78,12 @@ namespace Tango.Touch.Controls public TouchStaticListBox() { ListBoxItemLoadedCommand = new RelayCommand(RegisterListBoxItemEvents); + Loaded += TouchStaticListBox_Loaded; + } + + private void TouchStaticListBox_Loaded(object sender, RoutedEventArgs e) + { + OnSelectdItemChanged(); } private void RegisterListBoxItemEvents(TouchStaticListBoxItem item) @@ -105,7 +111,7 @@ namespace Tango.Touch.Controls if (SelectedItem != null) { - var selected_item = items.FirstOrDefault(x => x.DataContext == SelectedItem); + var selected_item = items.FirstOrDefault(x => SelectedItem.Equals(x.DataContext)); if (selected_item != null) { diff --git a/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml b/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml index 04346fa3e..38e03cb0a 100644 --- a/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml +++ b/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml @@ -21,7 +21,7 @@ #5E5E5E #6EFFFFFF - #43929292 + #28BDBDBD #464d67 -- cgit v1.3.1