From 6240aad18f5dc54d4e29bf2d39f49ef1ba39742f Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 10 Dec 2018 12:59:22 +0200 Subject: Added array support for stubsexec. Improved PPC update & setup. --- .../PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs index c201bf555..79974bff4 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs @@ -61,6 +61,16 @@ namespace Tango.PPC.UI.ViewModels set { _isDbUpdate = value; RaisePropertyChangedAuto(); } } + private String _failedError; + /// + /// Gets or sets the setup failed error. + /// + public String FailedError + { + get { return _failedError; } + set { _failedError = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -150,6 +160,7 @@ namespace Tango.PPC.UI.ViewModels } catch (Exception ex) { + FailedError = ex.FlattenMessage(); LogManager.Log(ex, "Error while trying to check for updates."); await NavigateTo(MachineUpdateView.UpdateFailedView); } @@ -171,6 +182,7 @@ namespace Tango.PPC.UI.ViewModels } catch (Exception ex) { + FailedError = ex.FlattenMessage(); LogManager.Log(ex, "Machine update failed."); await NavigateTo(MachineUpdateView.UpdateFailedView); } @@ -188,6 +200,7 @@ namespace Tango.PPC.UI.ViewModels } catch (Exception ex) { + FailedError = ex.FlattenMessage(); LogManager.Log(ex, "Database update failed."); await NavigateTo(MachineUpdateView.UpdateFailedView); } -- cgit v1.3.1 From 00de504d4d276063ec6b732cc95e476c89182df2 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 27 Dec 2018 17:34:54 +0200 Subject: Worked on PPC publisher. --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes Software/Graphics/environment.png | Bin 0 -> 4809 bytes .../PPC/Tango.PPC.Common/DeploymentSlots.cs | 21 +++++++++++++ .../PPC/Tango.PPC.Common/PPCSettings.cs | 21 +++++++++---- .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 5 ++- .../Tango.PPC.Common/Update/IPPCUpdateService.cs | 7 +++++ .../Update/MachineVersionsRequest.cs | 14 +++++++++ .../Update/MachineVersionsResponse.cs | 20 ++++++++++++ .../Tango.PPC.Common/Update/PPCUpdateService.cs | 18 ++++++++--- .../PPC/Tango.PPC.Publisher/MainWindow.xaml | 8 ++++- .../PPC/Tango.PPC.Publisher/MainWindowVM.cs | 35 ++++++++++++++------- .../PPC/Tango.PPC.Publisher/PublisherSettings.cs | 6 ++++ .../PPC/Tango.PPC.UI/Images/environment.png | Bin 0 -> 4809 bytes .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 3 +- .../Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs | 26 +++++++++++++-- .../Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs | 6 ++-- .../PPC/Tango.PPC.UI/Views/MachineSetupView.xaml | 16 +++++++++- .../Visual_Studio/Tango.BL/ObservableEntity.cs | 3 -- .../Converters/EnumToItemsSourceConverter.cs | 10 +++++- .../Controllers/PPCController.cs | 25 ++++++++------- 21 files changed, 197 insertions(+), 47 deletions(-) create mode 100644 Software/Graphics/environment.png create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/DeploymentSlots.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Update/MachineVersionsRequest.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Update/MachineVersionsResponse.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/environment.png (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index 430acbabf..68f4424b9 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 b2e06171f..2f9c6e1b1 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/Graphics/environment.png b/Software/Graphics/environment.png new file mode 100644 index 000000000..6a9486556 Binary files /dev/null and b/Software/Graphics/environment.png differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/DeploymentSlots.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/DeploymentSlots.cs new file mode 100644 index 000000000..0118592fd --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/DeploymentSlots.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Common +{ + public enum DeploymentSlots + { + [Description("https://machineservice-dev.twine-srv.com")] + Development, + [Description("https://machineservice-test.twine-srv.com")] + Testing, + [Description("https://machineservice-stage.twine-srv.com")] + Staging, + [Description("https://machineservice.twine-srv.com")] + Production + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index 8413e5a4f..81168d235 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -25,11 +25,6 @@ namespace Tango.PPC.Common /// public ApplicationStates ApplicationState { get; set; } - /// - /// Gets or sets the machine service address. - /// - public String MachineServiceAddress { get; set; } - /// /// Gets or sets the machine scanning timeout seconds. /// @@ -70,6 +65,20 @@ namespace Tango.PPC.Common /// public bool EnableRemoteAssistance { get; set; } + /// + /// Gets or sets the deployment slot. + /// + public DeploymentSlots DeploymentSlot { get; set; } + + /// + /// Gets the machine service address. + /// + /// + public String GetMachineServiceAddress() + { + return DeploymentSlot.ToDescription(); + } + /// /// Initializes a new instance of the class. /// @@ -77,10 +86,10 @@ namespace Tango.PPC.Common { MachineScanningTimeoutSeconds = 20; LoggingCategories = new List(); - MachineServiceAddress = "https://machineservice.twine-srv.com/"; EmbeddedComPort = null; ExternalBridgePassword = "Aa123456"; HotSpotPassword = "Aa123456"; + DeploymentSlot = DeploymentSlots.Production; } } } 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 c8c6575a5..2f04e21ef 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 @@ -125,6 +125,7 @@ TwineCatalogControl.xaml + @@ -178,6 +179,8 @@ + + @@ -344,7 +347,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/IPPCUpdateService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/IPPCUpdateService.cs index 49bfba1cd..a16099e7c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/IPPCUpdateService.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/IPPCUpdateService.cs @@ -33,5 +33,12 @@ namespace Tango.PPC.Common.Update /// The machine version unique identifier. /// Task GetLatestVersion(LatestVersionRequest request); + + /// + /// Gets the hardware versions. + /// + /// The request. + /// + Task GetMachineVersions(); } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/MachineVersionsRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/MachineVersionsRequest.cs new file mode 100644 index 000000000..bf2d86e70 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/MachineVersionsRequest.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Transport.Web; + +namespace Tango.PPC.Common.Update +{ + public class MachineVersionsRequest : WebRequestMessage + { + + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/MachineVersionsResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/MachineVersionsResponse.cs new file mode 100644 index 000000000..ed4ac95c2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/MachineVersionsResponse.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.Transport.Web; + +namespace Tango.PPC.Common.Update +{ + public class MachineVersionsResponse : WebResponseMessage + { + public List MachineVersions { get; set; } + + public MachineVersionsResponse() + { + MachineVersions = new List(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/PPCUpdateService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/PPCUpdateService.cs index b6654ef59..5692ccce9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/PPCUpdateService.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/PPCUpdateService.cs @@ -10,28 +10,36 @@ namespace Tango.PPC.Common.Update { public class PPCUpdateService : IPPCUpdateService { - private string address; private WebTransportClient _client; public PPCUpdateService() { - address = SettingsManager.Default.GetOrCreate().MachineServiceAddress + "/api/PPC/"; _client = new WebTransportClient(); } + private String GetAddress() + { + return SettingsManager.Default.GetOrCreate().GetMachineServiceAddress() + "/api/PPC/"; + } + public Task UploadVersion(UploadVersionRequest request) { - return _client.PostJson(address + "UploadVersion", request); + return _client.PostJson(GetAddress() + "UploadVersion", request); } public Task NotifyUploadCompleted(UploadCompletedRequest request) { - return _client.PostJson(address + "NotifyUploadCompleted", request); + return _client.PostJson(GetAddress() + "NotifyUploadCompleted", request); } public Task GetLatestVersion(LatestVersionRequest request) { - return _client.PostJson(address + "GetLatestVersion", request); + return _client.PostJson(GetAddress() + "GetLatestVersion", request); + } + + public Task GetMachineVersions() + { + return _client.PostJson(GetAddress() + "GetMachineVersions", new MachineVersionsRequest()); } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Publisher/MainWindow.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Publisher/MainWindow.xaml index b347ce2c1..e34b82396 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Publisher/MainWindow.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Publisher/MainWindow.xaml @@ -5,10 +5,11 @@ xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:common="clr-namespace:Tango.PPC.Common;assembly=Tango.PPC.Common" xmlns:examiner="clr-namespace:Tango.SQLExaminer;assembly=Tango.SQLExaminer" xmlns:local="clr-namespace:Tango.PPC.Publisher" mc:Ignorable="d" - Title="Tango PPC Publisher" Height="1000" Width="500" d:DataContext="{d:DesignInstance Type=local:MainWindowVM, IsDesignTimeCreatable=False}"> + Title="Tango PPC Publisher" Height="1100" Width="500" d:DataContext="{d:DesignInstance Type=local:MainWindowVM, IsDesignTimeCreatable=False}"> @@ -28,6 +29,11 @@ Tango Publish Utility + Deployment Slot: + + + + Build Configuration: Release diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Publisher/MainWindowVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.Publisher/MainWindowVM.cs index 4e7dd304e..e11d01318 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Publisher/MainWindowVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Publisher/MainWindowVM.cs @@ -22,6 +22,7 @@ using Tango.Core.Commands; using Tango.Core.Cryptography; using Tango.Core.Helpers; using Tango.Core.IO; +using Tango.PPC.Common; using Tango.PPC.Common.Update; using Tango.Settings; using Tango.SharedUI; @@ -121,6 +122,13 @@ namespace Tango.PPC.Publisher set { _password = value; RaisePropertyChangedAuto(); } } + private DeploymentSlots _deplotmentSlot; + public DeploymentSlots DeploymentSlot + { + get { return _deplotmentSlot; } + set { _deplotmentSlot = value; RaisePropertyChangedAuto(); OnDeploymentSlotChanged(); } + } + private String _comments; public String Comments { @@ -157,12 +165,15 @@ namespace Tango.PPC.Publisher public MainWindowVM() { - SelectedBuildConfiguration = "Release"; + _client = new PPCUpdateService(); _hashGenerator = new BasicHashGenerator(); var settings = SettingsManager.Default.GetOrCreate(); + SelectedBuildConfiguration = settings.BuildConfiguration; + DeploymentSlot = settings.DeploymentSlot; + ProvisionSequenceItems = new ObservableCollection(settings.ProvisionSequenceItems); ProvisionSequenceItemsView = CollectionViewSource.GetDefaultView(ProvisionSequenceItems); ProvisionSequenceItemsView.SortDescriptions.Add(new SortDescription(nameof(SequenceItem.Index), ListSortDirection.Ascending)); @@ -174,12 +185,6 @@ namespace Tango.PPC.Publisher SettingsManager.Default.GetOrCreate(); SettingsManager.Default.Save(); - using (ObservablesContext db = ObservablesContext.CreateDefault()) - { - MachineVersions = db.MachineVersions.ToList(); - SelectedMachineVersion = MachineVersions.OrderBy(x => x.Version).LastOrDefault(); - } - LocalVersion = FileVersionInfo.GetVersionInfo(Core.Helpers.AssemblyHelper.GetCurrentAssemblyFolder() + "\\Tango.PPC.UI.exe").ProductVersion; PublishCommand = new RelayCommand(Publish); @@ -191,11 +196,6 @@ namespace Tango.PPC.Publisher { if (SelectedMachineVersion != null) { - if (_client == null) - { - _client = new PPCUpdateService(); - } - var response = await _client.GetLatestVersion(new LatestVersionRequest() { MachineVersionGuid = SelectedMachineVersion.Guid, @@ -205,6 +205,14 @@ namespace Tango.PPC.Publisher } } + private async void OnDeploymentSlotChanged() + { + SettingsManager.Default.GetOrCreate().DeploymentSlot = DeploymentSlot; + SelectedMachineVersion = null; + MachineVersions = (await _client.GetMachineVersions()).MachineVersions; + SelectedMachineVersion = MachineVersions.OrderBy(x => x.Version).LastOrDefault(); + } + private void Publish() { Task.Factory.StartNew(async () => @@ -215,6 +223,9 @@ namespace Tango.PPC.Publisher var settings = SettingsManager.Default.GetOrCreate(); settings.ProvisionSequenceItems = ProvisionSequenceItems.ToList(); settings.UpdateSequenceItems = UpdateSequenceItems.ToList(); + settings.DeploymentSlot = DeploymentSlot; + settings.BuildConfiguration = SelectedBuildConfiguration; + settings.Save(); try diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Publisher/PublisherSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Publisher/PublisherSettings.cs index d9f10cd01..6caf8a2f6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Publisher/PublisherSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Publisher/PublisherSettings.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.PPC.Common; using Tango.Settings; namespace Tango.PPC.Publisher @@ -13,10 +14,15 @@ namespace Tango.PPC.Publisher public List UpdateSequenceItems { get; set; } + public String BuildConfiguration { get; set; } + + public DeploymentSlots DeploymentSlot { get; set; } + public PublisherSettings() { ProvisionSequenceItems = new List(); UpdateSequenceItems = new List(); + BuildConfiguration = "Debug"; } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/environment.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/environment.png new file mode 100644 index 000000000..6a9486556 Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/environment.png differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 5fe3ae2bb..2c2ab061e 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 @@ -409,6 +409,7 @@ Tango.ColorLib.dll PreserveNewest + @@ -486,7 +487,7 @@ del "$(TargetDir)firmware_package.tfp" - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs index 7b8d4dbe6..6cf08a43a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs @@ -49,6 +49,7 @@ namespace Tango.PPC.UI.ViewModels WiFiSelectionView, WiFiTestView, TimeZoneView, + EnvironmentView, SetupWelcomeView, SetupProgressView, SetupCompletedView, @@ -130,6 +131,15 @@ namespace Tango.PPC.UI.ViewModels set { _selectedTimeZone = value; RaisePropertyChangedAuto(); } } + private DeploymentSlots _deploymentSlot; + /// + /// Gets or sets the deployment slot. + /// + public DeploymentSlots DeploymentSlot + { + get { return _deploymentSlot; } + set { _deploymentSlot = value; RaisePropertyChangedAuto(); } + } #endregion @@ -159,6 +169,11 @@ namespace Tango.PPC.UI.ViewModels /// Gets or sets the time zone selected command. /// public RelayCommand TimeZoneSelectedCommand { get; set; } + + /// + /// Gets or sets the environment selected command. + /// + public RelayCommand EnvironmentSelectedCommand { get; set; } #endregion #region Constructors @@ -172,7 +187,8 @@ namespace Tango.PPC.UI.ViewModels { MachineSetupManager = machineSetupManager; - HostAddress = Settings.MachineServiceAddress; + DeploymentSlot = Settings.DeploymentSlot; + SerialNumber = ""; CompleteCommand = new RelayCommand(CompleteSetup, () => State == MachineSetupStates.Completed); @@ -183,7 +199,13 @@ namespace Tango.PPC.UI.ViewModels InstallCommand = new RelayCommand(Install); RestartCommand = new RelayCommand(() => { NavigateTo(MachineSetupView.WelcomeView); }); - TimeZoneSelectedCommand = new RelayCommand(() => { NavigateTo(MachineSetupView.SetupWelcomeView); }); + TimeZoneSelectedCommand = new RelayCommand(() => { NavigateTo(MachineSetupView.EnvironmentView); }); + EnvironmentSelectedCommand = new RelayCommand(() => + { + NavigateTo(MachineSetupView.SetupWelcomeView); + Settings.DeploymentSlot = DeploymentSlot; + HostAddress = Settings.GetMachineServiceAddress(); + }); _operationSystemManager = operationSystemManager; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs index 79974bff4..a553f3a18 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs @@ -136,7 +136,7 @@ namespace Tango.PPC.UI.ViewModels { IsDbUpdate = false; - var response = await MachineUpdateManager.CheckForUpdate(MachineProvider.Machine.SerialNumber, Settings.MachineServiceAddress); + var response = await MachineUpdateManager.CheckForUpdate(MachineProvider.Machine.SerialNumber, Settings.GetMachineServiceAddress()); if (response.IsUpdateAvailable) { @@ -145,7 +145,7 @@ namespace Tango.PPC.UI.ViewModels } else { - _db_compare_result = await MachineUpdateManager.UpdateDBCheck(MachineProvider.Machine.SerialNumber, Settings.MachineServiceAddress); + _db_compare_result = await MachineUpdateManager.UpdateDBCheck(MachineProvider.Machine.SerialNumber, Settings.GetMachineServiceAddress()); if (_db_compare_result.RequiresUpdate) { @@ -176,7 +176,7 @@ namespace Tango.PPC.UI.ViewModels try { - _update_result = await MachineUpdateManager.Update(MachineProvider.Machine.SerialNumber, Settings.MachineServiceAddress); + _update_result = await MachineUpdateManager.Update(MachineProvider.Machine.SerialNumber, Settings.GetMachineServiceAddress()); LogManager.Log("Machine update completed."); await NavigateTo(MachineUpdateView.UpdateCompletedView); } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml index 4832eea01..df50133fd 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml @@ -10,6 +10,7 @@ xmlns:connectivity="clr-namespace:Tango.PPC.Common.Connectivity;assembly=Tango.PPC.Common" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:local="clr-namespace:Tango.PPC.UI.Views" + xmlns:common="clr-namespace:Tango.PPC.Common;assembly=Tango.PPC.Common" mc:Ignorable="d" d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MachineSetupViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MachineSetupViewVM}"> @@ -18,7 +19,7 @@ - MACHINE SETUP WIZARD + Machine Setup Wizard @@ -80,6 +81,19 @@ + + + + + Please select the machine working environment + + + + + CONTINUE + + + diff --git a/Software/Visual_Studio/Tango.BL/ObservableEntity.cs b/Software/Visual_Studio/Tango.BL/ObservableEntity.cs index 5c8718f47..52ecbbbc5 100644 --- a/Software/Visual_Studio/Tango.BL/ObservableEntity.cs +++ b/Software/Visual_Studio/Tango.BL/ObservableEntity.cs @@ -80,7 +80,6 @@ namespace Tango.BL [Key] [Column("GUID")] [ParameterIgnore] - [JsonIgnore] public String Guid { get { return _guid; } @@ -93,7 +92,6 @@ namespace Tango.BL /// [Column("LAST_UPDATED")] [ParameterIgnore] - [JsonIgnore] public DateTime LastUpdated { get { return _lastUpdated; } @@ -378,7 +376,6 @@ Maybe you have deleted an entity that was no yet inserted into database?", LogCa { return GetDbContextFromEntity(this); } - #endregion #region Private Methods diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/EnumToItemsSourceConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/EnumToItemsSourceConverter.cs index 38f3467cf..68e7a6c93 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Converters/EnumToItemsSourceConverter.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/EnumToItemsSourceConverter.cs @@ -13,7 +13,15 @@ namespace Tango.SharedUI.Converters public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { Type result = value as Type; - return Enum.GetValues(result).Cast().Select(e => new { Value = e, DisplayName = (e as Enum).ToDescription() }); + + if (parameter != null && parameter.ToString() == "false") + { + return Enum.GetValues(result); + } + else + { + return Enum.GetValues(result).Cast().Select(e => new { Value = e, DisplayName = (e as Enum).ToDescription() }); + } } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index 6b4190313..18e2edb0c 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -272,7 +272,7 @@ namespace Tango.MachineService.Controllers using (ObservablesContext db = ObservablesContextHelper.CreateContext()) { - var versions = db.TangoVersions.ToList(); + var versions = db.TangoVersions.Where(x => x.MachineVersionGuid == request.MachineVersionGuid).ToList(); if (versions.Count == 0) { @@ -282,16 +282,7 @@ namespace Tango.MachineService.Controllers }; } - var machine_versions = versions.Where(x => x.MachineVersionGuid == request.MachineVersionGuid).ToList(); - - if (machine_versions.Count > 0) - { - response.Version = db.TangoVersions.Where(x => x.MachineVersionGuid == request.MachineVersionGuid).ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault().Version; - } - else - { - throw new ArgumentException("The specified machine version was not found!"); - } + response.Version = versions.OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault().Version; } return response; @@ -392,6 +383,18 @@ namespace Tango.MachineService.Controllers } } + [HttpPost] + public MachineVersionsResponse GetMachineVersions(MachineVersionsRequest request) + { + using (var db = ObservablesContextHelper.CreateContext()) + { + return new MachineVersionsResponse() + { + MachineVersions = db.MachineVersions.ToList(), + }; + } + } + #endregion [HttpPost] -- cgit v1.3.1