From 4954a924b8a5b8fd7a213a444027e74b936359be Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 16 Oct 2019 17:31:51 +0300 Subject: Added support for token authentication from MS to DB. --- .../Tango.MachineStudio.Common.csproj | 4 +++- .../Web/MachineStudioWebClientBase.cs | 9 +++++++++ .../Tango.MachineStudio.Common/Web/RefreshTokenRequest.cs | 14 ++++++++++++++ .../Web/RefreshTokenResponse.cs | 15 +++++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/RefreshTokenRequest.cs create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/RefreshTokenResponse.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common') 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 62f2dc984..7c0851d01 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 @@ -145,6 +145,8 @@ + + @@ -388,7 +390,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/MachineStudioWebClientBase.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/MachineStudioWebClientBase.cs index 665d25ccb..131f89515 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/MachineStudioWebClientBase.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/MachineStudioWebClientBase.cs @@ -85,5 +85,14 @@ namespace Tango.MachineStudio.Common.Web return Post("GetLatestVersion", request); } + /// + /// Executes the RefreshToken action and returns Tango.MachineStudio.Common.Web.RefreshTokenResponse. + /// + /// + public Task RefreshToken(Tango.MachineStudio.Common.Web.RefreshTokenRequest request) + { + return Post("RefreshToken", request); + } + } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/RefreshTokenRequest.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/RefreshTokenRequest.cs new file mode 100644 index 000000000..3745cbae1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/RefreshTokenRequest.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.MachineStudio.Common.Web +{ + public class RefreshTokenRequest : WebRequestMessage + { + + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/RefreshTokenResponse.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/RefreshTokenResponse.cs new file mode 100644 index 000000000..c7fcef5cb --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/RefreshTokenResponse.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Transport.Web; + +namespace Tango.MachineStudio.Common.Web +{ + public class RefreshTokenResponse : WebResponseMessage + { + public String AccessToken { get; set; } + public DateTime Expiration { get; set; } + } +} -- cgit v1.3.1 From 88f609c6244121f07b45e8101174fdc293bbcb2d Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 27 Oct 2019 13:19:32 +0200 Subject: Removed rollback version in machine studio. Omitted remove old dll files from machine studio updater. Removed ColorCapture module from MS update to reduce package size. Added ColorCapture module only to MS installer. Added ExternalBridge default timeout to machine studio settings file. --- .../Machine Studio Installer.aip | 316 ++++++++------------- .../Tango.MachineStudio.ColorCapture.csproj | 4 +- .../MachineStudioSettings.cs | 6 + .../Properties/AssemblyInfo.cs | 2 +- .../Tango.MachineStudio.UI.csproj | 10 +- .../ViewModels/MainViewVM.cs | 1 + .../ViewModels/UpdateViewVM.cs | 76 ++--- .../Tango.MachineStudio.UI/Views/UpdateView.xaml | 8 +- .../Tango.MachineStudio.Updater/MainWindow.xaml.cs | 34 +-- 9 files changed, 185 insertions(+), 272 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common') diff --git a/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip b/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip index a1d7a5e2b..182757d06 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip +++ b/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer.aip @@ -15,10 +15,10 @@ - + - + @@ -45,9 +45,9 @@ - - - + + + @@ -61,9 +61,9 @@ - - - + + + @@ -73,18 +73,10 @@ - - - - - - - - - + @@ -113,7 +105,6 @@ - @@ -128,9 +119,7 @@ - - @@ -139,7 +128,6 @@ - @@ -147,11 +135,8 @@ - - - @@ -163,18 +148,13 @@ - - - - - @@ -201,7 +181,6 @@ - @@ -218,23 +197,15 @@ - - - - - - - - @@ -242,25 +213,19 @@ - - - - - - @@ -288,7 +253,7 @@ - + @@ -313,77 +278,73 @@ - - + + - - + + - - - + + - - - - - + + - - - - - - - - + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - + - + - - - + + + @@ -391,15 +352,15 @@ - + - - - + + + @@ -414,20 +375,11 @@ - - - - - - - - - - - + + @@ -452,13 +404,11 @@ - - @@ -476,9 +426,7 @@ - - @@ -487,7 +435,6 @@ - @@ -496,11 +443,8 @@ - - - @@ -512,18 +456,13 @@ - - - - - @@ -551,7 +490,6 @@ - @@ -568,23 +506,15 @@ - - - - - - - - @@ -592,25 +522,19 @@ - - - - - - @@ -630,7 +554,7 @@ - + @@ -671,9 +595,9 @@ - - - + + + @@ -743,16 +667,16 @@ - - - - - - + + + + + + - - - + + + @@ -766,68 +690,57 @@ - - - - + + - - - - - - - - + + - - - - - - - - + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - + @@ -843,7 +756,7 @@ - + @@ -919,6 +832,7 @@ + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj index 8f37a9c2d..4e6feceb5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj @@ -18,7 +18,7 @@ true full false - ..\..\..\Build\Machine Studio\Debug\ + bin\Debug\ DEBUG;TRACE prompt 4 @@ -26,7 +26,7 @@ pdbonly true - ..\..\..\Build\Machine Studio\Release\ + bin\Release\ TRACE prompt 4 diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs index 781e034e8..c307a8e33 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs @@ -129,6 +129,11 @@ namespace Tango.MachineStudio.Common /// public TimeSpan MaximumCacheTime { get; set; } + /// + /// Gets or sets the external bridge request timeout. + /// + public TimeSpan ExternalBridgeRequestTimeout { get; set; } + /// /// Gets the machine service address. /// @@ -167,6 +172,7 @@ namespace Tango.MachineStudio.Common CachingMode = ObservablesContextInMemoryCachingMode.None; Theme = MachineStudioTheme.Light; JobUnitsMethod = JobUnitsMethods.Operator; + ExternalBridgeRequestTimeout = TimeSpan.FromSeconds(5); } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index 91792e0f3..c268cb607 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("4.0.29.0")] +[assembly: AssemblyVersion("4.0.30.0")] [assembly: ComVisible(false)] \ No newline at end of file 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 e172bbc91..b542821d7 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 @@ -440,10 +440,6 @@ {5001990f-977b-48ff-b217-0236a5022ad8} Tango.Web - - {f209fae8-73f9-441b-97f4-0844a0279390} - Tango.TCC.BL - {f69da3a8-f823-461e-87cf-a9275abc0b15} Tango.MachineStudio.Dispensers @@ -452,10 +448,6 @@ {7d0fce3c-9a37-439c-9f9f-b26cfd6a8a33} Tango.MachineStudio.Catalogs - - {1b87ca53-50bd-4c48-a8c7-fbb9f1419aff} - Tango.MachineStudio.ColorCapture - {4d183aca-552b-4135-ae81-7c5a8e5fc3b1} Tango.MachineStudio.ColorLab @@ -649,7 +641,7 @@ if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)ProtoCompilers\" - + \ No newline at end of file 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 b22d65192..90fe25c8f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -459,6 +459,7 @@ namespace Tango.MachineStudio.UI.ViewModels if (x.SelectedMachine is ExternalBridgeTcpClient) { x.SelectedMachine.As().EnableApplicationLogs = x.EnableApplicationLogs; + x.SelectedMachine.RequestTimeout = _settings.ExternalBridgeRequestTimeout; } if (x.SelectedMachine.RequiresAuthentication) 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 4a94322fb..2ee8574b1 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs @@ -173,7 +173,7 @@ namespace Tango.MachineStudio.UI.ViewModels DownloadLatestVersionResponse response = await _machineStudioWebClient.DownloadLatestVersion(new DownloadLatestVersionRequest() { - + }); _updateInfo = new CheckForUpdatesResponse(); @@ -272,7 +272,7 @@ namespace Tango.MachineStudio.UI.ViewModels using (StorageBlobDownloader downloader = new StorageBlobDownloader(_updateInfo.BlobAddress, tempFile.Path)) { - downloader.Progress += (x, e) => + downloader.Progress += (x, e) => { InvokeUINow(() => { @@ -326,40 +326,40 @@ namespace Tango.MachineStudio.UI.ViewModels } } - try - { - LogManager.Log("Backing up current version..."); - CurrentUpdateFile = "Backing up current version..."; - - String rollbackFolder = GetRollbackFolder(); - Directory.CreateDirectory(rollbackFolder); - - String backFile = GetRollbackFile(); - - if (File.Exists(backFile)) - { - File.Delete(backFile); - } - - using (ZipFile backZip = new ZipFile(backFile)) - { - int currentEntry = 0; - - backZip.SaveProgress += (_, e) => - { - UpdateProgress = ((double)(currentEntry++) / (double)backZip.Entries.Count) * 100d; - }; - - backZip.Password = "Aa123456"; - backZip.AddDirectory(_appPath); - backZip.Save(); - } - } - catch (Exception ex) - { - LogManager.Log(ex, "Could not construct rollback."); - _notification.ShowWarning("Update center has failed to construct a rollback point for the current version. Version rollback will not be available."); - } + //try + //{ + // LogManager.Log("Backing up current version..."); + // CurrentUpdateFile = "Backing up current version..."; + + // String rollbackFolder = GetRollbackFolder(); + // Directory.CreateDirectory(rollbackFolder); + + // String backFile = GetRollbackFile(); + + // if (File.Exists(backFile)) + // { + // File.Delete(backFile); + // } + + // using (ZipFile backZip = new ZipFile(backFile)) + // { + // int currentEntry = 0; + + // backZip.SaveProgress += (_, e) => + // { + // UpdateProgress = ((double)(currentEntry++) / (double)backZip.Entries.Count) * 100d; + // }; + + // backZip.Password = "Aa123456"; + // backZip.AddDirectory(_appPath); + // backZip.Save(); + // } + //} + //catch (Exception ex) + //{ + // LogManager.Log(ex, "Could not construct rollback."); + // _notification.ShowWarning("Update center has failed to construct a rollback point for the current version. Version rollback will not be available."); + //} TangoIOC.Default.GetInstance().DisableCheckForUpdates = true; Status = UpdateStatus.UpdateCompleted; @@ -385,8 +385,8 @@ namespace Tango.MachineStudio.UI.ViewModels { try { - LogManager.Log("Clearing EF model store..."); - ObservablesContext.ClearModelStore(); + //LogManager.Log("Clearing EF model store..."); + //ObservablesContext.ClearModelStore(); Process p = new Process(); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/UpdateView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/UpdateView.xaml index a35928e12..924db7f8b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/UpdateView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/UpdateView.xaml @@ -109,12 +109,12 @@ -