diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-01-01 14:30:20 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-01-01 14:30:20 +0200 |
| commit | b50b7ddb4c231810d17e0141bb77437718b10110 (patch) | |
| tree | c16de7bd470703301740ccd2b0f39bed4304a6c1 /Software/Visual_Studio | |
| parent | 3415150ae12893d4f08d1afde512624755996095 (diff) | |
| download | Tango-b50b7ddb4c231810d17e0141bb77437718b10110.tar.gz Tango-b50b7ddb4c231810d17e0141bb77437718b10110.zip | |
Some more work on environments...
Diffstat (limited to 'Software/Visual_Studio')
40 files changed, 216 insertions, 91 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/Images/dispensers.png b/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/Images/dispensers.png Binary files differindex 2f9e1ca8b..20f812e00 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/Images/dispensers.png +++ b/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/Images/dispensers.png 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 /// <summary> /// Gets or sets the deployment slot. /// </summary> - public DeploymentSlots DeploymentSlot { get; set; } + public DeploymentSlot DeploymentSlot { get; set; } /// <summary> /// Gets the machine service address. @@ -106,7 +107,7 @@ namespace Tango.MachineStudio.Common /// <returns></returns> public String GetMachineServiceAddress() { - return DeploymentSlot.ToDescription(); + return DeploymentSlot.ToAddress(); } /// <summary> @@ -119,7 +120,7 @@ namespace Tango.MachineStudio.Common DefaultIssueReportTags = new List<string>(); StudioModulesBounds = new List<StudioModuleBounds>(); 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 @@ <Compile Include="Controls\TableGrid.cs" /> <Compile Include="Converters\PermissionToVisibilityConverter.cs" /> <None Include="Converters\SecondsToGraphPointsConverter.cs" /> - <Compile Include="DeploymentSlots.cs" /> <Compile Include="Diagnostics\DefaultDiagnosticsFrameProvider.cs" /> <Compile Include="Diagnostics\IDiagnosticsFrameProvider.cs" /> <Compile Include="EventLogging\DefaultEventLogger.cs" /> @@ -269,6 +268,10 @@ <Project>{9652f972-2bd1-4283-99cb-fc6240434c17}</Project> <Name>Tango.Video</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.Web\Tango.Web.csproj"> + <Project>{5001990f-977b-48ff-b217-0236a5022ad8}</Project> + <Name>Tango.Web</Name> + </ProjectReference> </ItemGroup> <ItemGroup> <EmbeddedResource Include="bip.wav" /> @@ -309,7 +312,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ 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 @@ <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> <Name>Tango.Transport</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.Web\Tango.Web.csproj"> + <Project>{5001990f-977b-48ff-b217-0236a5022ad8}</Project> + <Name>Tango.Web</Name> + </ProjectReference> <ProjectReference Include="..\Modules\MachineStudio.Dispensers\Tango.MachineStudio.Dispensers.csproj"> <Project>{f69da3a8-f823-461e-87cf-a9275abc0b15}</Project> <Name>Tango.MachineStudio.Dispensers</Name> @@ -614,7 +618,7 @@ copy /Y "$(SolutionDir)Referenced Assemblies\Microsoft.WITDataStore32.dll" "$(Ta </Target> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="True" BuildVersion_UpdateFileVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.DeltaBaseYearDayOfYear" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_BuildVersioningStyle="None.None.Increment.DeltaBaseYearDayOfYear" BuildVersion_UpdateFileVersion="True" BuildVersion_DetectChanges="True" BuildVersion_UseGlobalSettings="False" /> </VisualStudio> </ProjectExtensions> </Project>
\ 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<CoreSettings>(); MachineStudioSettings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); + 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; /// <summary> /// Gets or sets the deployment slot. /// </summary> - 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 @@ <UserControl.Resources> <converters:VersionToShortVersionConverter x:Key="VersionToShortVersionConverter" /> + <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" /> </UserControl.Resources> <Grid> @@ -42,20 +43,28 @@ - <controls:TableGrid RowHeight="25" Height="150" DockPanel.Dock="Top"> + <controls:TableGrid RowHeight="25" DockPanel.Dock="Top"> <TextBlock FontWeight="SemiBold">Machine Studio:</TextBlock> <TextBlock><Run>v</Run><Run Text="{Binding ApplicationManager.Version,Mode=OneWay}"></Run></TextBlock> <TextBlock FontWeight="SemiBold">Core Libraries:</TextBlock> <TextBlock><Run>v</Run><Run Text="{Binding ApplicationManager.CoreVersion,Mode=OneWay}"></Run></TextBlock> <TextBlock FontWeight="SemiBold">Build Date:</TextBlock> <TextBlock Text="{Binding ApplicationManager.BuildDate,Mode=OneWay}"></TextBlock> + <TextBlock FontWeight="SemiBold">Environment Mode:</TextBlock> + <TextBlock Text="{Binding MachineStudioSettings.Environment,Mode=OneWay}"></TextBlock> + <TextBlock FontWeight="SemiBold">Environment Slot:</TextBlock> + <TextBlock Text="{Binding MachineStudioSettings.DeploymentSlot,Mode=OneWay}"></TextBlock> + <TextBlock FontWeight="SemiBold">Machine Service:</TextBlock> + <TextBlock Text="{Binding MachineStudioSettings.DeploymentSlot,Converter={StaticResource EnumToDescriptionConverter},Mode=OneWay}"></TextBlock> <TextBlock FontWeight="SemiBold">Data Source:</TextBlock> - <TextBlock Text="{Binding Settings.DataSource.Address,Mode=OneWay}"></TextBlock> + <TextBlock><Run Text="{Binding DataSource.Address,Mode=OneWay}"></Run> + <Run>(</Run><Run Foreground="Gray" Text="{Binding DataSource.Catalog,Mode=OneWay}"></Run><Run>)</Run> + </TextBlock> <TextBlock FontWeight="SemiBold">Allow BETA Updates:</TextBlock> <ToggleButton IsChecked="{Binding MachineStudioSettings.AcceptBetaRelease,Mode=TwoWay}" HorizontalAlignment="Left" VerticalAlignment="Bottom"></ToggleButton> </controls:TableGrid> - <DockPanel> + <DockPanel Margin="0 0 0 0"> <TextBlock DockPanel.Dock="Top" FontWeight="SemiBold">Change Log:</TextBlock> <TextBox Margin="0 5 0 0" Style="{x:Null}" IsReadOnly="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" TextWrapping="Wrap" AcceptsReturn="True" Foreground="DimGray" Text="{Binding ApplicationManager.ChangeLog,Mode=OneWay}"> 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 @@ </DockPanel> <DockPanel Margin="0 40 0 0"> <materialDesign:PackIcon Margin="0 0 0 0" Width="20" Height="20" VerticalAlignment="Top" Foreground="{Binding ElementName=combo, Path=BorderBrush}" Kind="Settings" /> - <ComboBox x:Name="combo" ItemsSource="{Binding Source={x:Type common:DeploymentSlots},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding DeploymentSlot}" SelectedValuePath="Value" DisplayMemberPath="Value" Margin="5 0 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Environment" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="20" /> + <ComboBox x:Name="combo" ItemsSource="{Binding Source={x:Type web:DeploymentSlot},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding DeploymentSlot}" SelectedValuePath="Value" DisplayMemberPath="DisplayName" Margin="5 0 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Environment" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="20" /> </DockPanel> <CheckBox Margin="25 20 0 0" IsChecked="{Binding RememberMe}">Remember me</CheckBox> </StackPanel> 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 /// <summary> /// Gets or sets the deployment slot. /// </summary> - public DeploymentSlots DeploymentSlot { get; set; } + public DeploymentSlot DeploymentSlot { get; set; } /// <summary> /// Gets the machine service address. @@ -76,7 +77,7 @@ namespace Tango.PPC.Common /// <returns></returns> public String GetMachineServiceAddress() { - return DeploymentSlot.ToDescription(); + return DeploymentSlot.ToAddress(); } /// <summary> @@ -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 @@ <Compile Include="Controls\TwineCatalogControl.xaml.cs"> <DependentUpon>TwineCatalogControl.xaml</DependentUpon> </Compile> - <Compile Include="DeploymentSlots.cs" /> <Compile Include="ExtensionMethods\IListExtensions.cs" /> <Compile Include="ExtensionMethods\ObservableCollectionExtensions.cs" /> <Compile Include="ExternalBridge\IPPCExternalBridgeService.cs" /> @@ -319,6 +318,10 @@ <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> <Name>Tango.Transport</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.Web\Tango.Web.csproj"> + <Project>{5001990f-977b-48ff-b217-0236a5022ad8}</Project> + <Name>Tango.Web</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.WiFi\Tango.WiFi.csproj"> <Project>{6aa425c9-ea6a-4b01-aaed-5ff122e8b663}</Project> <Name>Tango.WiFi</Name> @@ -347,7 +350,7 @@ </Target> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ 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 @@ <DockPanel Margin="0 40 0 0"> <TextBlock VerticalAlignment="Center" Width="136" DockPanel.Dock="Left">Deployment Slot:</TextBlock> - <ComboBox x:Name="combo" ItemsSource="{Binding Source={x:Type common:DeploymentSlots},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding DeploymentSlot}" SelectedValuePath="Value" DisplayMemberPath="Value" Margin="5 0 0 0" /> + <ComboBox x:Name="combo" ItemsSource="{Binding Source={x:Type web:DeploymentSlot},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding DeploymentSlot}" SelectedValuePath="Value" DisplayMemberPath="DisplayName" Margin="5 0 0 0" /> </DockPanel> <DockPanel Margin="0 20 0 0"> 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 @@ <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> <Name>Tango.Transport</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.Web\Tango.Web.csproj"> + <Project>{5001990f-977b-48ff-b217-0236a5022ad8}</Project> + <Name>Tango.Web</Name> + </ProjectReference> <ProjectReference Include="..\Tango.PPC.Common\Tango.PPC.Common.csproj"> <Project>{0be74eee-22cb-4dba-b896-793b9e1a3ac0}</Project> <Name>Tango.PPC.Common</Name> 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 @@ <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> <Name>Tango.Transport</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.Web\Tango.Web.csproj"> + <Project>{5001990f-977b-48ff-b217-0236a5022ad8}</Project> + <Name>Tango.Web</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.WiFi\Tango.WiFi.csproj"> <Project>{6aa425c9-ea6a-4b01-aaed-5ff122e8b663}</Project> <Name>Tango.WiFi</Name> @@ -487,7 +491,7 @@ del "$(TargetDir)firmware_package.tfp"</PostBuildEvent> </PropertyGroup> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ 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; /// <summary> /// Gets or sets the deployment slot. /// </summary> - 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 @@ <Image Source="/Images/environment.png" Width="128" /> <TextBlock Margin="0 20 0 0" HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Please select the machine working environment</TextBlock> - <touch:TouchComboBox Margin="0 80 0 0" ItemsSource="{Binding Source={x:Type common:DeploymentSlots},Converter={StaticResource EnumToItemsSourceConverter},ConverterParameter='false'}" SelectedItem="{Binding DeploymentSlot}"> - + <touch:TouchComboBox Margin="0 80 0 0" Title="Select Environment" ItemsSource="{Binding Source={x:Type web:DeploymentSlot},Converter={StaticResource EnumToItemsSourceConverter},ConverterParameter='false'}" SelectedItem="{Binding DeploymentSlot}"> + <touch:TouchComboBox.ItemTemplate> + <DataTemplate> + <TextBlock Padding="10" FontSize="{StaticResource TangoTitleFontSize}" Text="{Binding Converter={StaticResource EnumToDescriptionConverter}}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=touch:TouchListBoxItem},Path=IsSelected}" Value="True"> + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </DataTemplate> + </touch:TouchComboBox.ItemTemplate> + <touch:TouchComboBox.SelectedItemTemplate> + <DataTemplate> + <TextBlock FontSize="{StaticResource TangoTitleFontSize}" Text="{Binding Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock> + </DataTemplate> + </touch:TouchComboBox.SelectedItemTemplate> </touch:TouchComboBox> <touch:TouchButton Margin="0 200 0 0" Padding="20" Width="300" CornerRadius="35" Command="{Binding EnvironmentSelectedCommand}">CONTINUE</touch:TouchButton> 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; } + + /// <summary> + /// Gets the actual data source (settings or overridden). + /// </summary> + /// <returns></returns> + public static DataSource GetActualDataSource() + { + return _override_datasource != null ? _override_datasource : SettingsManager.Default.GetOrCreate<CoreSettings>().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<T>(this Enum value) where T : Attribute + { + FieldInfo fi = value.GetType().GetField(value.ToString()); + return fi.GetCustomAttribute<T>(); + } + /// <summary> /// Gets the enum integer value. /// </summary> 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 /// <exception cref="System.NotImplementedException"></exception> 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 @@ <Border DockPanel.Dock="Top" BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 0 0 1" Padding="10 10 10 15"> <TextBlock DockPanel.Dock="Top" Text="{Binding Title}" FontSize="{StaticResource TangoTitleFontSize}"></TextBlock> </Border> - <local:TouchListBox x:Name="PART_ComboBoxList" Margin="0 10 0 0" Width="{Binding MinPopupWidth}" Height="{Binding MinPopupHeight}" ItemSelectedCommand="{Binding RelativeSource={RelativeSource AncestorType=local:TouchPanel},Path=ComboBoxPickedCommand}" ItemsSource="{Binding ItemsSource}" SelectionMode="None" ItemTemplate="{Binding ItemTemplate}" VerticalAlignment="Top"> + <local:TouchListBox x:Name="PART_ComboBoxList" Margin="0 10 0 0" Width="{Binding MinPopupWidth}" Height="{Binding MinPopupHeight}" ItemSelectedCommand="{Binding RelativeSource={RelativeSource AncestorType=local:TouchPanel},Path=ComboBoxPickedCommand}" ItemsSource="{Binding ItemsSource}" SelectedItem="{Binding SelectedItem,Mode=TwoWay}" SelectionMode="None" ItemTemplate="{Binding ItemTemplate}" VerticalAlignment="Top"> </local:TouchListBox> </DockPanel> 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 @@ <Compile Include="Web\StorageBlobProgressEventArgs.cs" /> <Compile Include="Web\StorageBlobUploader.cs" /> <Compile Include="Web\WebRequestMessage.cs" /> + <Compile Include="Web\WebRequestSecureMessage.cs" /> <Compile Include="Web\WebResponseMessage.cs" /> <Compile Include="Web\WebTransportClient.cs" /> <Compile Include="Web\WebTransportMessage.cs" /> @@ -145,7 +146,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ 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 +{ + /// <summary> + /// Gets the deployment slot web address. + /// </summary> + /// <param name="slot">The slot.</param> + /// <returns></returns> + public static String ToAddress(this DeploymentSlot slot) + { + return slot.GetAttribute<DeploymentSlotAddressAttribute>().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 @@ <Compile Include="ActiveDirectory\ActiveDirectoryManager.cs" /> <Compile Include="Authentication\TokensManager.cs" /> <Compile Include="DeploymentSlot.cs" /> + <Compile Include="DeploymentSlotAddressAttribute.cs" /> + <Compile Include="ExtensionMethods\DeploymentSlotExtensions.cs" /> <Compile Include="Logging\AzureCloudLogger.cs" /> <Compile Include="SQLServer\SQLServerManager.cs" /> <Compile Include="Storage\ExtensionMethods.cs" /> @@ -260,6 +262,7 @@ <Compile Include="Controllers\ProtoController.cs" /> <Compile Include="SMO\SmoManager.cs" /> <Compile Include="WebApiException.cs" /> + <Compile Include="WebSettings.cs" /> </ItemGroup> <ItemGroup> <None Include="app.config" /> @@ -282,6 +285,10 @@ <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> <Name>Tango.PMR</Name> </ProjectReference> + <ProjectReference Include="..\Tango.Settings\Tango.Settings.csproj"> + <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project> + <Name>Tango.Settings</Name> + </ProjectReference> </ItemGroup> <ItemGroup /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 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 + { + /// <summary> + /// Gets or sets the deployment slot. + /// </summary> + public DeploymentSlot DeploymentSlot { get; set; } + + /// <summary> + /// Gets the machine service address. + /// </summary> + /// <returns></returns> + public String GetMachineServiceAddress() + { + return DeploymentSlot.GetAttribute<DeploymentSlotAddressAttribute>().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) { |
