diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common')
38 files changed, 573 insertions, 61 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Authentication/IAuthenticationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Authentication/IAuthenticationProvider.cs index 74969fd27..2929ea405 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Authentication/IAuthenticationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Authentication/IAuthenticationProvider.cs @@ -29,7 +29,7 @@ namespace Tango.MachineStudio.Common.Authentication /// <param name="email">The email.</param> /// <param name="password">The password.</param> /// <returns></returns> - AuthenticationLoginResult Login(String email, String password, bool bypassVersionCheck = false); + AuthenticationLoginResult Login(String email, String password, LoginMethod method, bool bypassVersionCheck = false, Action<String> logAction = null); /// <summary> /// Logs-out the current logged-in user. diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs index 11d156292..b92c9f285 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs @@ -18,6 +18,7 @@ using Tango.MachineStudio.Common.StudioApplication; using Tango.PMR.Diagnostics; using Tango.Integration.Operation; using Tango.Core.ExtensionMethods; +using Tango.Transport; namespace Tango.MachineStudio.Common.EventLogging { @@ -137,7 +138,7 @@ namespace Tango.MachineStudio.Common.EventLogging /// <param name="message">The message.</param> private void Machine_RequestSent(object sender, IMessage message) { - Log(EventTypes.REQUEST_SENT, String.Format("Sending request '{0}'...{1}{2}", message.GetType().Name, Environment.NewLine, message.ToJsonString())); + //Log(EventTypes.REQUEST_SENT, String.Format("Sending request '{0}'...{1}{2}", message.GetType().Name, Environment.NewLine, message.ToJsonString())); } /// <summary> @@ -147,7 +148,7 @@ namespace Tango.MachineStudio.Common.EventLogging /// <param name="e">The <see cref="RequestFailedEventArgs"/> instance containing the event data.</param> private void Machine_RequestFailed(object sender, RequestFailedEventArgs e) { - Log(EventTypes.REQUEST_FAILED, String.Format("Request failed '{0}'...{1}{2}{1}{3}", e.Message.GetType().Name, Environment.NewLine, e.Message.ToJsonString(), e.Exception.ToString())); + //Log(EventTypes.REQUEST_FAILED, String.Format("Request failed '{0}'...{1}{2}{1}{3}", e.Message.GetType().Name, Environment.NewLine, e.Message.ToJsonString(), e.Exception.ToString())); } /// <summary> @@ -157,7 +158,7 @@ namespace Tango.MachineStudio.Common.EventLogging /// <param name="message">The message.</param> private void Machine_ResponseReceived(object sender, IMessage message) { - Log(EventTypes.RESPONSE_RECEIVED, String.Format("Response received '{0}'...{1}{2}", message.GetType().Name, Environment.NewLine, message.ToJsonString())); + //Log(EventTypes.RESPONSE_RECEIVED, String.Format("Response received '{0}'...{1}{2}", message.GetType().Name, Environment.NewLine, message.ToJsonString())); } /// <summary> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Black.otf b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Black.otf Binary files differnew file mode 100644 index 000000000..0341d05db --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Black.otf diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-BlackIt.otf b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-BlackIt.otf Binary files differnew file mode 100644 index 000000000..e0823abdf --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-BlackIt.otf diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Bold.otf b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Bold.otf Binary files differnew file mode 100644 index 000000000..2b9144e5c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Bold.otf diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-BoldIt.otf b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-BoldIt.otf Binary files differnew file mode 100644 index 000000000..f21ed044d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-BoldIt.otf diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Demi.otf b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Demi.otf Binary files differnew file mode 100644 index 000000000..ada716012 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Demi.otf diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-DemiIt.otf b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-DemiIt.otf Binary files differnew file mode 100644 index 000000000..ab9a133a5 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-DemiIt.otf diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Heavy.otf b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Heavy.otf Binary files differnew file mode 100644 index 000000000..b3630c982 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Heavy.otf diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-HeavyIt.otf b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-HeavyIt.otf Binary files differnew file mode 100644 index 000000000..e47f75546 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-HeavyIt.otf diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-It.otf b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-It.otf Binary files differnew file mode 100644 index 000000000..6f9b5fa49 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-It.otf diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Light.otf b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Light.otf Binary files differnew file mode 100644 index 000000000..27af39094 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Light.otf diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-LightIt.otf b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-LightIt.otf Binary files differnew file mode 100644 index 000000000..89085eeca --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-LightIt.otf diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Medium.otf b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Medium.otf Binary files differnew file mode 100644 index 000000000..04b2a8853 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Medium.otf diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-MediumIt.otf b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-MediumIt.otf Binary files differnew file mode 100644 index 000000000..91996979e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-MediumIt.otf diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Regular.otf b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Regular.otf Binary files differnew file mode 100644 index 000000000..2703ba3f3 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Regular.otf diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Thin.otf b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Thin.otf Binary files differnew file mode 100644 index 000000000..666c69931 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-Thin.otf diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-ThinIt.otf b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-ThinIt.otf Binary files differnew file mode 100644 index 000000000..b039daffe --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Fonts/Flexo-ThinIt.otf diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/machine_new.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/machine_new.png Binary files differnew file mode 100644 index 000000000..116e1e9c7 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/machine_new.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/machine_new_small.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/machine_new_small.png Binary files differnew file mode 100644 index 000000000..378879ce1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/machine_new_small.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs index 781e034e8..7a016b376 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs @@ -8,8 +8,10 @@ using System.Windows; using Tango.BL; using Tango.Integration.Operation; using Tango.Logging; +using Tango.MachineStudio.Common.Web; using Tango.PMR.Printing; using Tango.Settings; +using Tango.Transport.Adapters; using Tango.Web; namespace Tango.MachineStudio.Common @@ -40,6 +42,11 @@ namespace Tango.MachineStudio.Common public String LastLoginPassword { get; set; } /// <summary> + /// Gets or sets the last login method. + /// </summary> + public LoginMethod LastLoginMethod { get; set; } + + /// <summary> /// Gets or sets a value indicating whether to save the user credentials. /// </summary> public bool RememberMe { get; set; } @@ -130,6 +137,31 @@ namespace Tango.MachineStudio.Common public TimeSpan MaximumCacheTime { get; set; } /// <summary> + /// Gets or sets the external bridge request timeout. + /// </summary> + public TimeSpan ExternalBridgeRequestTimeout { get; set; } + + /// <summary> + /// Gets or sets the external bridge continuous request timeout. + /// </summary> + public TimeSpan ExternalBridgeContinuousRequestTimeout { get; set; } + + /// <summary> + /// Gets or sets the external bridge SignalR hub. + /// </summary> + public String ExternalBridgeSignalRHub { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether to enable external bridge scanning via SignalR. + /// </summary> + public bool EnableExternalBridgeSignalR { get; set; } + + /// <summary> + /// Gets or sets the TCP transport adapter write mode. + /// </summary> + public TcpTransportAdapterWriteMode TcpTransportAdapterWriteMode { get; set; } + + /// <summary> /// Gets the machine service address. /// </summary> public String MachineServiceAddress @@ -167,6 +199,11 @@ namespace Tango.MachineStudio.Common CachingMode = ObservablesContextInMemoryCachingMode.None; Theme = MachineStudioTheme.Light; JobUnitsMethod = JobUnitsMethods.Operator; + ExternalBridgeRequestTimeout = TimeSpan.FromSeconds(5); + ExternalBridgeContinuousRequestTimeout = TimeSpan.FromSeconds(5); + ExternalBridgeSignalRHub = "ExternalBridgeHub"; + EnableExternalBridgeSignalR = true; + TcpTransportAdapterWriteMode = TcpTransportAdapterWriteMode.Interval; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml index 177a4fe75..37e35b1ab 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml @@ -63,6 +63,13 @@ <!--Fonts--> <ResourceDictionary> <FontFamily x:Key="digital-7">../Fonts/#digital-7</FontFamily> + <FontFamily x:Key="flexo">../Fonts/#flexo</FontFamily> + </ResourceDictionary> + + <!--Images--> + <ResourceDictionary> + <BitmapImage x:Key="MachineBig" UriSource="../Images/machine_new.png"></BitmapImage> + <BitmapImage x:Key="MachineSmall" UriSource="../Images/machine_new_small.png"></BitmapImage> </ResourceDictionary> <!--Styles--> @@ -526,7 +533,7 @@ </Setter.Value> </Setter> </Style> - + <ControlTemplate x:Key="TransparentPopupContentDownTemplate" TargetType="ContentControl"> <Grid MinWidth="{Binding ElementName=templateRoot, Path=ActualWidth, Converter={StaticResource MathAddConverter}, ConverterParameter=32}" Margin="6" Background="Transparent"> @@ -774,6 +781,10 @@ </Setter.Value> </Setter> </Style> + + <Style TargetType="Window"> + <Setter Property="FontFamily" Value="{StaticResource flexo}"></Setter> + </Style> </ResourceDictionary> </ResourceDictionary.MergedDictionaries> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs index 3e54a327b..fabe3e02f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs @@ -21,6 +21,11 @@ namespace Tango.MachineStudio.Common.StudioApplication event EventHandler ApplicationReady; /// <summary> + /// Occurs when the connected machine session has been lost and an automatic reconnection with the last machine is required. + /// </summary> + event EventHandler ReconnectionRequired; + + /// <summary> /// Occurs when the connected machine property has changed. /// </summary> event EventHandler<IExternalBridgeClient> ConnectedMachineChanged; 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..2df984c7c 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 @@ -59,6 +59,9 @@ <HintPath>..\..\Referenced Assemblies\SMO\Microsoft.SqlServer.AzureStorageEnum.dll</HintPath> </Reference> <Reference Include="Microsoft.WindowsAzure.Storage, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> + <Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Data" /> @@ -83,6 +86,9 @@ <Reference Include="PresentationFramework" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\PPC\Tango.PPC.Common\Publish\PublishInfo.cs"> + <Link>Tup\PublishInfo.cs</Link> + </Compile> <Compile Include="..\..\Versioning\GlobalVersionInfo.cs"> <Link>GlobalVersionInfo.cs</Link> </Compile> @@ -95,6 +101,11 @@ <Compile Include="Converters\UserRoleToVisibilityConverter.cs" /> <Compile Include="MachineStudioTheme.cs" /> <Compile Include="Resources\SharedResourceDictionary.cs" /> + <Compile Include="Tup\TupFileBuilder.cs" /> + <Compile Include="Tup\TupFileBuilderProgressEventArgs.cs" /> + <Compile Include="Web\DownloadLatestPPCVersionRequest.cs" /> + <Compile Include="Web\DownloadLatestPPCVersionResponse.cs" /> + <Compile Include="Web\LoginMethod.cs" /> <Compile Include="Web\LoginRequest.cs" /> <Compile Include="Web\LoginResponse.cs" /> <Compile Include="AutoComplete\MachinesProvider.cs" /> @@ -117,6 +128,22 @@ <Compile Include="ExtensionMethods\CommonDialogExtensions.cs" /> <Compile Include="ExtensionMethods\TangoIOCExtensions.cs" /> <Compile Include="FirmwareUpgrade\IFirmwareUpgrader.cs" /> + <Resource Include="Fonts\Flexo-Black.otf" /> + <Resource Include="Fonts\Flexo-BlackIt.otf" /> + <Resource Include="Fonts\Flexo-Bold.otf" /> + <Resource Include="Fonts\Flexo-BoldIt.otf" /> + <Resource Include="Fonts\Flexo-Demi.otf" /> + <Resource Include="Fonts\Flexo-DemiIt.otf" /> + <Resource Include="Fonts\Flexo-Heavy.otf" /> + <Resource Include="Fonts\Flexo-HeavyIt.otf" /> + <Resource Include="Fonts\Flexo-It.otf" /> + <Resource Include="Fonts\Flexo-Light.otf" /> + <Resource Include="Fonts\Flexo-LightIt.otf" /> + <Resource Include="Fonts\Flexo-Medium.otf" /> + <Resource Include="Fonts\Flexo-MediumIt.otf" /> + <Resource Include="Fonts\Flexo-Regular.otf" /> + <Resource Include="Fonts\Flexo-Thin.otf" /> + <Resource Include="Fonts\Flexo-ThinIt.otf" /> <None Include="Helpers\GraphsHelper.cs" /> <Compile Include="IStudioViewModel.cs" /> <Compile Include="MachineStudioSettings.cs" /> @@ -145,6 +172,8 @@ <Compile Include="Web\LatestVersionResponse.cs" /> <Compile Include="Web\MachineStudioWebClient.cs" /> <Compile Include="Web\MachineStudioWebClientBase.cs" /> + <Compile Include="Web\RefreshTokenRequest.cs" /> + <Compile Include="Web\RefreshTokenResponse.cs" /> <Compile Include="Web\UploadCompletedRequest.cs" /> <Compile Include="Web\UploadCompletedResponse.cs" /> <Compile Include="Web\UploadVersionRequest.cs" /> @@ -289,6 +318,10 @@ <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> <Name>Tango.SharedUI</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.SQLExaminer\Tango.SQLExaminer.csproj"> + <Project>{e1e66ed9-597d-45fa-8048-de90a6930484}</Project> + <Name>Tango.SQLExaminer</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.Transport\Tango.Transport.csproj"> <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> <Name>Tango.Transport</Name> @@ -385,6 +418,12 @@ <ItemGroup> <Resource Include="Images\ti-tm4c129x.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\machine_new.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\machine_new_small.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Themes/LightThemeColors.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Themes/LightThemeColors.xaml index 0f5727e5b..4ad992e67 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Themes/LightThemeColors.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Themes/LightThemeColors.xaml @@ -9,20 +9,20 @@ <ResourceDictionary> <system:Double x:Key = "HomeImageOpacity">1</system:Double> <SolidColorBrush x:Key="OrangeBrush" Color="#FFA300"/> - <SolidColorBrush x:Key="OrangeBrush200" Color="#FFA65F"/> - <SolidColorBrush x:Key="OrangeBrush250" Color="#E79F20"/> + <SolidColorBrush x:Key="OrangeBrush200" Color="#FFA65F"/> + <SolidColorBrush x:Key="OrangeBrush250" Color="#E79F20"/> <SolidColorBrush x:Key="OrangeCanceledBrush" Color="#EF832B"/> <!--Background for all duplicate buttons--> <SolidColorBrush x:Key="OrangeBrush300" Color="#FF9A6A"/> - <SolidColorBrush x:Key="OrangeBrush400" Color="#F38B76"/> + <SolidColorBrush x:Key="OrangeBrush400" Color="#F38B76"/> - <SolidColorBrush x:Key="RedBrush100" Color="#FF5151"/> + <SolidColorBrush x:Key="RedBrush100" Color="#FF5151"/> <SolidColorBrush x:Key="RedBrush200" Color="#FF6F6F"/> <!--Background for all remove/delete buttons--> <SolidColorBrush x:Key="RedBrush300" Color="#FF7272"/> - <SolidColorBrush x:Key="RedBrush400" Color="#FF8585"/> - <SolidColorBrush x:Key="RedBrush500" Color="#E14141"/> - <SolidColorBrush x:Key="OrangeUploadBrush" Color="#E76311"/> + <SolidColorBrush x:Key="RedBrush400" Color="#FF8585"/> + <SolidColorBrush x:Key="RedBrush500" Color="#E14141"/> + <SolidColorBrush x:Key="OrangeUploadBrush" Color="#E76311"/> <SolidColorBrush x:Key="GreenBrush" Color="#04CB04"/> @@ -40,72 +40,72 @@ <SolidColorBrush x:Key="DarkBlueBrush" Color="#3C7EF4"/> - <SolidColorBrush x:Key="DodgerBlueBrush" Color="DodgerBlue"/> - <SolidColorBrush x:Key="BlueBrush100" Color="#03A9F4" /> - <SolidColorBrush x:Key="BlueBrush" Color="#64B8EC"/> - <SolidColorBrush x:Key="BlueSelectionStrokBrush" Color="#1EA9FF"/> + <SolidColorBrush x:Key="DodgerBlueBrush" Color="DodgerBlue"/> + <SolidColorBrush x:Key="BlueBrush100" Color="#03A9F4" /> + <SolidColorBrush x:Key="BlueBrush" Color="#64B8EC"/> + <SolidColorBrush x:Key="BlueSelectionStrokBrush" Color="#1EA9FF"/> - <SolidColorBrush x:Key="LilacBrush" Color="#833CEC"/> - <SolidColorBrush x:Key="LilacBrush100" Color="#682EBE"/> - <SolidColorBrush x:Key="LilacBrush200" Color="#532990"/> + <SolidColorBrush x:Key="LilacBrush" Color="#833CEC"/> + <SolidColorBrush x:Key="LilacBrush100" Color="#682EBE"/> + <SolidColorBrush x:Key="LilacBrush200" Color="#532990"/> - <SolidColorBrush x:Key="WhiteTextBrush" Color="White"/> - <SolidColorBrush x:Key="WhiteBackgroundBrush" Color="White"/> - <SolidColorBrush x:Key="WhiteBrush" Color="#E6FFFFFF"/> - <SolidColorBrush x:Key="WhiteBrush50" Color="#FFF1F1F1"/> - - <SolidColorBrush x:Key="WhiteBrush100" Color="#ECECEC"/> - <SolidColorBrush x:Key="LightGrayBrush" Color="#A5A4A4"/> - <SolidColorBrush x:Key="LightGrayBrush100" Color="#BBBBBB"/> - <SolidColorBrush x:Key="LightGrayBrush150" Color="#CBCBCB"/> - <SolidColorBrush x:Key="LightGrayBrush200" Color="#D9D9D9"/> + <SolidColorBrush x:Key="WhiteTextBrush" Color="White"/> + <SolidColorBrush x:Key="WhiteBackgroundBrush" Color="White"/> + <SolidColorBrush x:Key="WhiteBrush" Color="#E6FFFFFF"/> + <SolidColorBrush x:Key="WhiteBrush50" Color="#FFF1F1F1"/> + + <SolidColorBrush x:Key="WhiteBrush100" Color="#ECECEC"/> + <SolidColorBrush x:Key="LightGrayBrush" Color="#A5A4A4"/> + <SolidColorBrush x:Key="LightGrayBrush100" Color="#BBBBBB"/> + <SolidColorBrush x:Key="LightGrayBrush150" Color="#CBCBCB"/> + <SolidColorBrush x:Key="LightGrayBrush200" Color="#D9D9D9"/> <!-- used for regular text color --> - <SolidColorBrush x:Key="BlackForegroundBrush" Color="black"/> - <SolidColorBrush x:Key="DarkGrayBrush" Color="#1B1B1B"/> - <SolidColorBrush x:Key="DarkGrayBrush100" Color="#101010"/> - <SolidColorBrush x:Key="DarkGrayBrush200" Color="#202020"/> - <SolidColorBrush x:Key="GrayBrush300" Color="#303030"/> + <SolidColorBrush x:Key="BlackForegroundBrush" Color="black"/> + <SolidColorBrush x:Key="DarkGrayBrush" Color="#1B1B1B"/> + <SolidColorBrush x:Key="DarkGrayBrush100" Color="#101010"/> + <SolidColorBrush x:Key="DarkGrayBrush200" Color="#202020"/> + <SolidColorBrush x:Key="GrayBrush300" Color="#303030"/> <!--used for Foreground Storage--> - <SolidColorBrush x:Key="GrayBrush310" Color="#363636"/> - <SolidColorBrush x:Key="GrayBrush280" Color="#3E3E3E"/> - <SolidColorBrush x:Key="GrayBrush290" Color="#404040"/> - <!-- used for text color--> - <SolidColorBrush x:Key="GrayBrush250" Color="#5E5E5E"/> - <SolidColorBrush x:Key="GrayBrush200" Color="#616161"/> - <SolidColorBrush x:Key="GrayBrush50" Color="#7A7A7A"/> - <SolidColorBrush x:Key="GrayBrush" Color="Gray"/> - <SolidColorBrush x:Key="DimGrayBrush" Color="DimGray"/> + <SolidColorBrush x:Key="GrayBrush310" Color="#363636"/> + <SolidColorBrush x:Key="GrayBrush280" Color="#3E3E3E"/> + <SolidColorBrush x:Key="GrayBrush290" Color="#404040"/> + <!-- used for text color--> + <SolidColorBrush x:Key="GrayBrush250" Color="#5E5E5E"/> + <SolidColorBrush x:Key="GrayBrush200" Color="#616161"/> + <SolidColorBrush x:Key="GrayBrush50" Color="#7A7A7A"/> + <SolidColorBrush x:Key="GrayBrush" Color="Gray"/> + <SolidColorBrush x:Key="DimGrayBrush" Color="DimGray"/> <SolidColorBrush x:Key="SideBarBackgroundBrush" Color="white" /> <SolidColorBrush x:Key="JobFieldForeground" Color="#FF494949"/> <SolidColorBrush x:Key="HomePageForeground" Color="#FF494949"/> <!--used for border brush--> <SolidColorBrush x:Key="BorderBrushGainsboro" Color="Gainsboro"/> - + <LinearGradientBrush x:Key="BlueGradientBrush" StartPoint="0.5,0" EndPoint="0.5,1"> - <GradientStop Color="#03A9F4"/> - <GradientStop Color="#0081BB" Offset="1"/> - </LinearGradientBrush> + <GradientStop Color="#03A9F4"/> + <GradientStop Color="#0081BB" Offset="1"/> + </LinearGradientBrush> - <SolidColorBrush x:Key="TransparentBackgroundBrush" Color="#96FFFFFF"/> - <SolidColorBrush x:Key="TransparentBackgroundBrush100" Color="#B9FFFFFF"/> - <SolidColorBrush x:Key="TransparentBackgroundBrush200" Color="#E6FFFFFF"/> - <SolidColorBrush x:Key="TransparentBackgroundBrush300" Color="#D4FFFFFF"/> - <SolidColorBrush x:Key="Transparent200" Color="#C9F6F6F6"/> - <!--MachineJobSelectionView Grid Background--> - <SolidColorBrush x:Key="TransparentBackgroundBrush400" Color="#B1FFFFFF"/> + <SolidColorBrush x:Key="TransparentBackgroundBrush" Color="#96FFFFFF"/> + <SolidColorBrush x:Key="TransparentBackgroundBrush100" Color="#B9FFFFFF"/> + <SolidColorBrush x:Key="TransparentBackgroundBrush200" Color="#E6FFFFFF"/> + <SolidColorBrush x:Key="TransparentBackgroundBrush300" Color="#D4FFFFFF"/> + <SolidColorBrush x:Key="Transparent200" Color="#C9F6F6F6"/> + <!--MachineJobSelectionView Grid Background--> + <SolidColorBrush x:Key="TransparentBackgroundBrush400" Color="#B1FFFFFF"/> <SolidColorBrush x:Key="TransparentBackgroundBrush420" Color="#A6FFFFFF"/> - - <!--Storage.Views.MainView--> + + <!--Storage.Views.MainView--> <SolidColorBrush x:Key="TransparentBackgroundBrush500" Color="#8BFFFFFF"/> <!--MachineTechView--> - <SolidColorBrush x:Key="TransparentBackgroundBrush450" Color="#7EFFFFFF"/> - <SolidColorBrush x:Key="TransparentBackgroundBrush600" Color="#70FFFFFF"/> - <SolidColorBrush x:Key="SelectionFillBrush" Color="#338D8D8D"/> + <SolidColorBrush x:Key="TransparentBackgroundBrush450" Color="#7EFFFFFF"/> + <SolidColorBrush x:Key="TransparentBackgroundBrush600" Color="#70FFFFFF"/> + <SolidColorBrush x:Key="SelectionFillBrush" Color="#338D8D8D"/> <!--Dispenser background--> <SolidColorBrush x:Key="TransparentBackgroundBrush700" Color="#68F6F6F6"/> @@ -161,7 +161,7 @@ <SolidColorBrush x:Key="graphGridLinesLightBrush" Color="{StaticResource graphGridLinesColor}"></SolidColorBrush> <SolidColorBrush x:Key="graphGridLinesDarkBrush" Color="#FF2E2E2E"></SolidColorBrush> <SolidColorBrush x:Key="MaterialDesignFlatButtonClick" Color="#FFDEDEDE"></SolidColorBrush> - + <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphBackgroundLight"> <GradientStop Color="White"/> <GradientStop Color="#FFE9E9E9" Offset="1"/> @@ -216,5 +216,5 @@ <GradientStop Color="#FFB5B5B5" Offset="1" /> </LinearGradientBrush> </ResourceDictionary> -</ResourceDictionary.MergedDictionaries> + </ResourceDictionary.MergedDictionaries> </ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tup/TupFileBuilder.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tup/TupFileBuilder.cs new file mode 100644 index 000000000..fad6ce949 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tup/TupFileBuilder.cs @@ -0,0 +1,288 @@ +using Ionic.Zip; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Tango.BL; +using Tango.Core; +using Tango.Core.DB; +using Tango.Core.DI; +using Tango.MachineStudio.Common.Web; +using Tango.SQLExaminer; +using Tango.Transport.Web; +using Tango.Core.ExtensionMethods; +using Tango.PPC.Common.Publish; +using Tango.Settings; +using Tango.Core.Components; +using System.Text.RegularExpressions; + +namespace Tango.MachineStudio.Common.Tup +{ + public class TupFileBuilder : ExtendedObject + { + public event EventHandler<TupFileBuilderProgressEventArgs> Progress; + + public Task Build(String serialNumber, String filePath) + { + return Task.Factory.StartNew(() => + { + String tempDbName = "Tango_TUP"; + var tempPackageFolder = TemporaryManager.CreateFolder(); + String tempBackupFolder = "C:\\MachineStudioTUP"; + String tempBackupFile = Path.Combine(tempBackupFolder, tempDbName + ".bak"); + var tempZipFile = TemporaryManager.CreateImaginaryFile(); + DbManager dbManager = null; + + LogManager.Log("Generating tup file..."); + LogManager.Log($"Tup file: '{filePath}.'"); + LogManager.Log($"Temporary db name: '{tempDbName}'."); + LogManager.Log($"Temporary package folder: '{tempPackageFolder}'."); + LogManager.Log($"Temporary db backup folder: '{tempBackupFolder}'."); + LogManager.Log($"Temporary db backup file: '{tempBackupFile}'."); + LogManager.Log($"Temporary zip file: '{tempZipFile}'."); + + try + { + LogManager.Log("Initializing..."); + + OnProgress("Initializing..."); + + Core.DataSource localDataSource = new Core.DataSource() + { + Address = "localhost\\SQLEXPRESS", + IntegratedSecurity = true, + Type = DataSourceType.SQLServer, + Catalog = null, + }; + + try + { + LogManager.Log($"Trying to connect via SQLEXPRESS:\n{localDataSource.ToJsonString()}"); + dbManager = DbManager.FromDataSource(localDataSource); + } + catch (Exception ex) + { + try + { + LogManager.Log(ex, "Could not connect using SQLEXPRESS. Trying local DB..."); + + CmdCommand command = new CmdCommand("sqllocaldb", "start \"MSSQLLocalDB\""); + var result = command.Run().Result; + + command = new CmdCommand("sqllocaldb", "info \"MSSQLLocalDB\""); + result = command.Run().Result; + + String pattern = "np:.+"; + Regex reg = new Regex(pattern); + var match = reg.Match(result.StandardOutput); + String address = match.ToString(); + if (address.Contains("np:")) + { + localDataSource.Address = address; + address = address.Trim().Replace("\r", ""); + } + else + { + throw new ArgumentException("Could not parse LocalDB address string."); + } + + LogManager.Log($"Trying to connect via LocalDB:\n{localDataSource.ToJsonString()}"); + dbManager = DbManager.FromDataSource(localDataSource); + } + catch (Exception x) + { + LogManager.Log(x, "Could not find any database service for this operation."); + throw x; + } + } + + + + OnProgress("Downloading latest PPC version..."); + + LogManager.Log("Connecting to machine service..."); + MachineStudioWebClient client = TangoIOC.Default.GetInstance<MachineStudioWebClient>(); + + LogManager.Log("Requesting latest PPC version from machine service..."); + var response = client.DownloadLatestPPCVersion(new DownloadLatestPPCVersionRequest() { SerialNumber = serialNumber }).Result; + + LogManager.Log($"Machine service response:\n{response.ToJsonString()}"); + + var remoteDataSource = response.DataSource; + + using (AutoFileDownloader downloader = new AutoFileDownloader(response.BlobAddress, response.CdnAddress, tempZipFile)) + { + downloader.Progress += (x, e) => + { + OnProgress($"Downloading latest PPC version '{response.Version}'...", false, e.Current, e.Total); + }; + + downloader.ResolveMode().GetAwaiter().GetResult(); + + LogManager.Log($"Downloading latest PPC version from: '{downloader.Address}'"); + + downloader.Download().Wait(); + } + + LogManager.Log("Extracting PPC version package..."); + + OnProgress("Extracting PPC package..."); + + using (ZipFile zip = new ZipFile(tempZipFile)) + { + int currentEntry = 0; + + zip.ExtractProgress += (x, args) => + { + if (args.EventType == ZipProgressEventType.Extracting_AfterExtractEntry) + { + OnProgress("Extracting PPC package...", false, currentEntry++, zip.Entries.Count); + } + }; + + zip.ExtractAll(tempPackageFolder); + } + + OnProgress("Extracting version information..."); + LogManager.Log("Extracting publish information..."); + PublishInfo publishInfo = PublishInfo.FromJson(File.ReadAllText(Path.Combine(tempPackageFolder, "version.json"))); + LogManager.Log($"Publish Information:\n{publishInfo}"); + + LogManager.Log("Modifying publish information to custom tup file..."); + publishInfo.IsMachineTupPackage = true; + publishInfo.MachineSerialNumber = serialNumber; + publishInfo.MachineDeploymentSlot = SettingsManager.Default.GetOrCreate<MachineStudioSettings>().DeploymentSlot; + + OnProgress("Creating temporary database..."); + + LogManager.Log($"Creating temporary db backup directory '{tempBackupFolder}'"); + + Directory.CreateDirectory(tempBackupFolder); + + LogManager.Log($"Creating new database: '{tempDbName}'"); + + //Create temp db + dbManager.Create(tempDbName, Path.Combine(tempBackupFolder, tempDbName + ".mdf")); + + OnProgress("Generating database snapshot..."); + + LogManager.Log("Starting database synchronization..."); + + Thread.Sleep(2000); + + localDataSource.Catalog = tempDbName; + + ExaminerSequenceConfigurationRunner runner = new ExaminerSequenceConfigurationRunner( + Path.Combine(tempPackageFolder, "Provision Scripts", "config.xml"), + Path.Combine(tempPackageFolder, "Provision Scripts"), + remoteDataSource, + localDataSource, + serialNumber); + + runner.ScriptExecuting += (x, item) => + { + LogManager.Log($"Executing script '{item.FileName}'..."); + OnProgress($"{item.Name}..."); + }; + + runner.Log += (x, log) => + { + LogManager.Log(log); + }; + + runner.Run().GetAwaiter().GetResult(); + + OnProgress("Generating database snapshot..."); + + if (File.Exists(tempBackupFile)) + { + LogManager.Log($"Deleting file '{tempBackupFile}'"); + File.Delete(tempBackupFile); + } + + LogManager.Log($"Generating backup for '{tempDbName}' to '{tempBackupFile}'..."); + + dbManager.Backup(tempDbName, tempBackupFile); + + OnProgress("Injecting database snapshot to PPC package..."); + + using (ZipFile zip = new ZipFile(tempZipFile)) + { + LogManager.Log($"Injecting file '{tempBackupFile}' to original package at '{tempZipFile}'..."); + zip.AddFile(tempBackupFile, "/"); + + LogManager.Log($"Injecting modified publish information..."); + zip.UpdateEntry("version.json", publishInfo.ToJson()); + + zip.Save(); + } + + LogManager.Log($"Copying '{tempZipFile}' to '{filePath}'..."); + + File.Copy(tempZipFile, filePath, true); + + OnProgress("Completed", false, 100, 100); + + LogManager.Log("TUP file generation completed successfully."); + } + catch (Exception ex) + { + LogManager.Log(ex, "TUP file generation failed."); + OnProgress("Failed", false, 0, 100); + throw ex; + } + finally + { + LogManager.Log($"Removing '{tempZipFile}'."); + tempZipFile.Delete(); + LogManager.Log($"Removing '{tempPackageFolder}'."); + tempPackageFolder.Delete(); + + try + { + LogManager.Log($"Removing database '{tempDbName}'."); + dbManager.SetOffline(tempDbName); + dbManager.SetOnline(tempDbName); + dbManager.Delete(tempDbName); + dbManager.Dispose(); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error removing temp database '{tempDbName}'."); + } + + try + { + LogManager.Log($"Removing '{tempBackupFolder}'."); + Directory.Delete(tempBackupFolder, true); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error removing folder '{tempBackupFolder}'."); + } + } + }); + } + + public async Task<String> GetLatestPPCVersion(String serialNumber) + { + MachineStudioWebClient client = TangoIOC.Default.GetInstance<MachineStudioWebClient>(); + var response = await client.DownloadLatestPPCVersion(new DownloadLatestPPCVersionRequest() { SerialNumber = serialNumber }); + return response.Version; + } + + private void OnProgress(String message, bool isIntermediate = true, double progress = 0, double total = 100) + { + Progress?.Invoke(this, new TupFileBuilderProgressEventArgs() + { + Message = message, + IsIntermediate = isIntermediate, + Progress = progress, + Total = total, + }); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tup/TupFileBuilderProgressEventArgs.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tup/TupFileBuilderProgressEventArgs.cs new file mode 100644 index 000000000..ada69dd40 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tup/TupFileBuilderProgressEventArgs.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Common.Tup +{ + public class TupFileBuilderProgressEventArgs + { + public double Progress { get; set; } + public double Total { get; set; } + public bool IsIntermediate { get; set; } + public String Message { get; set; } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/CheckForUpdatesResponse.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/CheckForUpdatesResponse.cs index 51608e6c4..b78047c85 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/CheckForUpdatesResponse.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/CheckForUpdatesResponse.cs @@ -17,5 +17,7 @@ namespace Tango.MachineStudio.Common.Web public String Comments { get; set; } public String BlobAddress { get; set; } + + public String CdnAddress { get; set; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/DownloadLatestPPCVersionRequest.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/DownloadLatestPPCVersionRequest.cs new file mode 100644 index 000000000..24d465e69 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/DownloadLatestPPCVersionRequest.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 DownloadLatestPPCVersionRequest : WebRequestMessage + { + public String SerialNumber { get; set; } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/DownloadLatestPPCVersionResponse.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/DownloadLatestPPCVersionResponse.cs new file mode 100644 index 000000000..2cc6b731a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/DownloadLatestPPCVersionResponse.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.Transport.Web; + +namespace Tango.MachineStudio.Common.Web +{ + public class DownloadLatestPPCVersionResponse : WebResponseMessage + { + public String Version { get; set; } + + public String BlobAddress { get; set; } + + public String CdnAddress { get; set; } + + public DataSource DataSource { get; set; } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/DownloadLatestVersionResponse.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/DownloadLatestVersionResponse.cs index 3209b9a2f..60251d455 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/DownloadLatestVersionResponse.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/DownloadLatestVersionResponse.cs @@ -12,5 +12,7 @@ namespace Tango.MachineStudio.Common.Web public String Version { get; set; } public String BlobAddress { get; set; } + + public String CdnAddress { get; set; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/LoginMethod.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/LoginMethod.cs new file mode 100644 index 000000000..83f1c0850 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/LoginMethod.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Common.Web +{ + public enum LoginMethod + { + [Description("Active Directory")] + ActiveDirectory, + [Description("Standard User")] + StandardUser, + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/LoginRequest.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/LoginRequest.cs index 577f5e208..1727a2c6e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/LoginRequest.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/LoginRequest.cs @@ -12,5 +12,6 @@ namespace Tango.MachineStudio.Common.Web public String Version { get; set; } public String Email { get; set; } public String Password { get; set; } + public LoginMethod Method { get; set; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/LoginResponse.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/LoginResponse.cs index 4ae22fa93..3515c32d1 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/LoginResponse.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/LoginResponse.cs @@ -14,5 +14,6 @@ namespace Tango.MachineStudio.Common.Web public DataSource DataSource { get; set; } public bool VersionChangeRequired { get; set; } public String RequiredVersion { get; set; } + public bool PasswordChangeRequired { get; set; } } } 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..72eb4acaa 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/MachineStudioWebClientBase.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/MachineStudioWebClientBase.cs @@ -41,6 +41,15 @@ namespace Tango.MachineStudio.Common.Web } /// <summary> + /// Initializes a new instance of the <see cref="MachineStudioWebClientBase"/> class. + /// </summary> + /// <param name="cloned">Other instance.</param> + public MachineStudioWebClientBase(MachineStudioWebClientBase cloned) : base(cloned) + { + + } + + /// <summary> /// Executes the CheckForUpdates action and returns Tango.MachineStudio.Common.Web.CheckForUpdatesResponse. /// </summary> /// <returns></returns> @@ -85,5 +94,23 @@ namespace Tango.MachineStudio.Common.Web return Post<Tango.MachineStudio.Common.Web.LatestVersionRequest, Tango.MachineStudio.Common.Web.LatestVersionResponse>("GetLatestVersion", request); } + /// <summary> + /// Executes the RefreshToken action and returns Tango.MachineStudio.Common.Web.RefreshTokenResponse. + /// </summary> + /// <returns></returns> + public Task<Tango.MachineStudio.Common.Web.RefreshTokenResponse> RefreshToken(Tango.MachineStudio.Common.Web.RefreshTokenRequest request) + { + return Post<Tango.MachineStudio.Common.Web.RefreshTokenRequest, Tango.MachineStudio.Common.Web.RefreshTokenResponse>("RefreshToken", request); + } + + /// <summary> + /// Executes the DownloadLatestPPCVersion action and returns Tango.MachineStudio.Common.Web.DownloadLatestPPCVersionResponse. + /// </summary> + /// <returns></returns> + public Task<Tango.MachineStudio.Common.Web.DownloadLatestPPCVersionResponse> DownloadLatestPPCVersion(Tango.MachineStudio.Common.Web.DownloadLatestPPCVersionRequest request) + { + return Post<Tango.MachineStudio.Common.Web.DownloadLatestPPCVersionRequest, Tango.MachineStudio.Common.Web.DownloadLatestPPCVersionResponse>("DownloadLatestPPCVersion", 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; } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/packages.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/packages.config index f871776f5..6fd5091a8 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/packages.config +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/packages.config @@ -9,4 +9,5 @@ <package id="MahApps.Metro" version="1.5.0" targetFramework="net46" /> <package id="MaterialDesignColors" version="1.1.2" targetFramework="net46" /> <package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net46" /> + <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" /> </packages>
\ No newline at end of file |
