From 795444f234f6b45bc83d5c7b28725bd7ebc7ee89 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 24 Dec 2018 17:39:01 +0200 Subject: Working on machine service and machine studio. --- .../MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs index 3fec96629..e19dcdbe5 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs @@ -196,8 +196,7 @@ namespace Tango.MachineStudio.UI.ViewModels CheckForUpdatesResponse response = client.CheckForUpdates(new CheckForUpdatesRequest() { - Email = _authentication.CurrentUser.Email, - Password = _authentication.CurrentUser.Password, + Token = _authentication.AccessToken, Version = _application.Version.ToString(), AcceptBetaRelease = settings.AcceptBetaRelease, }).Result; -- cgit v1.3.1 From b50b7ddb4c231810d17e0141bb77437718b10110 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 1 Jan 2019 14:30:20 +0200 Subject: Some more work on environments... --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../MachineStudio.Dispensers/Images/dispensers.png | Bin 205567 -> 171937 bytes .../Tango.MachineStudio.Common/DeploymentSlots.cs | 23 ------------------ .../MachineStudioSettings.cs | 7 +++--- .../Tango.MachineStudio.Common.csproj | 7 ++++-- .../Update/CheckForUpdatesRequest.cs | 4 +-- .../Update/UploadCompletedRequest.cs | 4 +-- .../Tango.MachineStudio.Publisher/MainWindowVM.cs | 2 +- .../Tango.MachineStudio.UI.csproj | 6 ++++- .../ViewModels/AboutViewVM.cs | 4 +++ .../ViewModels/LoginViewVM.cs | 5 ++-- .../ViewModels/MainViewVM.cs | 2 +- .../ViewModels/UpdateViewVM.cs | 2 +- .../Tango.MachineStudio.UI/Views/AboutView.xaml | 15 +++++++++--- .../Tango.MachineStudio.UI/Views/LoginView.xaml | 3 ++- .../PPC/Tango.PPC.Common/DeploymentSlots.cs | 23 ------------------ .../PPC/Tango.PPC.Common/PPCSettings.cs | 7 +++--- .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 7 ++++-- .../Update/UploadCompletedRequest.cs | 4 +-- .../PPC/Tango.PPC.Publisher/MainWindow.xaml | 3 ++- .../PPC/Tango.PPC.Publisher/MainWindowVM.cs | 7 +++--- .../PPC/Tango.PPC.Publisher/PublisherSettings.cs | 3 ++- .../Tango.PPC.Publisher/Tango.PPC.Publisher.csproj | 4 +++ .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 6 ++++- .../Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs | 5 ++-- .../PPC/Tango.PPC.UI/Views/MachineSetupView.xaml | 24 ++++++++++++++++-- .../Tango.BL/ObservablesContextExtension.cs | 9 +++++++ .../Tango.Core/ExtensionMethods/EnumExtensions.cs | 6 +++++ .../Converters/EnumToDescriptionConverter.cs | 9 ++++++- .../Tango.SharedUI/Converters/IsEqualConverter.cs | 2 +- .../Tango.Touch/Controls/TouchListBox.cs | 2 +- .../Tango.Touch/Controls/TouchPanel.xaml | 2 +- .../Tango.Transport/Tango.Transport.csproj | 3 ++- .../Tango.Transport/Web/WebRequestSecureMessage.cs | 13 ++++++++++ Software/Visual_Studio/Tango.Web/DeploymentSlot.cs | 5 ++++ .../Tango.Web/DeploymentSlotAddressAttribute.cs | 19 +++++++++++++++ .../ExtensionMethods/DeploymentSlotExtensions.cs | 20 +++++++++++++++ Software/Visual_Studio/Tango.Web/Tango.Web.csproj | 7 ++++++ Software/Visual_Studio/Tango.Web/WebSettings.cs | 27 +++++++++++++++++++++ .../Controllers/MachineStudioController.cs | 4 +-- .../Controllers/PPCController.cs | 2 +- 44 files changed, 216 insertions(+), 91 deletions(-) delete mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/DeploymentSlots.cs delete mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/DeploymentSlots.cs create mode 100644 Software/Visual_Studio/Tango.Transport/Web/WebRequestSecureMessage.cs create mode 100644 Software/Visual_Studio/Tango.Web/DeploymentSlotAddressAttribute.cs create mode 100644 Software/Visual_Studio/Tango.Web/ExtensionMethods/DeploymentSlotExtensions.cs create mode 100644 Software/Visual_Studio/Tango.Web/WebSettings.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index dc70d8068..22ea0615c 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 677b08812..6c5c1ed1c 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 e1eb01992..2d4a13a9d 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 1324fab93..c16100a75 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/Images/dispensers.png b/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/Images/dispensers.png index 2f9e1ca8b..20f812e00 100644 Binary files a/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/Images/dispensers.png and b/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/Images/dispensers.png differ diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/DeploymentSlots.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/DeploymentSlots.cs deleted file mode 100644 index b2bfabd54..000000000 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/DeploymentSlots.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.MachineStudio.Common -{ - public enum DeploymentSlots - { - [Description("https://machineservice-dev.twine-srv.com")] - Development, - [Description("https://machineservice-test.twine-srv.com")] - Testing, - [Description("https://machineservice-process.twine-srv.com")] - Process, - [Description("https://machineservice-stage.twine-srv.com")] - Staging, - [Description("https://machineservice.twine-srv.com")] - Production - } -} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs index cbaeb9d2e..90fe33958 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using System.Windows; using Tango.Logging; using Tango.Settings; +using Tango.Web; namespace Tango.MachineStudio.Common { @@ -98,7 +99,7 @@ namespace Tango.MachineStudio.Common /// /// Gets or sets the deployment slot. /// - public DeploymentSlots DeploymentSlot { get; set; } + public DeploymentSlot DeploymentSlot { get; set; } /// /// Gets the machine service address. @@ -106,7 +107,7 @@ namespace Tango.MachineStudio.Common /// public String GetMachineServiceAddress() { - return DeploymentSlot.ToDescription(); + return DeploymentSlot.ToAddress(); } /// @@ -119,7 +120,7 @@ namespace Tango.MachineStudio.Common DefaultIssueReportTags = new List(); StudioModulesBounds = new List(); Environment = WorkingEnvironment.Remote; - DeploymentSlot = DeploymentSlots.Development; + DeploymentSlot = DeploymentSlot.DEV; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj index 58a0d5f7e..704223d17 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj @@ -94,7 +94,6 @@ - @@ -269,6 +268,10 @@ {9652f972-2bd1-4283-99cb-fc6240434c17} Tango.Video + + {5001990f-977b-48ff-b217-0236a5022ad8} + Tango.Web + @@ -309,7 +312,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/CheckForUpdatesRequest.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/CheckForUpdatesRequest.cs index cf06e678d..ce700adbf 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/CheckForUpdatesRequest.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/CheckForUpdatesRequest.cs @@ -8,10 +8,8 @@ using Tango.Transport.Web; namespace Tango.MachineStudio.Common.Update { - public class CheckForUpdatesRequest : WebRequestMessage + public class CheckForUpdatesRequest : WebRequestSecureMessage { - public String Token { get; set; } - public String Version { get; set; } public bool AcceptBetaRelease { get; set; } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/UploadCompletedRequest.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/UploadCompletedRequest.cs index fc478db50..d23d57351 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/UploadCompletedRequest.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Update/UploadCompletedRequest.cs @@ -8,8 +8,8 @@ using Tango.Transport.Web; namespace Tango.MachineStudio.Common.Update { - public class UploadCompletedRequest : WebRequestMessage + public class UploadCompletedRequest : WebRequestSecureMessage { - public String Token { get; set; } + } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs index 73f3f5bed..9a109679b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher/MainWindowVM.cs @@ -204,7 +204,7 @@ namespace Tango.MachineStudio.Publisher _client.NotifyUploadCompleted(new UploadCompletedRequest() { - Token = response.Token, + AccessToken = response.Token, }).Wait(); Progress = 0; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index d162f3dd6..fb84d64bd 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -423,6 +423,10 @@ {74e700b0-1156-4126-be40-ee450d3c3026} Tango.Transport + + {5001990f-977b-48ff-b217-0236a5022ad8} + Tango.Web + {f69da3a8-f823-461e-87cf-a9275abc0b15} Tango.MachineStudio.Dispensers @@ -614,7 +618,7 @@ copy /Y "$(SolutionDir)Referenced Assemblies\Microsoft.WITDataStore32.dll" "$(Ta - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/AboutViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/AboutViewVM.cs index e8d33b0ca..c05ce9982 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/AboutViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/AboutViewVM.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL; using Tango.Core; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.StudioApplication; @@ -19,11 +20,14 @@ namespace Tango.MachineStudio.UI.ViewModels public MachineStudioSettings MachineStudioSettings { get; set; } + public DataSource DataSource { get; set; } + public AboutViewVM(IStudioApplicationManager applicationManager) { ApplicationManager = applicationManager; Settings = SettingsManager.Default.GetOrCreate(); MachineStudioSettings = SettingsManager.Default.GetOrCreate(); + DataSource = ObservablesContext.GetActualDataSource(); } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs index edae820e7..492e23963 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs @@ -17,6 +17,7 @@ using Tango.MachineStudio.Common.Navigation; using Tango.MachineStudio.Common.Notifications; using Tango.Settings; using Tango.SharedUI; +using Tango.Web; namespace Tango.MachineStudio.UI.ViewModels { @@ -56,11 +57,11 @@ namespace Tango.MachineStudio.UI.ViewModels set { _password = value; RaisePropertyChangedAuto(); } } - private DeploymentSlots _deploymentSlot; + private DeploymentSlot _deploymentSlot; /// /// Gets or sets the deployment slot. /// - public DeploymentSlots DeploymentSlot + public DeploymentSlot DeploymentSlot { get { return _deploymentSlot; } set { _deploymentSlot = value; RaisePropertyChangedAuto(); } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index 818d507ae..e3a8b4e7c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -363,7 +363,7 @@ namespace Tango.MachineStudio.UI.ViewModels CheckForUpdatesResponse response = client.CheckForUpdates(new CheckForUpdatesRequest() { - Token = _authenticationProvider.AccessToken, + AccessToken = _authenticationProvider.AccessToken, Version = _applicationManager.Version.ToString(), AcceptBetaRelease = _settings.AcceptBetaRelease, }).Result; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs index e19dcdbe5..60a023071 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs @@ -196,7 +196,7 @@ namespace Tango.MachineStudio.UI.ViewModels CheckForUpdatesResponse response = client.CheckForUpdates(new CheckForUpdatesRequest() { - Token = _authentication.AccessToken, + AccessToken = _authentication.AccessToken, Version = _application.Version.ToString(), AcceptBetaRelease = settings.AcceptBetaRelease, }).Result; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml index 682cc9ed9..696cc051f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml @@ -12,6 +12,7 @@ + @@ -42,20 +43,28 @@ - + Machine Studio: v Core Libraries: v Build Date: + Environment Mode: + + Environment Slot: + + Machine Service: + Data Source: - + + () + Allow BETA Updates: - + Change Log: diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml index c344e867a..b479dd03f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml @@ -6,6 +6,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:web="clr-namespace:Tango.Web;assembly=Tango.Web" xmlns:automation="clr-namespace:Tango.MachineStudio.Common.Automation;assembly=Tango.MachineStudio.Common" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:helpers="clr-namespace:Tango.SharedUI.Helpers;assembly=Tango.SharedUI" @@ -48,7 +49,7 @@ - + Remember me diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/DeploymentSlots.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/DeploymentSlots.cs deleted file mode 100644 index b2c14ec3c..000000000 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/DeploymentSlots.cs +++ /dev/null @@ -1,23 +0,0 @@ -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-process.twine-srv.com")] - Process, - [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 81168d235..7ef9f9fdc 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -6,6 +6,7 @@ using System.Text; using System.Threading.Tasks; using Tango.Logging; using Tango.Settings; +using Tango.Web; namespace Tango.PPC.Common { @@ -68,7 +69,7 @@ namespace Tango.PPC.Common /// /// Gets or sets the deployment slot. /// - public DeploymentSlots DeploymentSlot { get; set; } + public DeploymentSlot DeploymentSlot { get; set; } /// /// Gets the machine service address. @@ -76,7 +77,7 @@ namespace Tango.PPC.Common /// public String GetMachineServiceAddress() { - return DeploymentSlot.ToDescription(); + return DeploymentSlot.ToAddress(); } /// @@ -89,7 +90,7 @@ namespace Tango.PPC.Common EmbeddedComPort = null; ExternalBridgePassword = "Aa123456"; HotSpotPassword = "Aa123456"; - DeploymentSlot = DeploymentSlots.Production; + DeploymentSlot = DeploymentSlot.PROD; } } } 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 2f04e21ef..d73829bb8 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,7 +125,6 @@ TwineCatalogControl.xaml - @@ -319,6 +318,10 @@ {74e700b0-1156-4126-be40-ee450d3c3026} Tango.Transport + + {5001990f-977b-48ff-b217-0236a5022ad8} + Tango.Web + {6aa425c9-ea6a-4b01-aaed-5ff122e8b663} Tango.WiFi @@ -347,7 +350,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/UploadCompletedRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/UploadCompletedRequest.cs index 55e733e04..dab9bcefd 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/UploadCompletedRequest.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Update/UploadCompletedRequest.cs @@ -8,8 +8,8 @@ using Tango.Transport.Web; namespace Tango.PPC.Common.Update { - public class UploadCompletedRequest : WebRequestMessage + public class UploadCompletedRequest : WebRequestSecureMessage { - public String Token { get; set; } + } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Publisher/MainWindow.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Publisher/MainWindow.xaml index e34b82396..830c4c585 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Publisher/MainWindow.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Publisher/MainWindow.xaml @@ -7,6 +7,7 @@ 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:web="clr-namespace:Tango.Web;assembly=Tango.Web" xmlns:local="clr-namespace:Tango.PPC.Publisher" mc:Ignorable="d" Title="Tango PPC Publisher" Height="1100" Width="500" d:DataContext="{d:DesignInstance Type=local:MainWindowVM, IsDesignTimeCreatable=False}"> @@ -30,7 +31,7 @@ Deployment Slot: - + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Publisher/MainWindowVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.Publisher/MainWindowVM.cs index e11d01318..b2abd9466 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Publisher/MainWindowVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Publisher/MainWindowVM.cs @@ -28,6 +28,7 @@ using Tango.Settings; using Tango.SharedUI; using Tango.SQLExaminer; using Tango.Transport.Web; +using Tango.Web; namespace Tango.PPC.Publisher { @@ -122,8 +123,8 @@ namespace Tango.PPC.Publisher set { _password = value; RaisePropertyChangedAuto(); } } - private DeploymentSlots _deplotmentSlot; - public DeploymentSlots DeploymentSlot + private DeploymentSlot _deplotmentSlot; + public DeploymentSlot DeploymentSlot { get { return _deplotmentSlot; } set { _deplotmentSlot = value; RaisePropertyChangedAuto(); OnDeploymentSlotChanged(); } @@ -262,7 +263,7 @@ namespace Tango.PPC.Publisher await _client.NotifyUploadCompleted(new UploadCompletedRequest() { - Token = response.Token, + AccessToken = response.Token, }); Progress = 0; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Publisher/PublisherSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Publisher/PublisherSettings.cs index 6caf8a2f6..de6fe920b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Publisher/PublisherSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Publisher/PublisherSettings.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using Tango.PPC.Common; using Tango.Settings; +using Tango.Web; namespace Tango.PPC.Publisher { @@ -16,7 +17,7 @@ namespace Tango.PPC.Publisher public String BuildConfiguration { get; set; } - public DeploymentSlots DeploymentSlot { get; set; } + public DeploymentSlot DeploymentSlot { get; set; } public PublisherSettings() { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Publisher/Tango.PPC.Publisher.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Publisher/Tango.PPC.Publisher.csproj index 9a4b8b595..0c465546c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Publisher/Tango.PPC.Publisher.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Publisher/Tango.PPC.Publisher.csproj @@ -148,6 +148,10 @@ {74e700b0-1156-4126-be40-ee450d3c3026} Tango.Transport + + {5001990f-977b-48ff-b217-0236a5022ad8} + Tango.Web + {0be74eee-22cb-4dba-b896-793b9e1a3ac0} Tango.PPC.Common 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 2c2ab061e..93a2e6c6a 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 @@ -335,6 +335,10 @@ {74e700b0-1156-4126-be40-ee450d3c3026} Tango.Transport + + {5001990f-977b-48ff-b217-0236a5022ad8} + Tango.Web + {6aa425c9-ea6a-4b01-aaed-5ff122e8b663} Tango.WiFi @@ -487,7 +491,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 6cf08a43a..f5c6f43b9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs @@ -23,6 +23,7 @@ using Tango.Settings; using Tango.SharedUI.Helpers; using Tango.SQLExaminer; using Tango.Transport.Adapters; +using Tango.Web; namespace Tango.PPC.UI.ViewModels { @@ -131,11 +132,11 @@ namespace Tango.PPC.UI.ViewModels set { _selectedTimeZone = value; RaisePropertyChangedAuto(); } } - private DeploymentSlots _deploymentSlot; + private DeploymentSlot _deploymentSlot; /// /// Gets or sets the deployment slot. /// - public DeploymentSlots DeploymentSlot + public DeploymentSlot DeploymentSlot { get { return _deploymentSlot; } set { _deploymentSlot = value; RaisePropertyChangedAuto(); } 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 df50133fd..13f163ef5 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml @@ -9,6 +9,7 @@ xmlns:setup="clr-namespace:Tango.PPC.Common.MachineSetup;assembly=Tango.PPC.Common" xmlns:connectivity="clr-namespace:Tango.PPC.Common.Connectivity;assembly=Tango.PPC.Common" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:web="clr-namespace:Tango.Web;assembly=Tango.Web" xmlns:local="clr-namespace:Tango.PPC.UI.Views" xmlns:common="clr-namespace:Tango.PPC.Common;assembly=Tango.PPC.Common" mc:Ignorable="d" @@ -86,8 +87,27 @@ Please select the machine working environment - - + + + + + + + + + + + + + + + CONTINUE diff --git a/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs b/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs index 3fb827ce8..0bd002f60 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs @@ -187,5 +187,14 @@ namespace Tango.BL { _override_datasource = dataSource; } + + /// + /// Gets the actual data source (settings or overridden). + /// + /// + public static DataSource GetActualDataSource() + { + return _override_datasource != null ? _override_datasource : SettingsManager.Default.GetOrCreate().DataSource; + } } } diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/EnumExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/EnumExtensions.cs index e5beea90a..db3f7dc3d 100644 --- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/EnumExtensions.cs +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/EnumExtensions.cs @@ -29,6 +29,12 @@ public static class EnumExtensions return value.ToString(); } + public static T GetAttribute(this Enum value) where T : Attribute + { + FieldInfo fi = value.GetType().GetField(value.ToString()); + return fi.GetCustomAttribute(); + } + /// /// Gets the enum integer value. /// diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/EnumToDescriptionConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/EnumToDescriptionConverter.cs index 797d5c2e4..d907595de 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Converters/EnumToDescriptionConverter.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/EnumToDescriptionConverter.cs @@ -28,7 +28,14 @@ namespace Tango.SharedUI.Converters /// public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { - return GetDescription(value, value.ToString()); + if (value != null) + { + return GetDescription(value, value.ToString()); + } + else + { + return null; + } } public static string GetDescription(object enumValue, string defDesc) diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/IsEqualConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/IsEqualConverter.cs index 4d3563681..c5de0a83f 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Converters/IsEqualConverter.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/IsEqualConverter.cs @@ -14,7 +14,7 @@ namespace Tango.SharedUI.Converters { if (values != null && values.Length > 0) { - return values.All(x => x == values.First()); + return values.All(x => x.Equals(values.First())); } return false; diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchListBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchListBox.cs index 29df0129c..a64a70e4e 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchListBox.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchListBox.cs @@ -315,7 +315,7 @@ namespace Tango.Touch.Controls { var items = GetItems(); items.ForEach(x => x.IsSelected = false); - var item = items.FirstOrDefault(x => x.DataContext == SelectedItem); + var item = items.FirstOrDefault(x => x.DataContext.Equals(SelectedItem)); if (item != null) { diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml index 77eb794a0..c9d6bd466 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml @@ -74,7 +74,7 @@ - + diff --git a/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj b/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj index 4e677a041..9591c8bdb 100644 --- a/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj +++ b/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj @@ -116,6 +116,7 @@ + @@ -145,7 +146,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Transport/Web/WebRequestSecureMessage.cs b/Software/Visual_Studio/Tango.Transport/Web/WebRequestSecureMessage.cs new file mode 100644 index 000000000..33644208e --- /dev/null +++ b/Software/Visual_Studio/Tango.Transport/Web/WebRequestSecureMessage.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Transport.Web +{ + public class WebRequestSecureMessage : WebRequestMessage + { + public String AccessToken { get; set; } + } +} diff --git a/Software/Visual_Studio/Tango.Web/DeploymentSlot.cs b/Software/Visual_Studio/Tango.Web/DeploymentSlot.cs index 7ec7ab82e..6531adb64 100644 --- a/Software/Visual_Studio/Tango.Web/DeploymentSlot.cs +++ b/Software/Visual_Studio/Tango.Web/DeploymentSlot.cs @@ -10,14 +10,19 @@ namespace Tango.Web public enum DeploymentSlot { [Description("Development")] + [DeploymentSlotAddress("https://machineservice-dev.twine-srv.com")] DEV, [Description("Testing")] + [DeploymentSlotAddress("https://machineservice-test.twine-srv.com")] TEST, [Description("Process")] + [DeploymentSlotAddress("https://machineservice-process.twine-srv.com")] PROCESS, [Description("Staging")] + [DeploymentSlotAddress("https://machineservice-stage.twine-srv.com")] STAGE, [Description("Production")] + [DeploymentSlotAddress("https://machineservice.twine-srv.com")] PROD } } diff --git a/Software/Visual_Studio/Tango.Web/DeploymentSlotAddressAttribute.cs b/Software/Visual_Studio/Tango.Web/DeploymentSlotAddressAttribute.cs new file mode 100644 index 000000000..c58c7a8b0 --- /dev/null +++ b/Software/Visual_Studio/Tango.Web/DeploymentSlotAddressAttribute.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Web +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false)] + public class DeploymentSlotAddressAttribute : Attribute + { + public DeploymentSlotAddressAttribute(String address) + { + Address = address; + } + + public String Address { get; set; } + } +} diff --git a/Software/Visual_Studio/Tango.Web/ExtensionMethods/DeploymentSlotExtensions.cs b/Software/Visual_Studio/Tango.Web/ExtensionMethods/DeploymentSlotExtensions.cs new file mode 100644 index 000000000..04e5ac300 --- /dev/null +++ b/Software/Visual_Studio/Tango.Web/ExtensionMethods/DeploymentSlotExtensions.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Web; + +public static class DeploymentSlotExtensions +{ + /// + /// Gets the deployment slot web address. + /// + /// The slot. + /// + public static String ToAddress(this DeploymentSlot slot) + { + return slot.GetAttribute().Address; + } +} + diff --git a/Software/Visual_Studio/Tango.Web/Tango.Web.csproj b/Software/Visual_Studio/Tango.Web/Tango.Web.csproj index d9a1d1dd1..d0d30482d 100644 --- a/Software/Visual_Studio/Tango.Web/Tango.Web.csproj +++ b/Software/Visual_Studio/Tango.Web/Tango.Web.csproj @@ -246,6 +246,8 @@ + + @@ -260,6 +262,7 @@ + @@ -282,6 +285,10 @@ {e4927038-348d-4295-aaf4-861c58cb3943} Tango.PMR + + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} + Tango.Settings + diff --git a/Software/Visual_Studio/Tango.Web/WebSettings.cs b/Software/Visual_Studio/Tango.Web/WebSettings.cs new file mode 100644 index 000000000..fdc92810c --- /dev/null +++ b/Software/Visual_Studio/Tango.Web/WebSettings.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Settings; +using System.Reflection; + +namespace Tango.Web +{ + public class WebSettings : SettingsBase + { + /// + /// Gets or sets the deployment slot. + /// + public DeploymentSlot DeploymentSlot { get; set; } + + /// + /// Gets the machine service address. + /// + /// + public String GetMachineServiceAddress() + { + return DeploymentSlot.GetAttribute().Address; + } + } +} diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs index 4aff8fd39..c9d7ea8b6 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs @@ -51,7 +51,7 @@ namespace Tango.MachineService.Controllers using (ObservablesContext db = ObservablesContextHelper.CreateContext()) { - if (_tokens_manager.Exists(request.Token)) + if (_tokens_manager.Exists(request.AccessToken)) { var versions = db.MachineStudioVersions.ToList(); @@ -152,7 +152,7 @@ namespace Tango.MachineService.Controllers [HttpPost] public UploadCompletedResponse NotifyUploadCompleted(UploadCompletedRequest request) { - MachineStudioPendingUpload upload = _pendingUploads.FirstOrDefault(x => x.Token == request.Token); + MachineStudioPendingUpload upload = _pendingUploads.FirstOrDefault(x => x.Token == request.AccessToken); if (upload != null) { diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index 18e2edb0c..6d591edd8 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -355,7 +355,7 @@ namespace Tango.MachineService.Controllers [HttpPost] public UploadCompletedResponse NotifyUploadCompleted(UploadCompletedRequest request) { - PPCPendingUpload upload = _pendingUploads.FirstOrDefault(x => x.Token == request.Token); + PPCPendingUpload upload = _pendingUploads.FirstOrDefault(x => x.Token == request.AccessToken); if (upload != null) { -- cgit v1.3.1