From cbc80e71fac7d2896ac496b0fbf22051c0cdcff7 Mon Sep 17 00:00:00 2001 From: Avi Levkovich Date: Mon, 17 Feb 2020 17:00:29 +0200 Subject: merge --- .../Tango.AzureUtils.UI/AzureDashboardViewModel.cs | 12 +- .../Controls/WebAppPropertiesControl.xaml | 2 + .../Controls/WebAppPropertiesControl.xaml.cs | 13 + .../Tango.AzureUtils.UI/Tango.AzureUtils.UI.csproj | 8 + .../Azure/Tango.AzureUtils.UI/ViewModelLocator.cs | 9 + .../ViewModels/EnvironmentFirmwareUpgradeViewVM.cs | 14 +- .../ViewModels/EnvironmentRemovalViewVM.cs | 9 +- .../ViewModels/EnvironmentRollbackViewVM.cs | 86 + .../ViewModels/EnvironmentUpgradeViewVM.cs | 20 +- .../Views/EnvironmentRollbackView.xaml | 44 + .../Views/EnvironmentRollbackView.xaml.cs | 28 + .../Azure/Tango.AzureUtils.UI/Views/MainView.xaml | 3 + .../Tango.AzureUtils/Database/DatabaseManager.cs | 30 + .../Environment/EnvironmentManager.cs | 56 + .../RollbackEnvironmentConfiguration.cs | 15 + .../Tango.AzureUtils/Storage/StorageManager.cs | 34 + .../Azure/Tango.AzureUtils/Tango.AzureUtils.csproj | 1 + .../Tango.FSE.Diagnostics/DiagnosticsModule.cs | 26 + .../Properties/AssemblyInfo.cs | 55 + .../Properties/Resources.Designer.cs | 62 + .../Properties/Resources.resx | 117 + .../Properties/Settings.Designer.cs | 30 + .../Properties/Settings.settings | 7 + .../Tango.FSE.Diagnostics.csproj | 123 + .../Tango.FSE.Diagnostics/ViewModelLocator.cs | 26 + .../Tango.FSE.Diagnostics/ViewModels/MainViewVM.cs | 17 + .../Tango.FSE.Diagnostics/Views/MainView.xaml | 14 + .../Tango.FSE.Diagnostics/Views/MainView.xaml.cs | 28 + .../FSE/Modules/Tango.FSE.Diagnostics/app.config | 85 + .../Modules/Tango.FSE.Diagnostics/packages.config | 4 + .../Visual_Studio/FSE/Tango.FSE.Common/App.config | 85 + .../Visual_Studio/FSE/Tango.FSE.Common/App.xaml | 11 + .../Authentication/AuthenticationResult.cs | 16 + .../Authentication/IAuthenticationProvider.cs | 40 + .../FSEApplication/IFSEApplicationManager.cs | 86 + .../FSE/Tango.FSE.Common/FSEModuleAttribute.cs | 61 + .../FSE/Tango.FSE.Common/FSEModuleBase.cs | 69 + .../FSE/Tango.FSE.Common/FSESettings.cs | 56 + .../FSE/Tango.FSE.Common/FSEViewModel.cs | 248 ++ .../FSE/Tango.FSE.Common/Gateway/GatewayClient.cs | 2693 ++++++++++++++++++++ .../Tango.FSE.Common/Gateway/IGatewayService.cs | 17 + .../FSE/Tango.FSE.Common/IFSEModule.cs | 48 + .../Visual_Studio/FSE/Tango.FSE.Common/IFSEView.cs | 16 + .../Tango.FSE.Common/Modules/IFSEModuleLoader.cs | 43 + .../Navigation/INavigationBlocker.cs | 28 + .../Navigation/INavigationManager.cs | 119 + .../Navigation/INavigationObjectReceiver.cs | 21 + .../Navigation/INavigationResultProvider.cs | 28 + .../Tango.FSE.Common/Navigation/NavigationView.cs | 21 + .../Tango.FSE.Common/Notifications/AppBarItem.cs | 18 + .../Tango.FSE.Common/Notifications/AppButton.cs | 112 + .../Notifications/INotificationProvider.cs | 229 ++ .../FSE/Tango.FSE.Common/Notifications/ItemBase.cs | 82 + .../Tango.FSE.Common/Notifications/MessageBoxVM.cs | 22 + .../Tango.FSE.Common/Notifications/MessageType.cs | 16 + .../Notifications/NotificationItem.cs | 73 + .../Tango.FSE.Common/Notifications/TaskBarItem.cs | 13 + .../Tango.FSE.Common/Properties/AssemblyInfo.cs | 55 + .../Properties/Resources.Designer.cs | 62 + .../FSE/Tango.FSE.Common/Properties/Resources.resx | 117 + .../Properties/Settings.Designer.cs | 30 + .../Tango.FSE.Common/Properties/Settings.settings | 7 + .../FSE/Tango.FSE.Common/Resources/Colors.xaml | 43 + .../FSE/Tango.FSE.Common/Resources/Fonts.xaml | 8 + .../FSE/Tango.FSE.Common/Tango.FSE.Common.csproj | 191 ++ .../FSE/Tango.FSE.Common/Themes/Generic.xaml | 44 + .../Threading/IDispatcherProvider.cs | 26 + .../FSE/Tango.FSE.Common/Web/FSEWebClient.cs | 29 + .../FSE/Tango.FSE.Common/Web/FSEWebClientBase.cs | 43 + .../FSE/Tango.FSE.Common/packages.config | 9 + Software/Visual_Studio/FSE/Tango.FSE.UI/App.config | 91 + Software/Visual_Studio/FSE/Tango.FSE.UI/App.xaml | 63 + .../Visual_Studio/FSE/Tango.FSE.UI/App.xaml.cs | 18 + .../DefaultAuthenticationProvider.cs | 170 ++ .../FSEApplication/DefaultFSEApplicationManager.cs | 370 +++ .../Tango.FSE.UI/Gateway/DefaultGatewayService.cs | 36 + .../Visual_Studio/FSE/Tango.FSE.UI/MainWindow.xaml | 22 + .../FSE/Tango.FSE.UI/MainWindow.xaml.cs | 32 + .../Tango.FSE.UI/Modules/DefaultFSEModuleLoader.cs | 146 ++ .../Navigation/DefaultNavigationManager.cs | 539 ++++ .../Notifications/DefaultNotificationProvider.cs | 547 ++++ .../Tango.FSE.UI/Notifications/DialogAndView.cs | 45 + .../Notifications/PendingNotification.cs | 45 + .../FSE/Tango.FSE.UI/Properties/AssemblyInfo.cs | 55 + .../Tango.FSE.UI/Properties/Resources.Designer.cs | 71 + .../FSE/Tango.FSE.UI/Properties/Resources.resx | 117 + .../Tango.FSE.UI/Properties/Settings.Designer.cs | 30 + .../FSE/Tango.FSE.UI/Properties/Settings.settings | 7 + .../FSE/Tango.FSE.UI/Tango.FSE.UI.csproj | 218 ++ .../Threading/DefaultDispatcherProvider.cs | 46 + .../FSE/Tango.FSE.UI/ViewModelLocator.cs | 95 + .../FSE/Tango.FSE.UI/ViewModels/LayoutViewVM.cs | 17 + .../FSE/Tango.FSE.UI/ViewModels/LoadingViewVM.cs | 33 + .../FSE/Tango.FSE.UI/ViewModels/LoginViewVM.cs | 72 + .../FSE/Tango.FSE.UI/ViewModels/MainViewVM.cs | 19 + .../FSE/Tango.FSE.UI/Views/LayoutView.xaml | 17 + .../FSE/Tango.FSE.UI/Views/LayoutView.xaml.cs | 31 + .../FSE/Tango.FSE.UI/Views/LoadingView.xaml | 14 + .../FSE/Tango.FSE.UI/Views/LoadingView.xaml.cs | 28 + .../FSE/Tango.FSE.UI/Views/LoginView.xaml | 23 + .../FSE/Tango.FSE.UI/Views/LoginView.xaml.cs | 28 + .../FSE/Tango.FSE.UI/Views/MainView.xaml | 94 + .../FSE/Tango.FSE.UI/Views/MainView.xaml.cs | 31 + .../Visual_Studio/FSE/Tango.FSE.UI/packages.config | 9 + .../FSE/Tango.FSE.Web/Messages/LoginRequest.cs | 16 + .../FSE/Tango.FSE.Web/Messages/LoginResponse.cs | 18 + .../FSE/Tango.FSE.Web/Properties/AssemblyInfo.cs | 36 + .../FSE/Tango.FSE.Web/Tango.FSE.Web.csproj | 63 + .../Visual_Studio/Installers/Nswag/NSwagStudio.msi | Bin 0 -> 49216459 bytes .../Tango.MachineStudio.Common.csproj | 4 + .../Notes/Tango.Notes/Nswag/Pre-Build Example.txt | 1 + .../Notes/Tango.Notes/Tango.Notes.csproj | 3 +- .../Tango.PPC.UI/Modules/DefaultPPCModuleLoader.cs | 152 ++ .../Modules/DefaultStudioModuleLoader.cs | 152 -- .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 4 +- .../Tango.CodeGeneration.csproj | 4 +- .../TangoWebClientv2CodeFile.cs | 30 + .../Templates/TangoWebClientv2CodeFile.cshtml | 59 + .../ExtensionMethods/StringExtensions.cs | 5 + Software/Visual_Studio/Tango.Web/Tango.Web.csproj | 1 + .../Visual_Studio/Tango.Web/TangoWebClientv2.cs | 125 + Software/Visual_Studio/Tango.sln | 177 ++ .../Utilities/Tango.WebClientGenerator/Program.cs | 26 + .../Tango.WebClientGenerator.csproj | 4 + .../Controllers/GatewayController.cs | 28 +- .../Tango.MachineService.Gateway/DB/ENVIRONMENT.cs | 24 + .../DB/GatewayDbContext.cs | 38 + .../DTO/EnvironmentConfiguration.cs | 15 + .../Tango.MachineService.Gateway/GatewayConfig.cs | 5 + .../Messages/EnvironmentsRequest.cs | 12 + .../Messages/EnvironmentsResponse.cs | 17 + .../Nswag/GatewayClient.nswag | 140 + .../Tango.MachineService.Gateway.csproj | 24 +- .../Web/Tango.MachineService.Gateway/Web.config | 23 +- .../Tango.MachineService.Gateway/packages.config | 1 + .../Controllers/FSEController.cs | 113 + .../Controllers/MachineStudioController.cs | 2 +- .../Controllers/PPCController.cs | 2 +- .../Tango.MachineService.csproj | 7 +- 139 files changed, 10237 insertions(+), 186 deletions(-) create mode 100644 Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentRollbackViewVM.cs create mode 100644 Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentRollbackView.xaml create mode 100644 Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentRollbackView.xaml.cs create mode 100644 Software/Visual_Studio/Azure/Tango.AzureUtils/Environment/RollbackEnvironmentConfiguration.cs create mode 100644 Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/DiagnosticsModule.cs create mode 100644 Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Properties/AssemblyInfo.cs create mode 100644 Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Properties/Resources.Designer.cs create mode 100644 Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Properties/Resources.resx create mode 100644 Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Properties/Settings.Designer.cs create mode 100644 Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Properties/Settings.settings create mode 100644 Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Tango.FSE.Diagnostics.csproj create mode 100644 Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/ViewModelLocator.cs create mode 100644 Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/ViewModels/MainViewVM.cs create mode 100644 Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Views/MainView.xaml create mode 100644 Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Views/MainView.xaml.cs create mode 100644 Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/app.config create mode 100644 Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/packages.config create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/App.config create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/App.xaml create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Authentication/AuthenticationResult.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Authentication/IAuthenticationProvider.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/FSEApplication/IFSEApplicationManager.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/FSEModuleAttribute.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/FSEModuleBase.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/FSESettings.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Gateway/GatewayClient.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Gateway/IGatewayService.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/IFSEModule.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/IFSEView.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Modules/IFSEModuleLoader.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Navigation/INavigationBlocker.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Navigation/INavigationManager.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Navigation/INavigationObjectReceiver.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Navigation/INavigationResultProvider.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Navigation/NavigationView.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/AppBarItem.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/AppButton.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/INotificationProvider.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/ItemBase.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/MessageBoxVM.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/MessageType.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/NotificationItem.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/TaskBarItem.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Properties/AssemblyInfo.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Properties/Resources.Designer.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Properties/Resources.resx create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Properties/Settings.Designer.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Properties/Settings.settings create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Colors.xaml create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Fonts.xaml create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Themes/Generic.xaml create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Threading/IDispatcherProvider.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Web/FSEWebClient.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/Web/FSEWebClientBase.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Common/packages.config create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/App.config create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/App.xaml create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/App.xaml.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Authentication/DefaultAuthenticationProvider.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/FSEApplication/DefaultFSEApplicationManager.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Gateway/DefaultGatewayService.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/MainWindow.xaml create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/MainWindow.xaml.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Modules/DefaultFSEModuleLoader.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Navigation/DefaultNavigationManager.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Notifications/DefaultNotificationProvider.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Notifications/DialogAndView.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Notifications/PendingNotification.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/AssemblyInfo.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Resources.Designer.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Resources.resx create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Settings.Designer.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Settings.settings create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Threading/DefaultDispatcherProvider.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LayoutViewVM.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LoadingViewVM.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LoginViewVM.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/MainViewVM.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LoadingView.xaml create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LoadingView.xaml.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LoginView.xaml create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LoginView.xaml.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Views/MainView.xaml create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/Views/MainView.xaml.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.UI/packages.config create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/LoginRequest.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/LoginResponse.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Web/Properties/AssemblyInfo.cs create mode 100644 Software/Visual_Studio/FSE/Tango.FSE.Web/Tango.FSE.Web.csproj create mode 100644 Software/Visual_Studio/Installers/Nswag/NSwagStudio.msi create mode 100644 Software/Visual_Studio/Notes/Tango.Notes/Nswag/Pre-Build Example.txt create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Modules/DefaultPPCModuleLoader.cs delete mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Modules/DefaultStudioModuleLoader.cs create mode 100644 Software/Visual_Studio/Tango.CodeGeneration/TangoWebClientv2CodeFile.cs create mode 100644 Software/Visual_Studio/Tango.CodeGeneration/Templates/TangoWebClientv2CodeFile.cshtml create mode 100644 Software/Visual_Studio/Tango.Web/TangoWebClientv2.cs create mode 100644 Software/Visual_Studio/Web/Tango.MachineService.Gateway/DB/ENVIRONMENT.cs create mode 100644 Software/Visual_Studio/Web/Tango.MachineService.Gateway/DB/GatewayDbContext.cs create mode 100644 Software/Visual_Studio/Web/Tango.MachineService.Gateway/DTO/EnvironmentConfiguration.cs create mode 100644 Software/Visual_Studio/Web/Tango.MachineService.Gateway/Messages/EnvironmentsRequest.cs create mode 100644 Software/Visual_Studio/Web/Tango.MachineService.Gateway/Messages/EnvironmentsResponse.cs create mode 100644 Software/Visual_Studio/Web/Tango.MachineService.Gateway/Nswag/GatewayClient.nswag create mode 100644 Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEController.cs (limited to 'Software/Visual_Studio') diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/AzureDashboardViewModel.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/AzureDashboardViewModel.cs index eddc7d009..9d3a07b7b 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/AzureDashboardViewModel.cs +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/AzureDashboardViewModel.cs @@ -27,7 +27,7 @@ namespace Tango.AzureUtils.UI public virtual void OnApplicationReady() { - + } public virtual void OnAuthenticated(IAzure azure, List apps) @@ -47,6 +47,16 @@ namespace Tango.AzureUtils.UI } } + protected void RequireRefresh() + { + TangoIOC.Default.GetAllInstancesByBase().ToList().ForEach(x => x.OnRefreshRequired()); + } + + protected virtual void OnRefreshRequired() + { + + } + public void ProgressHandler(object sender, AzureUtilsProgressEventArgs e) { StatusManager.UpdateStatus(e); diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Controls/WebAppPropertiesControl.xaml b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Controls/WebAppPropertiesControl.xaml index 5adec916a..fe8b4bdef 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Controls/WebAppPropertiesControl.xaml +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Controls/WebAppPropertiesControl.xaml @@ -63,5 +63,7 @@ + + diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Controls/WebAppPropertiesControl.xaml.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Controls/WebAppPropertiesControl.xaml.cs index f71f236c7..ea7475fb1 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Controls/WebAppPropertiesControl.xaml.cs +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Controls/WebAppPropertiesControl.xaml.cs @@ -55,6 +55,13 @@ namespace Tango.AzureUtils.UI.Controls public static readonly DependencyProperty MachineStudioVersionProperty = DependencyProperty.Register("MachineStudioVersion", typeof(MachineStudioVersion), typeof(WebAppPropertiesControl), new PropertyMetadata(null)); + public bool IsBusy + { + get { return (bool)GetValue(IsBusyProperty); } + set { SetValue(IsBusyProperty, value); } + } + public static readonly DependencyProperty IsBusyProperty = + DependencyProperty.Register("IsBusy", typeof(bool), typeof(WebAppPropertiesControl), new PropertyMetadata(false)); public WebAppPropertiesControl() { @@ -71,6 +78,8 @@ namespace Tango.AzureUtils.UI.Controls try { + IsBusy = true; + HostNames = app.HostNames.Select(x => x).ToList(); Settings = await app.GetMachineServiceSettingsAsync(false); @@ -81,6 +90,10 @@ namespace Tango.AzureUtils.UI.Controls MachineStudioVersion = await databaseManager.GetLatestMachineStudioVersion(app); } catch { } + finally + { + IsBusy = false; + } } } } diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Tango.AzureUtils.UI.csproj b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Tango.AzureUtils.UI.csproj index 985c54c00..b88b39c6f 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Tango.AzureUtils.UI.csproj +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Tango.AzureUtils.UI.csproj @@ -207,9 +207,13 @@ + + + EnvironmentRollbackView.xaml + EnvironmentCreationView.xaml @@ -252,6 +256,10 @@ Designer MSBuild:Compile + + MSBuild:Compile + Designer + Designer MSBuild:Compile diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModelLocator.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModelLocator.cs index 4fd7293c9..ef765f93a 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModelLocator.cs @@ -24,6 +24,7 @@ namespace Tango.AzureUtils.UI TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); + TangoIOC.Default.Register(); TangoIOC.Default.Register(); } @@ -76,5 +77,13 @@ namespace Tango.AzureUtils.UI return TangoIOC.Default.GetInstance(); } } + + public static EnvironmentRollbackViewVM EnvironmentRollbackViewVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } } } diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentFirmwareUpgradeViewVM.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentFirmwareUpgradeViewVM.cs index 54576cda7..964febbd8 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentFirmwareUpgradeViewVM.cs +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentFirmwareUpgradeViewVM.cs @@ -94,10 +94,6 @@ namespace Tango.AzureUtils.UI.ViewModels IsFree = false; await _firmwareManager.InjectFirmwarePackage(SelectedDeploymentSlot, FilePath); - - var old = SelectedDeploymentSlot; - SelectedDeploymentSlot = null; - SelectedDeploymentSlot = old; } catch (Exception ex) { @@ -105,8 +101,18 @@ namespace Tango.AzureUtils.UI.ViewModels } finally { + RequireRefresh(); IsFree = true; } } + + protected override void OnRefreshRequired() + { + base.OnRefreshRequired(); + + var old = SelectedDeploymentSlot; + SelectedDeploymentSlot = null; + SelectedDeploymentSlot = old; + } } } diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentRemovalViewVM.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentRemovalViewVM.cs index 0917b012d..e296ac16e 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentRemovalViewVM.cs +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentRemovalViewVM.cs @@ -77,8 +77,6 @@ namespace Tango.AzureUtils.UI.ViewModels Config.Password = Settings.Password; await _environmentManager.RemoveEnvironment(SelectedDeploymentSlot, SlotName, Config); - - SelectedDeploymentSlot = null; } catch (Exception ex) { @@ -86,8 +84,15 @@ namespace Tango.AzureUtils.UI.ViewModels } finally { + RequireRefresh(); IsFree = true; } } + + protected override void OnRefreshRequired() + { + base.OnRefreshRequired(); + SelectedDeploymentSlot = null; + } } } diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentRollbackViewVM.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentRollbackViewVM.cs new file mode 100644 index 000000000..69e18b51d --- /dev/null +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentRollbackViewVM.cs @@ -0,0 +1,86 @@ +using Microsoft.Azure.Management.AppService.Fluent; +using Microsoft.Azure.Management.Fluent; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.AzureUtils.Environment; +using Tango.Core.Commands; + +namespace Tango.AzureUtils.UI.ViewModels +{ + public class EnvironmentRollbackViewVM : AzureDashboardViewModel + { + private IWebAppBase _machineServiceApp; + private EnvironmentManager _environmentManager; + + private List _deploymentSlots; + public List DeploymentSlots + { + get { return _deploymentSlots; } + set { _deploymentSlots = value; RaisePropertyChangedAuto(); } + } + + private IDeploymentSlot _selectedDeploymentSlot; + public IDeploymentSlot SelectedDeploymentSlot + { + get { return _selectedDeploymentSlot; } + set { _selectedDeploymentSlot = value; RaisePropertyChangedAuto(); } + } + + private RollbackEnvironmentConfiguration _config; + public RollbackEnvironmentConfiguration Config + { + get { return _config; } + set { _config = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand RollbackEnvironmentCommand { get; set; } + + public EnvironmentRollbackViewVM() + { + RollbackEnvironmentCommand = new RelayCommand(RollbackEnvironment); + Config = new RollbackEnvironmentConfiguration(); + } + + public override void OnAuthenticated(IAzure azure, List apps) + { + _machineServiceApp = apps.SingleOrDefault(x => x.Name == "MachineService"); + DeploymentSlots = apps.OfType().Where(x => x.Parent == _machineServiceApp).ToList(); + SelectedDeploymentSlot = DeploymentSlots.FirstOrDefault(); + + _environmentManager = new EnvironmentManager(azure); + _environmentManager.ConfirmationRequired += ConfirmationHandler; + _environmentManager.Progress += ProgressHandler; + } + + private async void RollbackEnvironment() + { + try + { + IsFree = false; + + await _environmentManager.RollbackEnvironment(SelectedDeploymentSlot, Config); + } + catch (Exception ex) + { + StatusManager.UpdateStatus(ex); + } + finally + { + RequireRefresh(); + IsFree = true; + } + } + + protected override void OnRefreshRequired() + { + base.OnRefreshRequired(); + + var old = SelectedDeploymentSlot; + SelectedDeploymentSlot = null; + SelectedDeploymentSlot = old; + } + } +} diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentUpgradeViewVM.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentUpgradeViewVM.cs index 14e4bf196..3f353d54d 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentUpgradeViewVM.cs +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentUpgradeViewVM.cs @@ -112,13 +112,6 @@ namespace Tango.AzureUtils.UI.ViewModels { IsFree = false; await EnvironmentManager.UpgradeEnvironment(SelectedSourceApp, SelectedTargetApp, Config); - - var oldSource = SelectedSourceApp; - var oldTarget = SelectedTargetApp; - SelectedSourceApp = null; - SelectedTargetApp = null; - SelectedSourceApp = oldSource; - SelectedTargetApp = oldTarget; } catch (Exception ex) { @@ -126,8 +119,21 @@ namespace Tango.AzureUtils.UI.ViewModels } finally { + RequireRefresh(); IsFree = true; } } + + protected override void OnRefreshRequired() + { + base.OnRefreshRequired(); + + var oldSource = SelectedSourceApp; + var oldTarget = SelectedTargetApp; + SelectedSourceApp = null; + SelectedTargetApp = null; + SelectedSourceApp = oldSource; + SelectedTargetApp = oldTarget; + } } } diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentRollbackView.xaml b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentRollbackView.xaml new file mode 100644 index 000000000..d3a198e21 --- /dev/null +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentRollbackView.xaml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + Rollback Machine Studio Version + Rollback PPC Version + + + + + + + diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentRollbackView.xaml.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentRollbackView.xaml.cs new file mode 100644 index 000000000..aa38c19d0 --- /dev/null +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentRollbackView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.AzureUtils.UI.Views +{ + /// + /// Interaction logic for EnvironmentCreationView.xaml + /// + public partial class EnvironmentRollbackView : UserControl + { + public EnvironmentRollbackView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/MainView.xaml b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/MainView.xaml index b79d306d1..aa3623f4b 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/MainView.xaml @@ -55,6 +55,9 @@ + + + diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils/Database/DatabaseManager.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils/Database/DatabaseManager.cs index 0c2e56edf..cb1a608a8 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils/Database/DatabaseManager.cs +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils/Database/DatabaseManager.cs @@ -231,6 +231,36 @@ namespace Tango.AzureUtils.Database } } + public async Task DowngradeMachineStudioVersion(IWebAppBase app) + { + var latestMachineStudioVersion = await GetLatestMachineStudioVersion(app); + var dataSource = (await app.GetMachineServiceSettingsAsync()).ToDataSource(); + + OnProgress(AzureUtilsStage.Database, $"Removing machine studio database entry for version '{latestMachineStudioVersion.Version}'..."); + + using (var db = ObservablesContext.CreateDefault(dataSource)) + { + var latest = await db.MachineStudioVersions.SingleOrDefaultAsync(x => x.Guid == latestMachineStudioVersion.Guid); + db.MachineStudioVersions.Remove(latest); + await db.SaveChangesAsync(); + } + } + + public async Task DowngradePPCVersion(IWebAppBase app) + { + var latestPPCVersion = await GetLatestPPCVersion(app); + var dataSource = (await app.GetMachineServiceSettingsAsync()).ToDataSource(); + + OnProgress(AzureUtilsStage.Database, $"Removing PPC database entry for version '{latestPPCVersion.Version}'..."); + + using (var db = ObservablesContext.CreateDefault(dataSource)) + { + var latest = await db.TangoVersions.SingleOrDefaultAsync(x => x.Guid == latestPPCVersion.Guid); + db.TangoVersions.Remove(latest); + await db.SaveChangesAsync(); + } + } + public async Task GetLatestMachineStudioVersion(IWebAppBase app) { OnProgress(AzureUtilsStage.Database, $"Getting latest machine studio version on '{app.Name}'..."); diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils/Environment/EnvironmentManager.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils/Environment/EnvironmentManager.cs index 83b0c29ee..53665a73d 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils/Environment/EnvironmentManager.cs +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils/Environment/EnvironmentManager.cs @@ -453,5 +453,61 @@ namespace Tango.AzureUtils.Environment } #endregion + + #region Rollback + + public async Task RollbackEnvironment(IWebAppBase app, RollbackEnvironmentConfiguration config) + { + OnProgress(AzureUtilsStage.Environment, $"Retrieving settings for '{app.Name}'..."); + + var settings = await app.GetMachineServiceSettingsAsync(); + await _storageManager.Connect(settings.STORAGE_ACCOUNT); + + if (config.RollbackMachineStudio) + { + try + { + await _storageManager.DowngradeMachineStudioStorage(app); + } + catch (Exception ex) + { + await RequestConfirmation($"Error occurred while trying to remove machine studio storage blobs.\n{ex.FlattenMessage()}\nDo you wish to continue?"); + } + + try + { + await _databaseManager.DowngradeMachineStudioVersion(app); + } + catch (Exception ex) + { + await RequestConfirmation($"Error occurred while trying to remove machine studio database version.\n{ex.FlattenMessage()}\nDo you wish to continue?"); + } + } + + if (config.RollbackPPC) + { + try + { + await _storageManager.DowngradePPCStorage(app); + } + catch (Exception ex) + { + await RequestConfirmation($"Error occurred while trying to remove PPC storage blobs.\n{ex.FlattenMessage()}\nDo you wish to continue?"); + } + + try + { + await _databaseManager.DowngradePPCVersion(app); + } + catch (Exception ex) + { + await RequestConfirmation($"Error occurred while trying to remove PPC database version.\n{ex.FlattenMessage()}\nDo you wish to continue?"); + } + } + + OnCompleted("Environment rollback completed successfully."); + } + + #endregion } } diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils/Environment/RollbackEnvironmentConfiguration.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils/Environment/RollbackEnvironmentConfiguration.cs new file mode 100644 index 000000000..da0f68aac --- /dev/null +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils/Environment/RollbackEnvironmentConfiguration.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.AzureUtils.Environment +{ + public class RollbackEnvironmentConfiguration + { + public bool RollbackMachineStudio { get; set; } + + public bool RollbackPPC { get; set; } + } +} diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils/Storage/StorageManager.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils/Storage/StorageManager.cs index 3551bf4f4..77a0aaf6d 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils/Storage/StorageManager.cs +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils/Storage/StorageManager.cs @@ -68,6 +68,14 @@ namespace Tango.AzureUtils.Storage await container.DeleteAsync(); } + public async Task RemoveBlob(String containerName, String blobName) + { + OnProgress(AzureUtilsStage.Storage, $"Removing blob '{blobName}'..."); + var container = _client.GetContainerReference(containerName); + var blob = container.GetBlockBlobReference(blobName); + await blob.DeleteAsync(); + } + public async Task UpgradePPCStorage(IWebAppBase sourceApp, IWebAppBase targetApp) { OnProgress(AzureUtilsStage.Storage, $"Retrieving source and target settings..."); @@ -134,6 +142,32 @@ namespace Tango.AzureUtils.Storage }); } + public async Task DowngradeMachineStudioStorage(IWebAppBase app) + { + OnProgress(AzureUtilsStage.Storage, $"Retrieving settings..."); + + var latestMachineStudioVersion = await _databaseManager.GetLatestMachineStudioVersion(app); + var settings = await app.GetMachineServiceSettingsAsync(); + + await RemoveBlob(settings.MACHINE_STUDIO_VERSIONS_CONTAINER, latestMachineStudioVersion.BlobName); + await RemoveBlob(settings.MACHINE_STUDIO_VERSIONS_CONTAINER, latestMachineStudioVersion.InstallerBlobName); + + OnCompleted("Latest Machine Studio storage blobs removed."); + } + + public async Task DowngradePPCStorage(IWebAppBase app) + { + OnProgress(AzureUtilsStage.Storage, $"Retrieving settings..."); + + var latestPPCVersion = await _databaseManager.GetLatestPPCVersion(app); + var settings = await app.GetMachineServiceSettingsAsync(); + + await RemoveBlob(settings.TANGO_VERSIONS_CONTAINER, latestPPCVersion.BlobName); + await RemoveBlob(settings.TANGO_VERSIONS_CONTAINER, latestPPCVersion.InstallerBlobName); + + OnCompleted("Latest PPC storage blobs removed."); + } + public async Task ValidatePPCStorageUpgrade(IWebAppBase sourceApp, IWebAppBase targetApp) { OnProgress(AzureUtilsStage.Validating, "Validating PPC database upgrade..."); diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils/Tango.AzureUtils.csproj b/Software/Visual_Studio/Azure/Tango.AzureUtils/Tango.AzureUtils.csproj index 4a8daf233..896c34635 100644 --- a/Software/Visual_Studio/Azure/Tango.AzureUtils/Tango.AzureUtils.csproj +++ b/Software/Visual_Studio/Azure/Tango.AzureUtils/Tango.AzureUtils.csproj @@ -241,6 +241,7 @@ + diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/DiagnosticsModule.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/DiagnosticsModule.cs new file mode 100644 index 000000000..786cbb773 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/DiagnosticsModule.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; +using Tango.FSE.Common; +using Tango.FSE.Diagnostics.Views; + +namespace Tango.FSE.Diagnostics +{ + [FSEModule(index: 0, HomeViewName = "MainView")] + public class DiagnosticsModule : FSEModuleBase + { + public override string Name { get; } = "Diagnostics"; + public override string Description { get; } = "Diagnostics module"; + public override BitmapSource Image { get; } + public override Type MainViewType { get; } = typeof(MainView); + public override Tango.BL.Enumerations.Permissions Permission { get; } = BL.Enumerations.Permissions.RunPPC; + + public override void Dispose() + { + + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Properties/AssemblyInfo.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..9bd7d7e19 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango.FSE.Diagnostics")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Tango.FSE.Diagnostics")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly:ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Properties/Resources.Designer.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Properties/Resources.Designer.cs new file mode 100644 index 000000000..67455de79 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Properties/Resources.Designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.FSE.Diagnostics.Properties { + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if ((resourceMan == null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.FSE.Diagnostics.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Properties/Resources.resx b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Properties/Settings.Designer.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Properties/Settings.Designer.cs new file mode 100644 index 000000000..db45a4faf --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.FSE.Diagnostics.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Properties/Settings.settings b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Tango.FSE.Diagnostics.csproj b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Tango.FSE.Diagnostics.csproj new file mode 100644 index 000000000..524b2c315 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Tango.FSE.Diagnostics.csproj @@ -0,0 +1,123 @@ + + + + + Debug + AnyCPU + {8CFFA4FC-F46F-475D-A270-DAFBFB532BC8} + library + Tango.FSE.Diagnostics + Tango.FSE.Diagnostics + v4.6.1 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + + + true + full + false + ..\..\..\Build\FSE\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\..\Build\FSE\Release\ + TRACE + prompt + 4 + + + + ..\..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll + + + ..\..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll + + + + + + + + + + + + 4.0 + + + + + + + + + + + MainView.xaml + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + {f441feee-322a-4943-b566-110e12fd3b72} + Tango.BL + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} + Tango.Logging + + + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} + Tango.Settings + + + {8491d07b-c1f6-4b62-a412-41b9fd2d6538} + Tango.SharedUI + + + {bc37cccb-7392-4f78-8d1c-e9629e6e046e} + Tango.FSE.Common + + + + + Designer + MSBuild:Compile + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/ViewModelLocator.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/ViewModelLocator.cs new file mode 100644 index 000000000..6cb3edceb --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/ViewModelLocator.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; +using Tango.FSE.Diagnostics.ViewModels; + +namespace Tango.FSE.Diagnostics +{ + public static class ViewModelLocator + { + static ViewModelLocator() + { + TangoIOC.Default.Register(); + } + + public static MainViewVM MainViewVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/ViewModels/MainViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/ViewModels/MainViewVM.cs new file mode 100644 index 000000000..6e2e888a0 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/ViewModels/MainViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.FSE.Common; + +namespace Tango.FSE.Diagnostics.ViewModels +{ + public class MainViewVM : FSEViewModel + { + public override void OnApplicationStarted() + { + + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Views/MainView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Views/MainView.xaml new file mode 100644 index 000000000..e04aaeb98 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Views/MainView.xaml @@ -0,0 +1,14 @@ + + + Diagnostics View + + diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Views/MainView.xaml.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Views/MainView.xaml.cs new file mode 100644 index 000000000..7ff873fe8 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/Views/MainView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.FSE.Diagnostics.Views +{ + /// + /// Interaction logic for MainView.xaml + /// + public partial class MainView : UserControl + { + public MainView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/app.config b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/app.config new file mode 100644 index 000000000..36bc04f85 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/app.config @@ -0,0 +1,85 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/packages.config b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/packages.config new file mode 100644 index 000000000..b3daf0d6c --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Diagnostics/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/App.config b/Software/Visual_Studio/FSE/Tango.FSE.Common/App.config new file mode 100644 index 000000000..a9375f6a2 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/App.config @@ -0,0 +1,85 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/App.xaml b/Software/Visual_Studio/FSE/Tango.FSE.Common/App.xaml new file mode 100644 index 000000000..42b782f1e --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/App.xaml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Authentication/AuthenticationResult.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Authentication/AuthenticationResult.cs new file mode 100644 index 000000000..d72413521 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Authentication/AuthenticationResult.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.FSE.Web.Messages; + +namespace Tango.FSE.Common.Authentication +{ + public class AuthenticationResult + { + public LoginResponse Response { get; set; } + public User User { get; set; } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Authentication/IAuthenticationProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Authentication/IAuthenticationProvider.cs new file mode 100644 index 000000000..fd51a793c --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Authentication/IAuthenticationProvider.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.MachineService.Gateway; + +namespace Tango.FSE.Common.Authentication +{ + /// + /// Represents the user authentication provider responsible for the current logged-in user. + /// + public interface IAuthenticationProvider + { + /// + /// Occurs when the current logged-in user has changed. + /// + event EventHandler CurrentUserChanged; + + /// + /// Gets the current logged-in user. + /// + User CurrentUser { get; } + + /// + /// Performs a user login by the specified email and password. + /// + /// The email. + /// The password. + /// The environment. + /// + Task Login(String email, String password, EnvironmentConfiguration environment); + + /// + /// Logs-out the current logged-in user. + /// + void LogOut(); + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEApplication/IFSEApplicationManager.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEApplication/IFSEApplicationManager.cs new file mode 100644 index 000000000..56a95ea70 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEApplication/IFSEApplicationManager.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using Tango.BL.Entities; + +namespace Tango.FSE.Common.FSEApplication +{ + /// + /// Represents the application manager. + /// + public interface IFSEApplicationManager + { + /// + /// Occurs when the application has started. + /// + event EventHandler ApplicationStarted; + + /// + /// Occurs when the application is ready and all modules are views are loaded. + /// + event EventHandler ApplicationReady; + + /// + /// Occurs when the main window content has been rendered. + /// + event EventHandler ContentRendered; + + /// + /// Occurs when all PPC modules are ready and initialized. + /// + event EventHandler ModulesInitialized; + + /// + /// Occurs when the application has encountered an error when initializing. + /// + event EventHandler ApplicationInitializationError; + + /// + /// Gets a value indicating whether the application is shutting down. + /// + bool IsShuttingDown { get; } + + /// + /// Gets a value indicating whether an update has occurred before the application started. + /// + bool IsAfterUpdate { get; } + + /// + /// Gets the application startup arguments. + /// + List StartupArgs { get; } + + /// + /// Shutdown the application. + /// + void ShutDown(); + + /// + /// Restarts the application. + /// + void Restart(); + + /// + /// Gets the application version. + /// + Version Version { get; } + + /// + /// Gets the application build date. + /// + String BuildDate { get; } + + /// + /// Gets the application startup date. + /// + DateTime StartUpDate { get; } + + /// + /// Gets or sets the application folder. + /// + String StartPath { get; } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEModuleAttribute.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEModuleAttribute.cs new file mode 100644 index 000000000..6e5f679bd --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEModuleAttribute.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.FSE.Common +{ + /// + /// Represents a attribute + /// + /// + [AttributeUsage(AttributeTargets.Class)] + public class FSEModuleAttribute : Attribute + { + /// + /// Gets or sets the module index. + /// + public int Index { get; private set; } + + /// + /// Gets or sets the home view. + /// + public String HomeViewName { get; set; } + + /// + /// Gets or sets a value indicating whether to dock this module menu item to the bottom.. + /// + public bool DockToBottom { get; set; } + + /// + /// Initializes a new instance of the class. + /// + /// The module index. + public FSEModuleAttribute(int index) + { + Index = index; + } + + /// + /// Initializes a new instance of the class. + /// + /// The module index. + /// Name of the home view. + public FSEModuleAttribute(int index, String homeViewName) : this(index) + { + HomeViewName = homeViewName; + } + + /// + /// Initializes a new instance of the class. + /// + /// The module index. + /// Name of the home view. + public FSEModuleAttribute(int index, String homeViewName, bool dockToBottom) : this(index, homeViewName) + { + HomeViewName = homeViewName; + DockToBottom = dockToBottom; + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEModuleBase.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEModuleBase.cs new file mode 100644 index 000000000..cdbc48bfc --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEModuleBase.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media.Imaging; +using Tango.Core; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using System.Reflection; + +namespace Tango.FSE.Common +{ + /// + /// Represents a base class for PPC modules. + /// + /// + public abstract class FSEModuleBase : ExtendedObject, IFSEModule + { + private bool _isVisibleInMenu = true; + /// + /// Gets a value indicating whether this module should be displayed in the application menu. + /// + public bool IsVisibleInMenu + { + get { return _isVisibleInMenu; } + protected set { _isVisibleInMenu = value; RaisePropertyChangedAuto(); } + } + + /// + /// Gets a value indicating whether to dock this module menu item to the bottom. + /// + public bool DockToBottom + { + get { return this.GetType().GetCustomAttribute().DockToBottom; } + } + + /// + /// Gets the module name. + /// + public abstract string Name { get; } + + /// + /// Gets the module description. + /// + public abstract string Description { get; } + + /// + /// Gets the module cover image. + /// + public abstract BitmapSource Image { get; } + + /// + /// Gets the module entry point view type. + /// + public abstract Type MainViewType { get; } + + /// + /// Gets the permission required to see and load this module. + /// + public abstract Permissions Permission { get; } + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + public abstract void Dispose(); + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/FSESettings.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/FSESettings.cs new file mode 100644 index 000000000..24a08c55e --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/FSESettings.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Settings; + +namespace Tango.FSE.Common +{ + public class FSESettings : SettingsBase + { + public enum WorkingEnvironment + { + Remote, + Local + } + + /// + /// Gets or sets the working environment. + /// + public WorkingEnvironment Environment { get; set; } + + /// + /// Gets or sets the last login email. + /// + public String LastLoginEmail { get; set; } + + /// + /// Gets or sets the last login password. + /// + public String LastLoginPassword { get; set; } + + /// + /// Gets or sets a value indicating whether to save the user credentials. + /// + public bool RememberMe { get; set; } + + /// + /// Gets or sets a value indicating whether to force the application version update. + /// + public bool ForceVersionUpdate { get; set; } + + /// + /// Gets or sets the last environment identifier. + /// + public String LastEnvironmentId { get; set; } + + /// + /// Initializes a new instance of the class. + /// + public FSESettings() + { + Environment = WorkingEnvironment.Remote; + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs new file mode 100644 index 000000000..d277d0bdb --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/FSEViewModel.cs @@ -0,0 +1,248 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.Core.DI; +using Tango.FSE.Common.Authentication; +using Tango.FSE.Common.FSEApplication; +using Tango.FSE.Common.Gateway; +using Tango.FSE.Common.Navigation; +using Tango.FSE.Common.Notifications; +using Tango.Settings; +using Tango.SharedUI; +using static Tango.SharedUI.Controls.NavigationControl; + +namespace Tango.FSE.Common +{ + /// + /// Represents a PPC view model base class. + /// + /// + public abstract class FSEViewModel : ViewModel, INavigationBlocker + { + /// + /// Gets the static observable entities adapter. + /// + public ObservablesStaticCollections Adapter + { + get { return ObservablesStaticCollections.Instance; } + } + + /// + /// Gets or sets the application manager. + /// + [TangoInject] + public IGatewayService GatewayService { get; set; } + + /// + /// Gets or sets the application manager. + /// + [TangoInject] + public IFSEApplicationManager ApplicationManager { get; set; } + + /// + /// Gets or sets the authentication provider. + /// + [TangoInject] + public IAuthenticationProvider AuthenticationProvider { get; set; } + + /// + /// Gets or sets the navigation manager. + /// + [TangoInject] + public INavigationManager NavigationManager { get; set; } + + /// + /// Gets or sets the notification provider. + /// + [TangoInject] + public INotificationProvider NotificationProvider { get; set; } + + private FSESettings _settings; + /// + /// Gets the main PPC settings. + /// + public FSESettings Settings + { + get + { + if (_settings == null) + { + _settings = SettingsManager.Default.GetOrCreate(); + } + + return _settings; + } + private set { _settings = value; } + } + + private bool _isVisible; + /// + /// Gets or sets a value indicating whether this view is visible. + /// + public bool IsVisible + { + get { return _isVisible; } + private set { _isVisible = value; RaisePropertyChangedAuto(); } + } + + /// + /// Called when the application has been started. + /// + public abstract void OnApplicationStarted(); + + /// + /// Called when the application is shutting down. + /// + public virtual void OnApplicationShuttingDown() + { + + } + + /// + /// Called when the navigation system has navigated to this VM view. + /// + public virtual void OnNavigatedTo() + { + IsVisible = true; + } + + /// + /// Called when the navigation system has navigated to this VM view. + /// + /// The view model instance of the previous view model + public virtual void OnNavigatedTo(FSEViewModel fromVM) + { + + } + + /// + /// Called when the navigation system has navigated from this VM view. + /// + public virtual void OnNavigatedFrom() + { + IsVisible = false; + } + + /// + /// Called before the navigation system has navigated to this VM view. + /// + public virtual void OnBeforeNavigatedTo() + { + + } + + /// + /// Called before the navigation system has navigated from this VM view. + /// + public virtual void OnBeforeNavigatedFrom() + { + IsVisible = false; + } + + /// + /// Raises the specified message using the default . + /// + /// + /// The message. + protected void RaiseMessage(T message) where T : class + { + TangoMessenger.Default.Send(message); + } + + /// + /// Raises the specified message using the default . + /// + /// + protected void RaiseMessage() where T : class + { + TangoMessenger.Default.Send(Activator.CreateInstance()); + } + + /// + /// Registers a message handle for the specified message type T. + /// + /// + /// The handler. + protected void RegisterForMessage(Action handler) + { + TangoMessenger.Default.Register(handler); + } + + /// + /// Called before the navigation system navigates from this object. + /// Return false to abort the navigation. + /// + /// + public virtual Task OnNavigateOutRequest() + { + return Task.FromResult(true); + } + + /// + /// Called before the navigation system navigates back from this object. + /// Return false to abort the navigation. + /// + /// + public virtual Task OnNavigateBackRequest() + { + return Task.FromResult(true); + } + + /// + /// Called when the application is ready and all modules views are loaded. + /// + public virtual void OnApplicationReady() + { + + } + } + + /// + /// Represents a PPC view model base class a View property as an instance of a contract. + /// + /// + /// + public abstract class FSEViewModel : FSEViewModel where T : IFSEView + { + private T _view; + /// + /// Gets the IPPCView instance. + /// + [TangoInject(TangoInjectMode.WhenAvailable)] + public T View + { + get { return _view; } + set + { + _view = value; + ViewAttached = true; + OnViewAttached(); + } + } + + + /// + /// Gets a value indicating whether the instance of IPPCView is available. + /// + public bool ViewAttached { get; private set; } + + /// + /// Called when the application has been started. + /// + public override void OnApplicationStarted() + { + + } + + /// + /// Called when the instance of IPPCView is available. + /// + public virtual void OnViewAttached() + { + + } + } +} \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Gateway/GatewayClient.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Gateway/GatewayClient.cs new file mode 100644 index 000000000..f63ab354b --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Gateway/GatewayClient.cs @@ -0,0 +1,2693 @@ +//---------------------- +// +// Generated using the NSwag toolchain v13.2.3.0 (NJsonSchema v10.1.5.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) +// +//---------------------- + +#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." +#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." +#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' +#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... +#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." + +namespace Tango.MachineService.Gateway +{ + using System = global::System; + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.2.3.0 (NJsonSchema v10.1.5.0 (Newtonsoft.Json v11.0.0.0))")] + public partial class GatewayClient + { + private string _baseUrl = ""; + private System.Net.Http.HttpClient _httpClient; + private System.Lazy _settings; + + public GatewayClient(string baseUrl, System.Net.Http.HttpClient httpClient) + { + BaseUrl = baseUrl; + _httpClient = httpClient; + _settings = new System.Lazy(CreateSerializerSettings); + } + + private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() + { + var settings = new Newtonsoft.Json.JsonSerializerSettings(); + UpdateJsonSerializerSettings(settings); + return settings; + } + + public string BaseUrl + { + get { return _baseUrl; } + set { _baseUrl = value; } + } + + protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } + + partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); + partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); + partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); + + /// A server side error occurred. + public System.Threading.Tasks.Task GetEnvironmentsAsync(EnvironmentsRequest request) + { + return GetEnvironmentsAsync(request, System.Threading.CancellationToken.None); + } + + /// A server side error occurred. + public EnvironmentsResponse GetEnvironments(EnvironmentsRequest request) + { + return System.Threading.Tasks.Task.Run(async () => await GetEnvironmentsAsync(request, System.Threading.CancellationToken.None)).GetAwaiter().GetResult(); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public async System.Threading.Tasks.Task GetEnvironmentsAsync(EnvironmentsRequest request, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Gateway/GetEnvironments"); + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200") + { + var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); + return objectResponse_.Object; + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(EnvironmentsResponse); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + /// A server side error occurred. + public System.Threading.Tasks.Task ExecuteAsync(HttpControllerContext context) + { + return ExecuteAsync(context, System.Threading.CancellationToken.None); + } + + /// A server side error occurred. + public FileResponse Execute(HttpControllerContext context) + { + return System.Threading.Tasks.Task.Run(async () => await ExecuteAsync(context, System.Threading.CancellationToken.None)).GetAwaiter().GetResult(); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// A server side error occurred. + public async System.Threading.Tasks.Task ExecuteAsync(HttpControllerContext context, System.Threading.CancellationToken cancellationToken) + { + var urlBuilder_ = new System.Text.StringBuilder(); + urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Gateway/Execute"); + + var client_ = _httpClient; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(context, _settings.Value)); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + request_.Method = new System.Net.Http.HttpMethod("POST"); + request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); + + PrepareRequest(client_, request_, urlBuilder_); + var url_ = urlBuilder_.ToString(); + request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); + PrepareRequest(client_, request_, url_); + + var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + try + { + var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); + if (response_.Content != null && response_.Content.Headers != null) + { + foreach (var item_ in response_.Content.Headers) + headers_[item_.Key] = item_.Value; + } + + ProcessResponse(client_, response_); + + var status_ = ((int)response_.StatusCode).ToString(); + if (status_ == "200" || status_ == "206") + { + var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); + var fileResponse_ = new FileResponse((int)response_.StatusCode, headers_, responseStream_, null, response_); + client_ = null; response_ = null; // response and client are disposed by FileResponse + return fileResponse_; + } + else + if (status_ != "200" && status_ != "204") + { + var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); + throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + } + + return default(FileResponse); + } + finally + { + if (response_ != null) + response_.Dispose(); + } + } + } + finally + { + } + } + + protected struct ObjectResponseResult + { + public ObjectResponseResult(T responseObject, string responseText) + { + this.Object = responseObject; + this.Text = responseText; + } + + public T Object { get; } + + public string Text { get; } + } + + public bool ReadResponseAsString { get; set; } + + protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers) + { + if (response == null || response.Content == null) + { + return new ObjectResponseResult(default(T), string.Empty); + } + + if (ReadResponseAsString) + { + var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); + return new ObjectResponseResult(typedBody, responseText); + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); + } + } + else + { + try + { + using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) + using (var streamReader = new System.IO.StreamReader(responseStream)) + using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) + { + var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); + var typedBody = serializer.Deserialize(jsonTextReader); + return new ObjectResponseResult(typedBody, string.Empty); + } + } + catch (Newtonsoft.Json.JsonException exception) + { + var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; + throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); + } + } + } + + private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) + { + if (value is System.Enum) + { + string name = System.Enum.GetName(value.GetType(), value); + if (name != null) + { + var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); + if (field != null) + { + var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) + as System.Runtime.Serialization.EnumMemberAttribute; + if (attribute != null) + { + return attribute.Value != null ? attribute.Value : name; + } + } + } + } + else if (value is bool) { + return System.Convert.ToString(value, cultureInfo).ToLowerInvariant(); + } + else if (value is byte[]) + { + return System.Convert.ToBase64String((byte[]) value); + } + else if (value != null && value.GetType().IsArray) + { + var array = System.Linq.Enumerable.OfType((System.Array) value); + return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); + } + + return System.Convert.ToString(value, cultureInfo); + } + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class EnvironmentsResponse + { + [Newtonsoft.Json.JsonProperty("Environments", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Environments { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class EnvironmentConfiguration + { + [Newtonsoft.Json.JsonProperty("ID", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ID { get; set; } + + [Newtonsoft.Json.JsonProperty("Name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } + + [Newtonsoft.Json.JsonProperty("Description", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Description { get; set; } + + [Newtonsoft.Json.JsonProperty("MachineServiceAddress", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string MachineServiceAddress { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class EnvironmentsRequest + { + [Newtonsoft.Json.JsonProperty("AppSecret", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string AppSecret { get; set; } + + + } + + /// Contains information for a single HTTP operation. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class HttpControllerContext + { + /// Gets or sets the configuration. + [Newtonsoft.Json.JsonProperty("Configuration", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public HttpConfiguration Configuration { get; set; } + + /// Gets or sets the controller descriptor. + [Newtonsoft.Json.JsonProperty("ControllerDescriptor", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public HttpControllerDescriptor ControllerDescriptor { get; set; } + + /// Gets or sets the HTTP controller. + [Newtonsoft.Json.JsonProperty("Controller", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public IHttpController Controller { get; set; } + + /// Gets or sets the request. + [Newtonsoft.Json.JsonProperty("Request", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public HttpRequestMessage Request { get; set; } + + /// Gets or sets the request context. + [Newtonsoft.Json.JsonProperty("RequestContext", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public HttpRequestContext RequestContext { get; set; } + + /// Gets or sets the route data. + [Newtonsoft.Json.JsonProperty("RouteData", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public IHttpRouteData RouteData { get; set; } + + + } + + /// Represents a configuration of HttpServer instances. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class HttpConfiguration + { + /// Gets or sets the action that will perform final initialization of the HttpConfiguration instance before it is used to process requests. + [Newtonsoft.Json.JsonProperty("Initializer", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ActionOfHttpConfiguration Initializer { get; set; } + + /// Gets the list of filters that apply to all requests served using this HttpConfiguration instance. + [Newtonsoft.Json.JsonProperty("Filters", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Filters { get; set; } + + /// Gets an ordered list of DelegatingHandler instances to be invoked as an HttpRequestMessage travels up the stack and an HttpResponseMessage travels down in stack in return. + [Newtonsoft.Json.JsonProperty("MessageHandlers", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection MessageHandlers { get; set; } + + /// Gets the HttpRouteCollection associated with this HttpConfiguration instance. + [Newtonsoft.Json.JsonProperty("Routes", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Routes { get; set; } + + /// Gets the properties associated with this instance. + [Newtonsoft.Json.JsonProperty("Properties", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary Properties { get; set; } + + /// Gets the root virtual path. + [Newtonsoft.Json.JsonProperty("VirtualPathRoot", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string VirtualPathRoot { get; set; } + + /// Gets or sets the dependency resolver associated with thisinstance. + [Newtonsoft.Json.JsonProperty("DependencyResolver", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public IDependencyResolver DependencyResolver { get; set; } + + /// Gets the container of default services associated with this instance. + [Newtonsoft.Json.JsonProperty("Services", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ServicesContainer Services { get; set; } + + /// Gets the collection of rules for how parameters should be bound. + [Newtonsoft.Json.JsonProperty("ParameterBindingRules", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ParameterBindingRulesCollection ParameterBindingRules { get; set; } + + /// Gets or sets a value indicating whether error details should be included in error messages. + [Newtonsoft.Json.JsonProperty("IncludeErrorDetailPolicy", Required = Newtonsoft.Json.Required.Always)] + public IncludeErrorDetailPolicy IncludeErrorDetailPolicy { get; set; } + + /// Gets the media-type formatters for this instance. + [Newtonsoft.Json.JsonProperty("Formatters", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public MediaTypeFormatterCollection Formatters { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class ActionOfHttpConfiguration : MulticastDelegate + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class MulticastDelegate : Delegate + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class Delegate + { + [Newtonsoft.Json.JsonProperty("_target", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public object _target { get; set; } + + [Newtonsoft.Json.JsonProperty("_methodBase", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public object _methodBase { get; set; } + + [Newtonsoft.Json.JsonProperty("_methodPtr", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public IntPtr _methodPtr { get; set; } = new IntPtr(); + + [Newtonsoft.Json.JsonProperty("_methodPtrAux", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public IntPtr _methodPtrAux { get; set; } = new IntPtr(); + + [Newtonsoft.Json.JsonProperty("Method", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public MethodInfo Method { get; set; } + + [Newtonsoft.Json.JsonProperty("Target", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public object Target { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class IntPtr + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class MethodInfo : MethodBase + { + [Newtonsoft.Json.JsonProperty("MemberType", Required = Newtonsoft.Json.Required.Always)] + public MemberTypes MemberType { get; set; } + + [Newtonsoft.Json.JsonProperty("ReturnType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ReturnType { get; set; } + + [Newtonsoft.Json.JsonProperty("ReturnParameter", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ParameterInfo ReturnParameter { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + [System.Flags] + public enum MemberTypes + { + Constructor = 1, + + Event = 2, + + Field = 4, + + Method = 8, + + Property = 16, + + TypeInfo = 32, + + Custom = 64, + + NestedType = 128, + + All = 191, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class ParameterInfo + { + [Newtonsoft.Json.JsonProperty("ParameterType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ParameterType { get; set; } + + [Newtonsoft.Json.JsonProperty("Name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } + + [Newtonsoft.Json.JsonProperty("HasDefaultValue", Required = Newtonsoft.Json.Required.Always)] + public bool HasDefaultValue { get; set; } + + [Newtonsoft.Json.JsonProperty("DefaultValue", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public object DefaultValue { get; set; } + + [Newtonsoft.Json.JsonProperty("RawDefaultValue", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public object RawDefaultValue { get; set; } + + [Newtonsoft.Json.JsonProperty("Position", Required = Newtonsoft.Json.Required.Always)] + public int Position { get; set; } + + [Newtonsoft.Json.JsonProperty("Attributes", Required = Newtonsoft.Json.Required.Always)] + public ParameterAttributes Attributes { get; set; } + + [Newtonsoft.Json.JsonProperty("Member", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public MemberInfo Member { get; set; } + + [Newtonsoft.Json.JsonProperty("IsIn", Required = Newtonsoft.Json.Required.Always)] + public bool IsIn { get; set; } + + [Newtonsoft.Json.JsonProperty("IsOut", Required = Newtonsoft.Json.Required.Always)] + public bool IsOut { get; set; } + + [Newtonsoft.Json.JsonProperty("IsLcid", Required = Newtonsoft.Json.Required.Always)] + public bool IsLcid { get; set; } + + [Newtonsoft.Json.JsonProperty("IsRetval", Required = Newtonsoft.Json.Required.Always)] + public bool IsRetval { get; set; } + + [Newtonsoft.Json.JsonProperty("IsOptional", Required = Newtonsoft.Json.Required.Always)] + public bool IsOptional { get; set; } + + [Newtonsoft.Json.JsonProperty("MetadataToken", Required = Newtonsoft.Json.Required.Always)] + public int MetadataToken { get; set; } + + [Newtonsoft.Json.JsonProperty("CustomAttributes", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection CustomAttributes { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + [System.Flags] + public enum ParameterAttributes + { + None = 0, + + In = 1, + + Out = 2, + + Lcid = 4, + + Retval = 8, + + Optional = 16, + + HasDefault = 4096, + + HasFieldMarshal = 8192, + + Reserved3 = 16384, + + Reserved4 = 32768, + + ReservedMask = 61440, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class MemberInfo + { + [Newtonsoft.Json.JsonProperty("CustomAttributes", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection CustomAttributes { get; set; } + + [Newtonsoft.Json.JsonProperty("MetadataToken", Required = Newtonsoft.Json.Required.Always)] + public int MetadataToken { get; set; } + + [Newtonsoft.Json.JsonProperty("Module", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Module Module { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class CustomAttributeData + { + [Newtonsoft.Json.JsonProperty("AttributeType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string AttributeType { get; set; } + + [Newtonsoft.Json.JsonProperty("Constructor", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ConstructorInfo Constructor { get; set; } + + [Newtonsoft.Json.JsonProperty("ConstructorArguments", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection ConstructorArguments { get; set; } + + [Newtonsoft.Json.JsonProperty("NamedArguments", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection NamedArguments { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class ConstructorInfo : MethodBase + { + [Newtonsoft.Json.JsonProperty("MemberType", Required = Newtonsoft.Json.Required.Always)] + public MemberTypes MemberType { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class MethodBase : MemberInfo + { + [Newtonsoft.Json.JsonProperty("MethodImplementationFlags", Required = Newtonsoft.Json.Required.Always)] + public MethodImplAttributes MethodImplementationFlags { get; set; } + + [Newtonsoft.Json.JsonProperty("CallingConvention", Required = Newtonsoft.Json.Required.Always)] + public CallingConventions CallingConvention { get; set; } + + [Newtonsoft.Json.JsonProperty("IsGenericMethodDefinition", Required = Newtonsoft.Json.Required.Always)] + public bool IsGenericMethodDefinition { get; set; } + + [Newtonsoft.Json.JsonProperty("ContainsGenericParameters", Required = Newtonsoft.Json.Required.Always)] + public bool ContainsGenericParameters { get; set; } + + [Newtonsoft.Json.JsonProperty("IsGenericMethod", Required = Newtonsoft.Json.Required.Always)] + public bool IsGenericMethod { get; set; } + + [Newtonsoft.Json.JsonProperty("IsSecurityCritical", Required = Newtonsoft.Json.Required.Always)] + public bool IsSecurityCritical { get; set; } + + [Newtonsoft.Json.JsonProperty("IsSecuritySafeCritical", Required = Newtonsoft.Json.Required.Always)] + public bool IsSecuritySafeCritical { get; set; } + + [Newtonsoft.Json.JsonProperty("IsSecurityTransparent", Required = Newtonsoft.Json.Required.Always)] + public bool IsSecurityTransparent { get; set; } + + [Newtonsoft.Json.JsonProperty("IsPublic", Required = Newtonsoft.Json.Required.Always)] + public bool IsPublic { get; set; } + + [Newtonsoft.Json.JsonProperty("IsPrivate", Required = Newtonsoft.Json.Required.Always)] + public bool IsPrivate { get; set; } + + [Newtonsoft.Json.JsonProperty("IsFamily", Required = Newtonsoft.Json.Required.Always)] + public bool IsFamily { get; set; } + + [Newtonsoft.Json.JsonProperty("IsAssembly", Required = Newtonsoft.Json.Required.Always)] + public bool IsAssembly { get; set; } + + [Newtonsoft.Json.JsonProperty("IsFamilyAndAssembly", Required = Newtonsoft.Json.Required.Always)] + public bool IsFamilyAndAssembly { get; set; } + + [Newtonsoft.Json.JsonProperty("IsFamilyOrAssembly", Required = Newtonsoft.Json.Required.Always)] + public bool IsFamilyOrAssembly { get; set; } + + [Newtonsoft.Json.JsonProperty("IsStatic", Required = Newtonsoft.Json.Required.Always)] + public bool IsStatic { get; set; } + + [Newtonsoft.Json.JsonProperty("IsFinal", Required = Newtonsoft.Json.Required.Always)] + public bool IsFinal { get; set; } + + [Newtonsoft.Json.JsonProperty("IsVirtual", Required = Newtonsoft.Json.Required.Always)] + public bool IsVirtual { get; set; } + + [Newtonsoft.Json.JsonProperty("IsHideBySig", Required = Newtonsoft.Json.Required.Always)] + public bool IsHideBySig { get; set; } + + [Newtonsoft.Json.JsonProperty("IsAbstract", Required = Newtonsoft.Json.Required.Always)] + public bool IsAbstract { get; set; } + + [Newtonsoft.Json.JsonProperty("IsSpecialName", Required = Newtonsoft.Json.Required.Always)] + public bool IsSpecialName { get; set; } + + [Newtonsoft.Json.JsonProperty("IsConstructor", Required = Newtonsoft.Json.Required.Always)] + public bool IsConstructor { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum MethodImplAttributes + { + IL = 0, + + Managed = 0, + + Native = 1, + + OPTIL = 2, + + Runtime = 3, + + CodeTypeMask = 3, + + Unmanaged = 4, + + ManagedMask = 4, + + NoInlining = 8, + + ForwardRef = 16, + + Synchronized = 32, + + NoOptimization = 64, + + PreserveSig = 128, + + AggressiveInlining = 256, + + SecurityMitigations = 1024, + + InternalCall = 4096, + + MaxMethodImplVal = 65535, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + [System.Flags] + public enum CallingConventions + { + Standard = 1, + + VarArgs = 2, + + Any = 3, + + HasThis = 32, + + ExplicitThis = 64, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class CustomAttributeTypedArgument + { + [Newtonsoft.Json.JsonProperty("ArgumentType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ArgumentType { get; set; } + + [Newtonsoft.Json.JsonProperty("Value", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public object Value { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class CustomAttributeNamedArgument + { + [Newtonsoft.Json.JsonProperty("MemberInfo", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public MemberInfo MemberInfo { get; set; } + + [Newtonsoft.Json.JsonProperty("TypedValue", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public CustomAttributeTypedArgument TypedValue { get; set; } = new CustomAttributeTypedArgument(); + + [Newtonsoft.Json.JsonProperty("MemberName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string MemberName { get; set; } + + [Newtonsoft.Json.JsonProperty("IsField", Required = Newtonsoft.Json.Required.Always)] + public bool IsField { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class Module + { + [Newtonsoft.Json.JsonProperty("CustomAttributes", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection CustomAttributes { get; set; } + + [Newtonsoft.Json.JsonProperty("MDStreamVersion", Required = Newtonsoft.Json.Required.Always)] + public int MDStreamVersion { get; set; } + + [Newtonsoft.Json.JsonProperty("FullyQualifiedName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string FullyQualifiedName { get; set; } + + [Newtonsoft.Json.JsonProperty("ModuleVersionId", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.Guid ModuleVersionId { get; set; } + + [Newtonsoft.Json.JsonProperty("MetadataToken", Required = Newtonsoft.Json.Required.Always)] + public int MetadataToken { get; set; } + + [Newtonsoft.Json.JsonProperty("ScopeName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ScopeName { get; set; } + + [Newtonsoft.Json.JsonProperty("Name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } + + [Newtonsoft.Json.JsonProperty("Assembly", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Assembly Assembly { get; set; } + + [Newtonsoft.Json.JsonProperty("ModuleHandle", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public ModuleHandle ModuleHandle { get; set; } = new ModuleHandle(); + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class Assembly + { + [Newtonsoft.Json.JsonProperty("CodeBase", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string CodeBase { get; set; } + + [Newtonsoft.Json.JsonProperty("EscapedCodeBase", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string EscapedCodeBase { get; set; } + + [Newtonsoft.Json.JsonProperty("FullName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string FullName { get; set; } + + [Newtonsoft.Json.JsonProperty("EntryPoint", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public MethodInfo EntryPoint { get; set; } + + [Newtonsoft.Json.JsonProperty("ExportedTypes", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection ExportedTypes { get; set; } + + [Newtonsoft.Json.JsonProperty("DefinedTypes", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection DefinedTypes { get; set; } + + [Newtonsoft.Json.JsonProperty("Evidence", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Evidence { get; set; } + + [Newtonsoft.Json.JsonProperty("PermissionSet", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection PermissionSet { get; set; } + + [Newtonsoft.Json.JsonProperty("IsFullyTrusted", Required = Newtonsoft.Json.Required.Always)] + public bool IsFullyTrusted { get; set; } + + [Newtonsoft.Json.JsonProperty("SecurityRuleSet", Required = Newtonsoft.Json.Required.Always)] + public SecurityRuleSet SecurityRuleSet { get; set; } + + [Newtonsoft.Json.JsonProperty("ManifestModule", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Module ManifestModule { get; set; } + + [Newtonsoft.Json.JsonProperty("CustomAttributes", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection CustomAttributes { get; set; } + + [Newtonsoft.Json.JsonProperty("ReflectionOnly", Required = Newtonsoft.Json.Required.Always)] + public bool ReflectionOnly { get; set; } + + [Newtonsoft.Json.JsonProperty("Modules", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Modules { get; set; } + + [Newtonsoft.Json.JsonProperty("Location", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Location { get; set; } + + [Newtonsoft.Json.JsonProperty("ImageRuntimeVersion", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ImageRuntimeVersion { get; set; } + + [Newtonsoft.Json.JsonProperty("GlobalAssemblyCache", Required = Newtonsoft.Json.Required.Always)] + public bool GlobalAssemblyCache { get; set; } + + [Newtonsoft.Json.JsonProperty("HostContext", Required = Newtonsoft.Json.Required.Always)] + public long HostContext { get; set; } + + [Newtonsoft.Json.JsonProperty("IsDynamic", Required = Newtonsoft.Json.Required.Always)] + public bool IsDynamic { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum SecurityRuleSet + { + None = 0, + + Level1 = 1, + + Level2 = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class ModuleHandle + { + [Newtonsoft.Json.JsonProperty("MDStreamVersion", Required = Newtonsoft.Json.Required.Always)] + public int MDStreamVersion { get; set; } + + + } + + /// Provides information about the available action filters. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class FilterInfo + { + /// Gets or sets an instance of the FilterInfo. + [Newtonsoft.Json.JsonProperty("Instance", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public IFilter Instance { get; set; } + + /// Gets or sets the scope FilterInfo. + [Newtonsoft.Json.JsonProperty("Scope", Required = Newtonsoft.Json.Required.Always)] + public FilterScope Scope { get; set; } + + + } + + /// Defines the methods that are used in a filter. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class IFilter + { + /// Gets or sets a value indicating whether more than one instance of the indicated attribute can be specified for a single program element. + [Newtonsoft.Json.JsonProperty("AllowMultiple", Required = Newtonsoft.Json.Required.Always)] + public bool AllowMultiple { get; set; } + + + } + + /// Defines values that specify the order in which filters run within the same filter type and filter order. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum FilterScope + { + Global = 0, + + Controller = 10, + + Action = 20, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class DelegatingHandler : HttpMessageHandler + { + [Newtonsoft.Json.JsonProperty("InnerHandler", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public HttpMessageHandler InnerHandler { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class HttpMessageHandler + { + + } + + /// IHttpRoute defines the interface for a route expressing how to map an incoming HttpRequestMessage to a particular controller and action. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class IHttpRoute + { + /// Gets the route template describing the URI pattern to match against. + [Newtonsoft.Json.JsonProperty("RouteTemplate", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string RouteTemplate { get; set; } + + /// Gets the default values for route parameters if not provided by the incoming HttpRequestMessage. + [Newtonsoft.Json.JsonProperty("Defaults", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary Defaults { get; set; } + + /// Gets the constraints for the route parameters. + [Newtonsoft.Json.JsonProperty("Constraints", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary Constraints { get; set; } + + /// Gets any additional data tokens not used directly to determine whether a route matches an incoming HttpRequestMessage. + [Newtonsoft.Json.JsonProperty("DataTokens", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary DataTokens { get; set; } + + /// Gets the message handler that will be the recipient of the request. + [Newtonsoft.Json.JsonProperty("Handler", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public HttpMessageHandler Handler { get; set; } + + + } + + /// Represents a dependency injection container. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class IDependencyResolver + { + + } + + /// An abstract class that provides a container for services used by ASP.NET Web API. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class ServicesContainer + { + + } + + /// Collection of functions that can produce a parameter binding for a given parameter. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class ParameterBindingRulesCollection : System.Collections.ObjectModel.Collection + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class FuncOfHttpParameterDescriptorAndHttpParameterBinding : MulticastDelegate + { + + } + + /// Specifies whether error details, such as exception messages and stack traces, should be included in error messages. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum IncludeErrorDetailPolicy + { + Default = 0, + + LocalOnly = 1, + + Always = 2, + + Never = 3, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class MediaTypeFormatterCollection : Anonymous + { + + } + + /// MediaTypeFormatter class to handle Xml. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class XmlMediaTypeFormatter : MediaTypeFormatter + { + /// Gets or sets a value indicating whether the XML formatter uses the XmlSerializer as the default serializer, instead of using the DataContractSerializer. + [Newtonsoft.Json.JsonProperty("UseXmlSerializer", Required = Newtonsoft.Json.Required.Always)] + public bool UseXmlSerializer { get; set; } = false; + + /// Gets or sets a value indicating whether to indent elements when writing data. + [Newtonsoft.Json.JsonProperty("Indent", Required = Newtonsoft.Json.Required.Always)] + public bool Indent { get; set; } + + /// Gets the settings to be used while writing. + [Newtonsoft.Json.JsonProperty("WriterSettings", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public XmlWriterSettings WriterSettings { get; set; } + + /// Gets and sets the maximum nested node depth. + [Newtonsoft.Json.JsonProperty("MaxDepth", Required = Newtonsoft.Json.Required.Always)] + public int MaxDepth { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class XmlWriterSettings + { + [Newtonsoft.Json.JsonProperty("Async", Required = Newtonsoft.Json.Required.Always)] + public bool Async { get; set; } + + [Newtonsoft.Json.JsonProperty("Encoding", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Encoding Encoding { get; set; } + + [Newtonsoft.Json.JsonProperty("OmitXmlDeclaration", Required = Newtonsoft.Json.Required.Always)] + public bool OmitXmlDeclaration { get; set; } + + [Newtonsoft.Json.JsonProperty("NewLineHandling", Required = Newtonsoft.Json.Required.Always)] + public NewLineHandling NewLineHandling { get; set; } + + [Newtonsoft.Json.JsonProperty("NewLineChars", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string NewLineChars { get; set; } + + [Newtonsoft.Json.JsonProperty("Indent", Required = Newtonsoft.Json.Required.Always)] + public bool Indent { get; set; } + + [Newtonsoft.Json.JsonProperty("IndentChars", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string IndentChars { get; set; } + + [Newtonsoft.Json.JsonProperty("NewLineOnAttributes", Required = Newtonsoft.Json.Required.Always)] + public bool NewLineOnAttributes { get; set; } + + [Newtonsoft.Json.JsonProperty("CloseOutput", Required = Newtonsoft.Json.Required.Always)] + public bool CloseOutput { get; set; } + + [Newtonsoft.Json.JsonProperty("ConformanceLevel", Required = Newtonsoft.Json.Required.Always)] + public ConformanceLevel ConformanceLevel { get; set; } + + [Newtonsoft.Json.JsonProperty("CheckCharacters", Required = Newtonsoft.Json.Required.Always)] + public bool CheckCharacters { get; set; } + + [Newtonsoft.Json.JsonProperty("NamespaceHandling", Required = Newtonsoft.Json.Required.Always)] + public NamespaceHandling NamespaceHandling { get; set; } + + [Newtonsoft.Json.JsonProperty("WriteEndDocumentOnClose", Required = Newtonsoft.Json.Required.Always)] + public bool WriteEndDocumentOnClose { get; set; } + + [Newtonsoft.Json.JsonProperty("OutputMethod", Required = Newtonsoft.Json.Required.Always)] + public XmlOutputMethod OutputMethod { get; set; } + + [Newtonsoft.Json.JsonProperty("DoNotEscapeUriAttributes", Required = Newtonsoft.Json.Required.Always)] + public bool DoNotEscapeUriAttributes { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class Encoding + { + [Newtonsoft.Json.JsonProperty("BodyName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string BodyName { get; set; } + + [Newtonsoft.Json.JsonProperty("EncodingName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string EncodingName { get; set; } + + [Newtonsoft.Json.JsonProperty("HeaderName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string HeaderName { get; set; } + + [Newtonsoft.Json.JsonProperty("WebName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string WebName { get; set; } + + [Newtonsoft.Json.JsonProperty("WindowsCodePage", Required = Newtonsoft.Json.Required.Always)] + public int WindowsCodePage { get; set; } + + [Newtonsoft.Json.JsonProperty("IsBrowserDisplay", Required = Newtonsoft.Json.Required.Always)] + public bool IsBrowserDisplay { get; set; } + + [Newtonsoft.Json.JsonProperty("IsBrowserSave", Required = Newtonsoft.Json.Required.Always)] + public bool IsBrowserSave { get; set; } + + [Newtonsoft.Json.JsonProperty("IsMailNewsDisplay", Required = Newtonsoft.Json.Required.Always)] + public bool IsMailNewsDisplay { get; set; } + + [Newtonsoft.Json.JsonProperty("IsMailNewsSave", Required = Newtonsoft.Json.Required.Always)] + public bool IsMailNewsSave { get; set; } + + [Newtonsoft.Json.JsonProperty("IsSingleByte", Required = Newtonsoft.Json.Required.Always)] + public bool IsSingleByte { get; set; } + + [Newtonsoft.Json.JsonProperty("EncoderFallback", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public EncoderFallback EncoderFallback { get; set; } + + [Newtonsoft.Json.JsonProperty("DecoderFallback", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public DecoderFallback DecoderFallback { get; set; } + + [Newtonsoft.Json.JsonProperty("IsReadOnly", Required = Newtonsoft.Json.Required.Always)] + public bool IsReadOnly { get; set; } + + [Newtonsoft.Json.JsonProperty("CodePage", Required = Newtonsoft.Json.Required.Always)] + public int CodePage { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class EncoderFallback + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class DecoderFallback + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum NewLineHandling + { + Replace = 0, + + Entitize = 1, + + None = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum ConformanceLevel + { + Auto = 0, + + Fragment = 1, + + Document = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + [System.Flags] + public enum NamespaceHandling + { + Default = 0, + + OmitDuplicates = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum XmlOutputMethod + { + Xml = 0, + + Html = 1, + + Text = 2, + + AutoDetect = 3, + + } + + /// Base class to handle serializing and deserializing strongly-typed objects using ObjectContent. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class MediaTypeFormatter + { + /// Gets the mutable collection of media types supported bythis MediaTypeFormatter. + [Newtonsoft.Json.JsonProperty("SupportedMediaTypes", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection SupportedMediaTypes { get; set; } + + /// Gets the mutable collection of character encodings supported bythis MediaTypeFormatter. + [Newtonsoft.Json.JsonProperty("SupportedEncodings", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection SupportedEncodings { get; set; } + + /// Gets the mutable collection of MediaTypeMapping objects that match HTTP requests to media types. + [Newtonsoft.Json.JsonProperty("MediaTypeMappings", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection MediaTypeMappings { get; set; } + + /// Gets or sets the IRequiredMemberSelector instance used to determine required members. + [Newtonsoft.Json.JsonProperty("RequiredMemberSelector", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public IRequiredMemberSelector RequiredMemberSelector { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class MediaTypeHeaderValue + { + [Newtonsoft.Json.JsonProperty("CharSet", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string CharSet { get; set; } + + [Newtonsoft.Json.JsonProperty("Parameters", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Parameters { get; set; } + + [Newtonsoft.Json.JsonProperty("MediaType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string MediaType { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class NameValueHeaderValue + { + [Newtonsoft.Json.JsonProperty("Name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } + + [Newtonsoft.Json.JsonProperty("Value", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Value { get; set; } + + + } + + /// An abstract base class used to create an association between HttpRequestMessage or HttpResponseMessage instances that have certain characteristics and a specific MediaTypeHeaderValue. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class MediaTypeMapping + { + /// Gets the MediaTypeHeaderValue that is associated with HttpRequestMessage or HttpResponseMessage instances that have the given characteristics of the MediaTypeMapping. + [Newtonsoft.Json.JsonProperty("MediaType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public MediaTypeHeaderValue MediaType { get; set; } + + + } + + /// Defines method that determines whether a given member is required on deserialization. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class IRequiredMemberSelector + { + + } + + /// Represents the MediaTypeFormatter class to handle JSON. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class JsonMediaTypeFormatter : BaseJsonMediaTypeFormatter + { + /// Gets or sets a value indicating whether to use DataContractJsonSerializer by default. + [Newtonsoft.Json.JsonProperty("UseDataContractJsonSerializer", Required = Newtonsoft.Json.Required.Always)] + public bool UseDataContractJsonSerializer { get; set; } + + /// Gets or sets a value indicating whether to indent elements when writing data. + [Newtonsoft.Json.JsonProperty("Indent", Required = Newtonsoft.Json.Required.Always)] + public bool Indent { get; set; } + + /// Gets or sets the maximum depth allowed by this formatter. + [Newtonsoft.Json.JsonProperty("MaxDepth", Required = Newtonsoft.Json.Required.Always)] + public int MaxDepth { get; set; } + + + } + + /// Abstract media type formatter class to support Bson and Json. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class BaseJsonMediaTypeFormatter : MediaTypeFormatter + { + /// Gets or sets the JsonSerializerSettings used to configure the JsonSerializer. + [Newtonsoft.Json.JsonProperty("SerializerSettings", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public JsonSerializerSettings SerializerSettings { get; set; } + + /// Gets or sets the maximum depth allowed by this formatter. + [Newtonsoft.Json.JsonProperty("MaxDepth", Required = Newtonsoft.Json.Required.Always)] + public int MaxDepth { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class JsonSerializerSettings + { + [Newtonsoft.Json.JsonProperty("ReferenceLoopHandling", Required = Newtonsoft.Json.Required.Always)] + public ReferenceLoopHandling ReferenceLoopHandling { get; set; } + + [Newtonsoft.Json.JsonProperty("MissingMemberHandling", Required = Newtonsoft.Json.Required.Always)] + public MissingMemberHandling MissingMemberHandling { get; set; } + + [Newtonsoft.Json.JsonProperty("ObjectCreationHandling", Required = Newtonsoft.Json.Required.Always)] + public ObjectCreationHandling ObjectCreationHandling { get; set; } + + [Newtonsoft.Json.JsonProperty("NullValueHandling", Required = Newtonsoft.Json.Required.Always)] + public NullValueHandling NullValueHandling { get; set; } + + [Newtonsoft.Json.JsonProperty("DefaultValueHandling", Required = Newtonsoft.Json.Required.Always)] + public DefaultValueHandling DefaultValueHandling { get; set; } + + [Newtonsoft.Json.JsonProperty("Converters", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Converters { get; set; } + + [Newtonsoft.Json.JsonProperty("PreserveReferencesHandling", Required = Newtonsoft.Json.Required.Always)] + public PreserveReferencesHandling PreserveReferencesHandling { get; set; } + + [Newtonsoft.Json.JsonProperty("TypeNameHandling", Required = Newtonsoft.Json.Required.Always)] + public TypeNameHandling TypeNameHandling { get; set; } + + [Newtonsoft.Json.JsonProperty("MetadataPropertyHandling", Required = Newtonsoft.Json.Required.Always)] + public MetadataPropertyHandling MetadataPropertyHandling { get; set; } + + [Newtonsoft.Json.JsonProperty("TypeNameAssemblyFormat", Required = Newtonsoft.Json.Required.Always)] + public FormatterAssemblyStyle TypeNameAssemblyFormat { get; set; } + + [Newtonsoft.Json.JsonProperty("TypeNameAssemblyFormatHandling", Required = Newtonsoft.Json.Required.Always)] + public TypeNameAssemblyFormatHandling TypeNameAssemblyFormatHandling { get; set; } + + [Newtonsoft.Json.JsonProperty("ConstructorHandling", Required = Newtonsoft.Json.Required.Always)] + public ConstructorHandling ConstructorHandling { get; set; } + + [Newtonsoft.Json.JsonProperty("ContractResolver", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public IContractResolver ContractResolver { get; set; } + + [Newtonsoft.Json.JsonProperty("EqualityComparer", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public IEqualityComparer EqualityComparer { get; set; } + + [Newtonsoft.Json.JsonProperty("ReferenceResolver", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public IReferenceResolver ReferenceResolver { get; set; } + + [Newtonsoft.Json.JsonProperty("ReferenceResolverProvider", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public FuncOfIReferenceResolver ReferenceResolverProvider { get; set; } + + [Newtonsoft.Json.JsonProperty("TraceWriter", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ITraceWriter TraceWriter { get; set; } + + [Newtonsoft.Json.JsonProperty("Binder", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public SerializationBinder Binder { get; set; } + + [Newtonsoft.Json.JsonProperty("SerializationBinder", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ISerializationBinder SerializationBinder { get; set; } + + [Newtonsoft.Json.JsonProperty("Error", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public EventHandlerOfErrorEventArgs Error { get; set; } + + [Newtonsoft.Json.JsonProperty("Context", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public StreamingContext Context { get; set; } = new StreamingContext(); + + [Newtonsoft.Json.JsonProperty("DateFormatString", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string DateFormatString { get; set; } + + [Newtonsoft.Json.JsonProperty("MaxDepth", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? MaxDepth { get; set; } + + [Newtonsoft.Json.JsonProperty("Formatting", Required = Newtonsoft.Json.Required.Always)] + public Formatting Formatting { get; set; } + + [Newtonsoft.Json.JsonProperty("DateFormatHandling", Required = Newtonsoft.Json.Required.Always)] + public DateFormatHandling DateFormatHandling { get; set; } + + [Newtonsoft.Json.JsonProperty("DateTimeZoneHandling", Required = Newtonsoft.Json.Required.Always)] + public DateTimeZoneHandling DateTimeZoneHandling { get; set; } + + [Newtonsoft.Json.JsonProperty("DateParseHandling", Required = Newtonsoft.Json.Required.Always)] + public DateParseHandling DateParseHandling { get; set; } + + [Newtonsoft.Json.JsonProperty("FloatFormatHandling", Required = Newtonsoft.Json.Required.Always)] + public FloatFormatHandling FloatFormatHandling { get; set; } + + [Newtonsoft.Json.JsonProperty("FloatParseHandling", Required = Newtonsoft.Json.Required.Always)] + public FloatParseHandling FloatParseHandling { get; set; } + + [Newtonsoft.Json.JsonProperty("StringEscapeHandling", Required = Newtonsoft.Json.Required.Always)] + public StringEscapeHandling StringEscapeHandling { get; set; } + + [Newtonsoft.Json.JsonProperty("Culture", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Culture { get; set; } + + [Newtonsoft.Json.JsonProperty("CheckAdditionalContent", Required = Newtonsoft.Json.Required.Always)] + public bool CheckAdditionalContent { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum ReferenceLoopHandling + { + Error = 0, + + Ignore = 1, + + Serialize = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum MissingMemberHandling + { + Ignore = 0, + + Error = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum ObjectCreationHandling + { + Auto = 0, + + Reuse = 1, + + Replace = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum NullValueHandling + { + Include = 0, + + Ignore = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + [System.Flags] + public enum DefaultValueHandling + { + Include = 0, + + Ignore = 1, + + Populate = 2, + + IgnoreAndPopulate = 3, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class JsonConverter + { + [Newtonsoft.Json.JsonProperty("CanRead", Required = Newtonsoft.Json.Required.Always)] + public bool CanRead { get; set; } + + [Newtonsoft.Json.JsonProperty("CanWrite", Required = Newtonsoft.Json.Required.Always)] + public bool CanWrite { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + [System.Flags] + public enum PreserveReferencesHandling + { + None = 0, + + Objects = 1, + + Arrays = 2, + + All = 3, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + [System.Flags] + public enum TypeNameHandling + { + None = 0, + + Objects = 1, + + Arrays = 2, + + All = 3, + + Auto = 4, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum MetadataPropertyHandling + { + Default = 0, + + ReadAhead = 1, + + Ignore = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum FormatterAssemblyStyle + { + Simple = 0, + + Full = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum TypeNameAssemblyFormatHandling + { + Simple = 0, + + Full = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum ConstructorHandling + { + Default = 0, + + AllowNonPublicDefaultConstructor = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class IContractResolver + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class IEqualityComparer + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class IReferenceResolver + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class FuncOfIReferenceResolver : MulticastDelegate + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class ITraceWriter + { + [Newtonsoft.Json.JsonProperty("LevelFilter", Required = Newtonsoft.Json.Required.Always)] + public TraceLevel LevelFilter { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum TraceLevel + { + Off = 0, + + Error = 1, + + Warning = 2, + + Info = 3, + + Verbose = 4, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class SerializationBinder + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class ISerializationBinder + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class EventHandlerOfErrorEventArgs : MulticastDelegate + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class StreamingContext + { + [Newtonsoft.Json.JsonProperty("Context", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public object Context { get; set; } + + [Newtonsoft.Json.JsonProperty("State", Required = Newtonsoft.Json.Required.Always)] + public StreamingContextStates State { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + [System.Flags] + public enum StreamingContextStates + { + CrossProcess = 1, + + CrossMachine = 2, + + File = 4, + + Persistence = 8, + + Remoting = 16, + + Other = 32, + + Clone = 64, + + CrossAppDomain = 128, + + All = 255, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum Formatting + { + None = 0, + + Indented = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum DateFormatHandling + { + IsoDateFormat = 0, + + MicrosoftDateFormat = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum DateTimeZoneHandling + { + Local = 0, + + Utc = 1, + + Unspecified = 2, + + RoundtripKind = 3, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum DateParseHandling + { + None = 0, + + DateTime = 1, + + DateTimeOffset = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum FloatFormatHandling + { + String = 0, + + Symbol = 1, + + DefaultValue = 2, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum FloatParseHandling + { + Double = 0, + + Decimal = 1, + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public enum StringEscapeHandling + { + Default = 0, + + EscapeNonAscii = 1, + + EscapeHtml = 2, + + } + + /// MediaTypeFormatter class for handling HTML form URL-ended data, also known as application/x-www-form-urlencoded. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class FormUrlEncodedMediaTypeFormatter : MediaTypeFormatter + { + /// Gets or sets the maximum depth allowed by this formatter. + [Newtonsoft.Json.JsonProperty("MaxDepth", Required = Newtonsoft.Json.Required.Always)] + public int MaxDepth { get; set; } + + /// Gets or sets the size of the buffer when reading the incoming stream. + [Newtonsoft.Json.JsonProperty("ReadBufferSize", Required = Newtonsoft.Json.Required.Always)] + public int ReadBufferSize { get; set; } + + + } + + /// Represents information that describes the HTTP controller. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class HttpControllerDescriptor + { + /// Gets the properties associated with this instance. + [Newtonsoft.Json.JsonProperty("Properties", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary Properties { get; set; } + + /// Gets or sets the configurations associated with the controller. + [Newtonsoft.Json.JsonProperty("Configuration", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public HttpConfiguration Configuration { get; set; } + + /// Gets or sets the name of the controller. + [Newtonsoft.Json.JsonProperty("ControllerName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ControllerName { get; set; } + + /// Gets or sets the type of the controller. + [Newtonsoft.Json.JsonProperty("ControllerType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ControllerType { get; set; } + + + } + + /// Represents an HTTP controller. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class IHttpController + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class HttpRequestMessage + { + [Newtonsoft.Json.JsonProperty("Version", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Version Version { get; set; } + + [Newtonsoft.Json.JsonProperty("Content", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public HttpContent Content { get; set; } + + [Newtonsoft.Json.JsonProperty("Method", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public HttpMethod Method { get; set; } + + [Newtonsoft.Json.JsonProperty("RequestUri", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Uri RequestUri { get; set; } + + [Newtonsoft.Json.JsonProperty("Headers", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public HttpRequestHeaders Headers { get; set; } + + [Newtonsoft.Json.JsonProperty("Properties", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary Properties { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class Version + { + [Newtonsoft.Json.JsonProperty("Major", Required = Newtonsoft.Json.Required.Always)] + public int Major { get; set; } + + [Newtonsoft.Json.JsonProperty("Minor", Required = Newtonsoft.Json.Required.Always)] + public int Minor { get; set; } + + [Newtonsoft.Json.JsonProperty("Build", Required = Newtonsoft.Json.Required.Always)] + public int Build { get; set; } + + [Newtonsoft.Json.JsonProperty("Revision", Required = Newtonsoft.Json.Required.Always)] + public int Revision { get; set; } + + [Newtonsoft.Json.JsonProperty("MajorRevision", Required = Newtonsoft.Json.Required.Always)] + public int MajorRevision { get; set; } + + [Newtonsoft.Json.JsonProperty("MinorRevision", Required = Newtonsoft.Json.Required.Always)] + public int MinorRevision { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class HttpContent + { + [Newtonsoft.Json.JsonProperty("Headers", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public HttpContentHeaders Headers { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class HttpContentHeaders : Anonymous2 + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class ContentDispositionHeaderValue + { + [Newtonsoft.Json.JsonProperty("DispositionType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string DispositionType { get; set; } + + [Newtonsoft.Json.JsonProperty("Parameters", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Parameters { get; set; } + + [Newtonsoft.Json.JsonProperty("Name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } + + [Newtonsoft.Json.JsonProperty("FileName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string FileName { get; set; } + + [Newtonsoft.Json.JsonProperty("FileNameStar", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string FileNameStar { get; set; } + + [Newtonsoft.Json.JsonProperty("CreationDate", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.DateTimeOffset? CreationDate { get; set; } + + [Newtonsoft.Json.JsonProperty("ModificationDate", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.DateTimeOffset? ModificationDate { get; set; } + + [Newtonsoft.Json.JsonProperty("ReadDate", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.DateTimeOffset? ReadDate { get; set; } + + [Newtonsoft.Json.JsonProperty("Size", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long? Size { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class ContentRangeHeaderValue + { + [Newtonsoft.Json.JsonProperty("Unit", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Unit { get; set; } + + [Newtonsoft.Json.JsonProperty("From", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long? From { get; set; } + + [Newtonsoft.Json.JsonProperty("To", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long? To { get; set; } + + [Newtonsoft.Json.JsonProperty("Length", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long? Length { get; set; } + + [Newtonsoft.Json.JsonProperty("HasLength", Required = Newtonsoft.Json.Required.Always)] + public bool HasLength { get; set; } + + [Newtonsoft.Json.JsonProperty("HasRange", Required = Newtonsoft.Json.Required.Always)] + public bool HasRange { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class KeyValuePairOfStringAndIEnumerableOfString + { + [Newtonsoft.Json.JsonProperty("Key", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Key { get; set; } + + [Newtonsoft.Json.JsonProperty("Value", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Value { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class HttpMethod + { + [Newtonsoft.Json.JsonProperty("Method", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Method { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class HttpRequestHeaders : Anonymous3 + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class MediaTypeWithQualityHeaderValue : MediaTypeHeaderValue + { + [Newtonsoft.Json.JsonProperty("Quality", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Quality { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class StringWithQualityHeaderValue + { + [Newtonsoft.Json.JsonProperty("Value", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Value { get; set; } + + [Newtonsoft.Json.JsonProperty("Quality", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Quality { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class AuthenticationHeaderValue + { + [Newtonsoft.Json.JsonProperty("Scheme", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Scheme { get; set; } + + [Newtonsoft.Json.JsonProperty("Parameter", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Parameter { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class NameValueWithParametersHeaderValue : NameValueHeaderValue + { + [Newtonsoft.Json.JsonProperty("Parameters", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Parameters { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class EntityTagHeaderValue + { + [Newtonsoft.Json.JsonProperty("Tag", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Tag { get; set; } + + [Newtonsoft.Json.JsonProperty("IsWeak", Required = Newtonsoft.Json.Required.Always)] + public bool IsWeak { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class RangeConditionHeaderValue + { + [Newtonsoft.Json.JsonProperty("Date", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.DateTimeOffset? Date { get; set; } + + [Newtonsoft.Json.JsonProperty("EntityTag", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public EntityTagHeaderValue EntityTag { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class RangeHeaderValue + { + [Newtonsoft.Json.JsonProperty("Unit", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Unit { get; set; } + + [Newtonsoft.Json.JsonProperty("Ranges", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Ranges { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class RangeItemHeaderValue + { + [Newtonsoft.Json.JsonProperty("From", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long? From { get; set; } + + [Newtonsoft.Json.JsonProperty("To", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long? To { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class TransferCodingWithQualityHeaderValue : TransferCodingHeaderValue + { + [Newtonsoft.Json.JsonProperty("Quality", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Quality { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class TransferCodingHeaderValue + { + [Newtonsoft.Json.JsonProperty("Value", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Value { get; set; } + + [Newtonsoft.Json.JsonProperty("Parameters", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Parameters { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class ProductInfoHeaderValue + { + [Newtonsoft.Json.JsonProperty("Product", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ProductHeaderValue Product { get; set; } + + [Newtonsoft.Json.JsonProperty("Comment", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Comment { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class ProductHeaderValue + { + [Newtonsoft.Json.JsonProperty("Name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } + + [Newtonsoft.Json.JsonProperty("Version", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Version { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class CacheControlHeaderValue + { + [Newtonsoft.Json.JsonProperty("NoCache", Required = Newtonsoft.Json.Required.Always)] + public bool NoCache { get; set; } + + [Newtonsoft.Json.JsonProperty("NoCacheHeaders", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection NoCacheHeaders { get; set; } + + [Newtonsoft.Json.JsonProperty("NoStore", Required = Newtonsoft.Json.Required.Always)] + public bool NoStore { get; set; } + + [Newtonsoft.Json.JsonProperty("MaxAge", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.TimeSpan? MaxAge { get; set; } + + [Newtonsoft.Json.JsonProperty("SharedMaxAge", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.TimeSpan? SharedMaxAge { get; set; } + + [Newtonsoft.Json.JsonProperty("MaxStale", Required = Newtonsoft.Json.Required.Always)] + public bool MaxStale { get; set; } + + [Newtonsoft.Json.JsonProperty("MaxStaleLimit", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.TimeSpan? MaxStaleLimit { get; set; } + + [Newtonsoft.Json.JsonProperty("MinFresh", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.TimeSpan? MinFresh { get; set; } + + [Newtonsoft.Json.JsonProperty("NoTransform", Required = Newtonsoft.Json.Required.Always)] + public bool NoTransform { get; set; } + + [Newtonsoft.Json.JsonProperty("OnlyIfCached", Required = Newtonsoft.Json.Required.Always)] + public bool OnlyIfCached { get; set; } + + [Newtonsoft.Json.JsonProperty("Public", Required = Newtonsoft.Json.Required.Always)] + public bool Public { get; set; } + + [Newtonsoft.Json.JsonProperty("Private", Required = Newtonsoft.Json.Required.Always)] + public bool Private { get; set; } + + [Newtonsoft.Json.JsonProperty("PrivateHeaders", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection PrivateHeaders { get; set; } + + [Newtonsoft.Json.JsonProperty("MustRevalidate", Required = Newtonsoft.Json.Required.Always)] + public bool MustRevalidate { get; set; } + + [Newtonsoft.Json.JsonProperty("ProxyRevalidate", Required = Newtonsoft.Json.Required.Always)] + public bool ProxyRevalidate { get; set; } + + [Newtonsoft.Json.JsonProperty("Extensions", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Extensions { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class ViaHeaderValue + { + [Newtonsoft.Json.JsonProperty("ProtocolName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ProtocolName { get; set; } + + [Newtonsoft.Json.JsonProperty("ProtocolVersion", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ProtocolVersion { get; set; } + + [Newtonsoft.Json.JsonProperty("ReceivedBy", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ReceivedBy { get; set; } + + [Newtonsoft.Json.JsonProperty("Comment", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Comment { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class WarningHeaderValue + { + [Newtonsoft.Json.JsonProperty("Code", Required = Newtonsoft.Json.Required.Always)] + public int Code { get; set; } + + [Newtonsoft.Json.JsonProperty("Agent", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Agent { get; set; } + + [Newtonsoft.Json.JsonProperty("Text", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Text { get; set; } + + [Newtonsoft.Json.JsonProperty("Date", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.DateTimeOffset? Date { get; set; } + + + } + + /// Represents the context associated with a request. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class HttpRequestContext + { + /// Gets or sets the client certificate. + [Newtonsoft.Json.JsonProperty("ClientCertificate", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public X509Certificate2 ClientCertificate { get; set; } + + /// Gets or sets the configuration. + [Newtonsoft.Json.JsonProperty("Configuration", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public HttpConfiguration Configuration { get; set; } + + /// Gets or sets a value indicating whether error details, such as exception messages and stack traces, should be included in the response for this request. + [Newtonsoft.Json.JsonProperty("IncludeErrorDetail", Required = Newtonsoft.Json.Required.Always)] + public bool IncludeErrorDetail { get; set; } + + /// Gets or sets a value indicating whether the request originates from a local address. + [Newtonsoft.Json.JsonProperty("IsLocal", Required = Newtonsoft.Json.Required.Always)] + public bool IsLocal { get; set; } + + /// .Gets or sets the principal + [Newtonsoft.Json.JsonProperty("Principal", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public IPrincipal Principal { get; set; } + + /// Gets or sets the route data. + [Newtonsoft.Json.JsonProperty("RouteData", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public IHttpRouteData RouteData { get; set; } + + /// Gets or sets the factory used to generate URLs to other APIs. + [Newtonsoft.Json.JsonProperty("Url", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public UrlHelper Url { get; set; } + + /// Gets or sets the virtual path root. + [Newtonsoft.Json.JsonProperty("VirtualPathRoot", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string VirtualPathRoot { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class X509Certificate2 : X509Certificate + { + [Newtonsoft.Json.JsonProperty("Archived", Required = Newtonsoft.Json.Required.Always)] + public bool Archived { get; set; } + + [Newtonsoft.Json.JsonProperty("Extensions", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Extensions { get; set; } + + [Newtonsoft.Json.JsonProperty("FriendlyName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string FriendlyName { get; set; } + + [Newtonsoft.Json.JsonProperty("IssuerName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public X500DistinguishedName IssuerName { get; set; } + + [Newtonsoft.Json.JsonProperty("NotAfter", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset NotAfter { get; set; } + + [Newtonsoft.Json.JsonProperty("NotBefore", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] + public System.DateTimeOffset NotBefore { get; set; } + + [Newtonsoft.Json.JsonProperty("HasPrivateKey", Required = Newtonsoft.Json.Required.Always)] + public bool HasPrivateKey { get; set; } + + [Newtonsoft.Json.JsonProperty("PrivateKey", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public AsymmetricAlgorithm PrivateKey { get; set; } + + [Newtonsoft.Json.JsonProperty("PublicKey", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public PublicKey PublicKey { get; set; } + + [Newtonsoft.Json.JsonProperty("RawData", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public byte[] RawData { get; set; } + + [Newtonsoft.Json.JsonProperty("SerialNumber", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string SerialNumber { get; set; } + + [Newtonsoft.Json.JsonProperty("SubjectName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public X500DistinguishedName SubjectName { get; set; } + + [Newtonsoft.Json.JsonProperty("SignatureAlgorithm", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Oid SignatureAlgorithm { get; set; } + + [Newtonsoft.Json.JsonProperty("Thumbprint", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Thumbprint { get; set; } + + [Newtonsoft.Json.JsonProperty("Version", Required = Newtonsoft.Json.Required.Always)] + public int Version { get; set; } + + [Newtonsoft.Json.JsonProperty("CertContext", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public SafeCertContextHandle CertContext { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class X500DistinguishedName : AsnEncodedData + { + [Newtonsoft.Json.JsonProperty("Name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class AsnEncodedData + { + [Newtonsoft.Json.JsonProperty("Oid", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Oid Oid { get; set; } + + [Newtonsoft.Json.JsonProperty("RawData", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public byte[] RawData { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class Oid + { + [Newtonsoft.Json.JsonProperty("Value", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Value { get; set; } + + [Newtonsoft.Json.JsonProperty("FriendlyName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string FriendlyName { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class AsymmetricAlgorithm + { + [Newtonsoft.Json.JsonProperty("KeySize", Required = Newtonsoft.Json.Required.Always)] + public int KeySize { get; set; } + + [Newtonsoft.Json.JsonProperty("LegalKeySizes", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection LegalKeySizes { get; set; } + + [Newtonsoft.Json.JsonProperty("SignatureAlgorithm", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string SignatureAlgorithm { get; set; } + + [Newtonsoft.Json.JsonProperty("KeyExchangeAlgorithm", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string KeyExchangeAlgorithm { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class KeySizes + { + [Newtonsoft.Json.JsonProperty("MinSize", Required = Newtonsoft.Json.Required.Always)] + public int MinSize { get; set; } + + [Newtonsoft.Json.JsonProperty("MaxSize", Required = Newtonsoft.Json.Required.Always)] + public int MaxSize { get; set; } + + [Newtonsoft.Json.JsonProperty("SkipSize", Required = Newtonsoft.Json.Required.Always)] + public int SkipSize { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class PublicKey + { + [Newtonsoft.Json.JsonProperty("Key", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public AsymmetricAlgorithm Key { get; set; } + + [Newtonsoft.Json.JsonProperty("Oid", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Oid Oid { get; set; } + + [Newtonsoft.Json.JsonProperty("EncodedKeyValue", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public AsnEncodedData EncodedKeyValue { get; set; } + + [Newtonsoft.Json.JsonProperty("EncodedParameters", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public AsnEncodedData EncodedParameters { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class SafeCertContextHandle : SafeHandleZeroOrMinusOneIsInvalid + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class SafeHandleZeroOrMinusOneIsInvalid : SafeHandle + { + [Newtonsoft.Json.JsonProperty("IsInvalid", Required = Newtonsoft.Json.Required.Always)] + public bool IsInvalid { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class SafeHandle : CriticalFinalizerObject + { + [Newtonsoft.Json.JsonProperty("IsClosed", Required = Newtonsoft.Json.Required.Always)] + public bool IsClosed { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class CriticalFinalizerObject + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class X509Certificate + { + [Newtonsoft.Json.JsonProperty("Handle", Required = Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DataAnnotations.Required] + public IntPtr Handle { get; set; } = new IntPtr(); + + [Newtonsoft.Json.JsonProperty("Issuer", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Issuer { get; set; } + + [Newtonsoft.Json.JsonProperty("Subject", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Subject { get; set; } + + [Newtonsoft.Json.JsonProperty("CertContext", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public SafeCertContextHandle2 CertContext { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class SafeCertContextHandle2 : SafeHandleZeroOrMinusOneIsInvalid + { + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class IPrincipal + { + [Newtonsoft.Json.JsonProperty("Identity", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public IIdentity Identity { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class IIdentity + { + [Newtonsoft.Json.JsonProperty("Name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Name { get; set; } + + [Newtonsoft.Json.JsonProperty("AuthenticationType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string AuthenticationType { get; set; } + + [Newtonsoft.Json.JsonProperty("IsAuthenticated", Required = Newtonsoft.Json.Required.Always)] + public bool IsAuthenticated { get; set; } + + + } + + /// Provides information about a route. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public abstract partial class IHttpRouteData + { + /// Gets the object that represents the route. + [Newtonsoft.Json.JsonProperty("Route", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public IHttpRoute Route { get; set; } + + /// Gets a collection of URL parameter values and default values for the route. + [Newtonsoft.Json.JsonProperty("Values", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.IDictionary Values { get; set; } + + + } + + /// Represents a factory for creating URLs. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class UrlHelper + { + /// Gets or sets the HttpRequestMessage of the current UrlHelper instance. + [Newtonsoft.Json.JsonProperty("Request", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public HttpRequestMessage Request { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class Evidence + { + private System.Collections.Generic.IDictionary _additionalProperties = new System.Collections.Generic.Dictionary(); + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties; } + set { _additionalProperties = value; } + } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class PermissionSet + { + private System.Collections.Generic.IDictionary _additionalProperties = new System.Collections.Generic.Dictionary(); + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties; } + set { _additionalProperties = value; } + } + + + } + + /// Collection class that contains MediaTypeFormatter instances. + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class Anonymous + { + /// Gets the MediaTypeFormatter to use for XML. + [Newtonsoft.Json.JsonProperty("XmlFormatter", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public XmlMediaTypeFormatter XmlFormatter { get; set; } + + /// Gets the MediaTypeFormatter to use for JSON. + [Newtonsoft.Json.JsonProperty("JsonFormatter", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public JsonMediaTypeFormatter JsonFormatter { get; set; } + + /// Gets the MediaTypeFormatter to use for application/x-www-form-urlencoded data. + [Newtonsoft.Json.JsonProperty("FormUrlEncodedFormatter", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public FormUrlEncodedMediaTypeFormatter FormUrlEncodedFormatter { get; set; } + + [Newtonsoft.Json.JsonProperty("WritingFormatters", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection WritingFormatters { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class Anonymous2 + { + [Newtonsoft.Json.JsonProperty("Allow", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Allow { get; set; } + + [Newtonsoft.Json.JsonProperty("ContentDisposition", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ContentDispositionHeaderValue ContentDisposition { get; set; } + + [Newtonsoft.Json.JsonProperty("ContentEncoding", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection ContentEncoding { get; set; } + + [Newtonsoft.Json.JsonProperty("ContentLanguage", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection ContentLanguage { get; set; } + + [Newtonsoft.Json.JsonProperty("ContentLength", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public long? ContentLength { get; set; } + + [Newtonsoft.Json.JsonProperty("ContentLocation", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Uri ContentLocation { get; set; } + + [Newtonsoft.Json.JsonProperty("ContentMD5", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public byte[] ContentMD5 { get; set; } + + [Newtonsoft.Json.JsonProperty("ContentRange", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public ContentRangeHeaderValue ContentRange { get; set; } + + [Newtonsoft.Json.JsonProperty("ContentType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public MediaTypeHeaderValue ContentType { get; set; } + + [Newtonsoft.Json.JsonProperty("Expires", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.DateTimeOffset? Expires { get; set; } + + [Newtonsoft.Json.JsonProperty("LastModified", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.DateTimeOffset? LastModified { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class Anonymous3 + { + [Newtonsoft.Json.JsonProperty("Accept", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Accept { get; set; } + + [Newtonsoft.Json.JsonProperty("AcceptCharset", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection AcceptCharset { get; set; } + + [Newtonsoft.Json.JsonProperty("AcceptEncoding", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection AcceptEncoding { get; set; } + + [Newtonsoft.Json.JsonProperty("AcceptLanguage", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection AcceptLanguage { get; set; } + + [Newtonsoft.Json.JsonProperty("Authorization", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public AuthenticationHeaderValue Authorization { get; set; } + + [Newtonsoft.Json.JsonProperty("Expect", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Expect { get; set; } + + [Newtonsoft.Json.JsonProperty("ExpectContinue", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool? ExpectContinue { get; set; } + + [Newtonsoft.Json.JsonProperty("From", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string From { get; set; } + + [Newtonsoft.Json.JsonProperty("Host", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Host { get; set; } + + [Newtonsoft.Json.JsonProperty("IfMatch", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection IfMatch { get; set; } + + [Newtonsoft.Json.JsonProperty("IfModifiedSince", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.DateTimeOffset? IfModifiedSince { get; set; } + + [Newtonsoft.Json.JsonProperty("IfNoneMatch", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection IfNoneMatch { get; set; } + + [Newtonsoft.Json.JsonProperty("IfRange", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public RangeConditionHeaderValue IfRange { get; set; } + + [Newtonsoft.Json.JsonProperty("IfUnmodifiedSince", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.DateTimeOffset? IfUnmodifiedSince { get; set; } + + [Newtonsoft.Json.JsonProperty("MaxForwards", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public int? MaxForwards { get; set; } + + [Newtonsoft.Json.JsonProperty("ProxyAuthorization", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public AuthenticationHeaderValue ProxyAuthorization { get; set; } + + [Newtonsoft.Json.JsonProperty("Range", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public RangeHeaderValue Range { get; set; } + + [Newtonsoft.Json.JsonProperty("Referrer", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Uri Referrer { get; set; } + + [Newtonsoft.Json.JsonProperty("TE", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection TE { get; set; } + + [Newtonsoft.Json.JsonProperty("UserAgent", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection UserAgent { get; set; } + + [Newtonsoft.Json.JsonProperty("CacheControl", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public CacheControlHeaderValue CacheControl { get; set; } + + [Newtonsoft.Json.JsonProperty("Connection", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Connection { get; set; } + + [Newtonsoft.Json.JsonProperty("ConnectionClose", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool? ConnectionClose { get; set; } + + [Newtonsoft.Json.JsonProperty("Date", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.DateTimeOffset? Date { get; set; } + + [Newtonsoft.Json.JsonProperty("Pragma", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Pragma { get; set; } + + [Newtonsoft.Json.JsonProperty("Trailer", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Trailer { get; set; } + + [Newtonsoft.Json.JsonProperty("TransferEncoding", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection TransferEncoding { get; set; } + + [Newtonsoft.Json.JsonProperty("TransferEncodingChunked", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool? TransferEncodingChunked { get; set; } + + [Newtonsoft.Json.JsonProperty("Upgrade", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Upgrade { get; set; } + + [Newtonsoft.Json.JsonProperty("Via", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Via { get; set; } + + [Newtonsoft.Json.JsonProperty("Warning", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Collections.Generic.ICollection Warning { get; set; } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.5.0 (Newtonsoft.Json v11.0.0.0)")] + public partial class Extensions + { + private System.Collections.Generic.IDictionary _additionalProperties = new System.Collections.Generic.Dictionary(); + + [Newtonsoft.Json.JsonExtensionData] + public System.Collections.Generic.IDictionary AdditionalProperties + { + get { return _additionalProperties; } + set { _additionalProperties = value; } + } + + + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.2.3.0 (NJsonSchema v10.1.5.0 (Newtonsoft.Json v11.0.0.0))")] + public partial class FileResponse : System.IDisposable + { + private System.IDisposable _client; + private System.IDisposable _response; + + public int StatusCode { get; private set; } + + public System.Collections.Generic.IReadOnlyDictionary> Headers { get; private set; } + + public System.IO.Stream Stream { get; private set; } + + public bool IsPartial + { + get { return StatusCode == 206; } + } + + public FileResponse(int statusCode, System.Collections.Generic.IReadOnlyDictionary> headers, System.IO.Stream stream, System.IDisposable client, System.IDisposable response) + { + StatusCode = statusCode; + Headers = headers; + Stream = stream; + _client = client; + _response = response; + } + + public void Dispose() + { + if (Stream != null) + Stream.Dispose(); + if (_response != null) + _response.Dispose(); + if (_client != null) + _client.Dispose(); + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.2.3.0 (NJsonSchema v10.1.5.0 (Newtonsoft.Json v11.0.0.0))")] + public partial class ApiException : System.Exception + { + public int StatusCode { get; private set; } + + public string Response { get; private set; } + + public System.Collections.Generic.IReadOnlyDictionary> Headers { get; private set; } + + public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Exception innerException) + : base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + response.Substring(0, response.Length >= 512 ? 512 : response.Length), innerException) + { + StatusCode = statusCode; + Response = response; + Headers = headers; + } + + public override string ToString() + { + return string.Format("HTTP Response: \n\n{0}\n\n{1}", Response, base.ToString()); + } + } + + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.2.3.0 (NJsonSchema v10.1.5.0 (Newtonsoft.Json v11.0.0.0))")] + public partial class ApiException : ApiException + { + public TResult Result { get; private set; } + + public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, TResult result, System.Exception innerException) + : base(message, statusCode, response, headers, innerException) + { + Result = result; + } + } + +} + +#pragma warning restore 1591 +#pragma warning restore 1573 +#pragma warning restore 472 +#pragma warning restore 114 +#pragma warning restore 108 \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Gateway/IGatewayService.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Gateway/IGatewayService.cs new file mode 100644 index 000000000..2149a0264 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Gateway/IGatewayService.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.MachineService.Gateway; + +namespace Tango.FSE.Common.Gateway +{ + public interface IGatewayService + { + ReadOnlyObservableCollection Environments { get; } + + Task> GetEnvironments(); + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/IFSEModule.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/IFSEModule.cs new file mode 100644 index 000000000..81daf08b1 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/IFSEModule.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; +using Tango.BL.Enumerations; + +namespace Tango.FSE.Common +{ + public interface IFSEModule + { + /// + /// Gets the module name. + /// + String Name { get; } + + /// + /// Gets the module description. + /// + String Description { get; } + + /// + /// Gets the module cover image. + /// + BitmapSource Image { get; } + + /// + /// Gets the module entry point view type. + /// + Type MainViewType { get; } + + /// + /// Gets the permission required to see and load this module. + /// + Permissions Permission { get; } + + /// + /// Gets a value indicating whether this module should be displayed in the application menu. + /// + bool IsVisibleInMenu { get; } + + /// + /// Gets a value indicating whether to dock this module menu item to the bottom. + /// + bool DockToBottom { get; } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/IFSEView.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/IFSEView.cs new file mode 100644 index 000000000..4ed47380f --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/IFSEView.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.FSE.Common +{ + /// + /// Represents a PPC view. + /// + public interface IFSEView + { + + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Modules/IFSEModuleLoader.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Modules/IFSEModuleLoader.cs new file mode 100644 index 000000000..a8c2ef401 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Modules/IFSEModuleLoader.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.FSE.Common; + +namespace Tango.FSE.Common.Modules +{ + /// + /// Represents a PPC modules loading engine. + /// + public interface IFSEModuleLoader + { + /// + /// Occurs when the user has logged in and user modules are loaded. + /// + event EventHandler ModulesLoaded; + + /// + /// Gets all loaded modules. + /// + ObservableCollection AllModules { get; } + + /// + /// Gets all the user permitted modules. + /// + ObservableCollection UserModules { get; } + + /// + /// Gets the PPC module of type T if loaded. + /// + /// + /// + T GetFSEModule() where T : IFSEModule; + + /// + /// Loads all available PPC modules. + /// + void LoadModules(); + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Navigation/INavigationBlocker.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Navigation/INavigationBlocker.cs new file mode 100644 index 000000000..0a96200ea --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Navigation/INavigationBlocker.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.FSE.Common.Navigation +{ + /// + /// Represents an object which can abort the navigation from it. + /// + public interface INavigationBlocker + { + /// + /// Called before the navigation system navigates from this object. + /// Return false to abort the navigation. + /// + /// + Task OnNavigateOutRequest(); + + /// + /// Called before the navigation system navigates back from this object. + /// Return false to abort the navigation. + /// + /// + Task OnNavigateBackRequest(); + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Navigation/INavigationManager.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Navigation/INavigationManager.cs new file mode 100644 index 000000000..0939516d6 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Navigation/INavigationManager.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; + +namespace Tango.FSE.Common.Navigation +{ + /// + /// Represents the PPC views navigation manager. + /// + public interface INavigationManager + { + /// + /// Gets the current module. + /// + IFSEModule CurrentModule { get; } + + /// + /// Gets the current view model. + /// + FSEViewModel CurrentVM { get; } + + /// + /// Gets a value indicating whether the navigation system is able to navigate to the previous view. + /// + bool CanNavigateBack { get; } + + /// + /// Gets a value indicating whether the back should be enabled. + /// + bool IsBackEnabled { get; set; } + + /// + /// Navigates to the previous view if is true. + /// + Task NavigateBack(); + + /// + /// Navigates to the previous view.. + /// + RelayCommand NavigateBackCommand { get; } + + /// + /// Navigates to the specified full path in command parameter. + /// + RelayCommand NavigateToCommand { get; } + + /// + /// Navigates to the specified PPC view. + /// + /// The view. + Task NavigateTo(NavigationView view, bool pushToHistory = true); + + /// + /// Navigates to the specified PPC view with the specified receive object. + /// + /// The view. + Task NavigateWithObject(NavigationView view, TPass obj, bool pushToHistory = true); + + /// + /// Navigates to the specified module. + /// + /// + Task NavigateTo(bool pushToHistory = true) where T : IFSEModule; + + /// + /// Navigates to the specified module using the view path (e.g MainView.JobsView). + /// + /// + /// The view path. + Task NavigateTo(String viewPath, bool pushToHistory = true) where T : IFSEModule; + + /// + /// Navigates to the specified module using the view path (e.g MainView,JobsView). + /// This method makes it easy to do stuff like NavigateTo(nameof(MainView),nameof(JobsView)); + /// + /// + /// The view path. + Task NavigateTo(bool pushToHistory = true, params String[] viewPath) where T : IFSEModule; + + /// + /// Navigates to the specified module and view by full path (e.g Jobs.JobsView). + /// + /// The full path. + Task NavigateTo(String fullPath, bool pushToHistory = true, Action onNavigating = null, Action onNavigated = null); + + /// + /// Navigates to the specified module and view with the specified object and expecting a return parameter. + /// The view must be of type INavigationResultProvider. + /// + /// The full path. + Task NavigateForResult(TPass obj, bool pushToHistory = true) + where TModule : IFSEModule; + + /// + /// Navigates to the specified module and view with the specified object. + /// + /// The type of the module. + /// The type of the view. + /// The type of the pass. + /// The object. + /// if set to true [push to history]. + /// + Task NavigateWithObject(TPass obj, bool pushToHistory = true) + where TModule : IFSEModule; + + /// + /// Clears the navigation back history. + /// + void ClearHistory(); + + /// + /// Clears the navigation back history except the specified view type. + /// + void ClearHistoryExcept(); + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Navigation/INavigationObjectReceiver.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Navigation/INavigationObjectReceiver.cs new file mode 100644 index 000000000..0a1d94b76 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Navigation/INavigationObjectReceiver.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.FSE.Common.Navigation +{ + /// + /// Represents an object which supports receiving an object as part of the navigation to it. + /// + /// + public interface INavigationObjectReceiver + { + /// + /// Called when navigation system is going to navigate to this instance with the specified object. + /// + /// The object. + void OnNavigatedToWithObject(T obj); + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Navigation/INavigationResultProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Navigation/INavigationResultProvider.cs new file mode 100644 index 000000000..81d2545c5 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Navigation/INavigationResultProvider.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.FSE.Common.Navigation +{ + /// + /// Represents a object which provides a result the navigation system navigates away from it. + /// + /// The type of the result. + /// The type of the pass. + public interface INavigationResultProvider + { + /// + /// Called when the navigation system requests a result when it is navigating away from this instance. + /// + /// + TResult GetNavigationResult(); + + /// + /// Called when navigation system is going to navigate to this instance with the specified object. + /// + /// The object. + void OnNavigationObjectReceived(TPass obj); + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Navigation/NavigationView.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Navigation/NavigationView.cs new file mode 100644 index 000000000..85bb28510 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Navigation/NavigationView.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.FSE.Common.Navigation +{ + /// + /// Represents the main application views to navigate to using the . + /// + public enum NavigationView + { + Home, + LoadingView, + LayoutView, + NoPermissionsView, + RestartingView, + LoginView, + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/AppBarItem.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/AppBarItem.cs new file mode 100644 index 000000000..83c8fabde --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/AppBarItem.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using Tango.Core.Commands; + +namespace Tango.FSE.Common.Notifications +{ + /// + /// Represents an AppBar item that can be inserted into the application header. + /// + public abstract class AppBarItem : ItemBase + { + + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/AppButton.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/AppButton.cs new file mode 100644 index 000000000..d8081c989 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/AppButton.cs @@ -0,0 +1,112 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.Core.Commands; +using Tango.Core.DI; + +namespace Tango.FSE.Common.Notifications +{ + /// + /// Represents an app button that will be displayed in the layout view. + /// + /// + public abstract class AppButton : ExtendedObject + { + /// + /// Occurs when the button has been pressed. + /// + public event Action Pressed; + + private String _text; + /// + /// Gets or sets the text. + /// + public String Text + { + get { return _text; } + set { _text = value; RaisePropertyChangedAuto(); } + } + + private bool _isEnabled; + /// + /// Gets or sets a value indicating whether this instance is enabled. + /// + public bool IsEnabled + { + get { return _isEnabled; } + set { _isEnabled = value; RaisePropertyChangedAuto(); } + } + + private RelayCommand _command; + /// + /// Gets or sets the command. + /// + public RelayCommand Command + { + get { return _command; } + set { _command = value; RaisePropertyChangedAuto(); } + } + + /// + /// Initializes a new instance of the class. + /// + public AppButton() + { + + } + + /// + /// Initializes a new instance of the class. + /// + /// The text. + /// if set to true [is enabled]. + /// The on execute. + /// The can execute. + public AppButton(String text, bool isEnabled) : this() + { + Text = text; + IsEnabled = isEnabled; + Command = new RelayCommand(() => + { + Pressed?.Invoke(); + }); + } + + /// + /// Initializes a new instance of the class. + /// + /// The text. + /// The command. + public AppButton(String text, RelayCommand command) : this(text, true) + { + Command = command; + } + + /// + /// Invalidates the button state. + /// + public void RaiseCanExecute() + { + Command.RaiseCanExecuteChanged(); + } + + /// + /// Pops this instance. + /// + public void Pop() + { + TangoIOC.Default.GetInstance().PopAppButton(this); + } + + /// + /// Pushes this instance. + /// + public void Push() + { + TangoIOC.Default.GetInstance().PushAppButton(this); + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/INotificationProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/INotificationProvider.cs new file mode 100644 index 000000000..ce567a354 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/INotificationProvider.cs @@ -0,0 +1,229 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media; +using Tango.Core.Commands; +using Tango.SharedUI; + +namespace Tango.FSE.Common.Notifications +{ + /// + /// Represents the PPC user notification provider responsible for displaying information, alerts and dialogs to the user. + /// + public interface INotificationProvider + { + /// + /// Gets the collection of notification items. + /// + ObservableCollection NotificationItems { get; } + + /// + /// Gets the notification items view. + /// + ICollectionView NotificationItemsView { get; } + + /// + /// Gets the collection of taskbar items. + /// + ObservableCollection TaskBarItems { get; } + + /// + /// Gets the current application bar item. + /// + AppBarItem CurrentAppBarItem { get; } + + /// + /// Gets a value indicating whether this instance has application bar item. + /// + bool HasAppBarItem { get; } + + /// + /// Gets a value indicating whether this instance has notification items. + /// + bool HasNotificationItems { get; } + + /// + /// Gets the current message box. + /// + MessageBoxVM CurrentMessageBox { get; } + + /// + /// Gets a value indicating whether this instance has message box. + /// + bool HasMessageBox { get; } + + /// + /// Gets the current dialog. + /// + FrameworkElement CurrentDialog { get; } + + /// + /// Gets the current app button. + /// + AppButton CurrentAppButton { get; } + + /// + /// Gets a value indicating whether this instance has a dialog. + /// + bool HasDialog { get; } + + /// + /// Shows an information message box. + /// + /// The message. + Task ShowInfo(String message); + + /// + /// Shows warning message box. + /// + /// The message. + Task ShowWarning(String message); + + /// + /// Shows an error message box. + /// + /// The message. + Task ShowError(String message); + + /// + /// Shows a success message box. + /// + /// The message. + Task ShowSuccess(String message); + + /// + /// Shows a question message box. + /// + /// The message. + Task ShowQuestion(String message); + + /// + /// Inserts the notification item to the bottom of the notifications collection. + /// + /// The item. + NotificationItem PushNotification(NotificationItem item); + + /// + /// Pushes the notification. + /// + /// + /// + NotificationItem PushNotification() where T : NotificationItem; + + /// + /// Displays the specified dialog in a modal design. + /// + /// + /// The data context. + /// The view. + /// + Task ShowDialog(VM datacontext, FrameworkElement view) where VM : DialogViewVM; + + /// + /// Displays the specified dialog in a modal design. + /// The notification provider will try to locate the view automatically using conventions. + /// + /// + /// The data context. + /// + Task ShowDialog(VM datacontext) where VM : DialogViewVM; + + /// + /// Displays the specified dialog in a modal design. + /// The data context instance will be automatically created. + /// The notification provider will try to locate the view automatically using conventions. + /// + /// + /// + Task ShowDialog() where VM : DialogViewVM; + + /// + /// Removed the specified notification item. + /// + /// The item. + void PopNotification(NotificationItem item); + + /// + /// Gets a value indicating whether this instance is in global busy state. + /// + bool IsInGlobalBusyState { get; } + + /// + /// Sets the global busy message. + /// + /// The message. + void SetGlobalBusyMessage(String message); + + /// + /// Releases the global busy message. + /// + void ReleaseGlobalBusyMessage(); + + /// + /// Gets the current global busy message. + /// + String GlobalBusyMessage { get; } + + /// + /// Pushes the application bar item. + /// + /// The application bar item. + /// + AppBarItem PushAppBarItem(AppBarItem appBarItem); + + /// + /// Pushes the application bar item. + /// + /// + /// + AppBarItem PushAppBarItem() where T : AppBarItem; + + /// + /// Pops the application bar item. + /// + /// The application bar item. + void PopAppBarItem(AppBarItem appBarItem); + + /// + /// Pushes the task bar item. + /// + /// The task bar item. + /// + TaskBarItem PushTaskBarItem(TaskBarItem taskBarItem); + + /// + /// Handles the Push Task Bar Item event. + /// + /// + /// + TaskBarItem PushTaskBarItem() where T : TaskBarItem; + + /// + /// Pops the task bar item. + /// + /// The task bar item. + void PopTaskBarItem(TaskBarItem taskBarItem); + + /// + /// Gets or sets a value indicating whether to allow notifications visibility. + /// + bool NotificationsVisible { get; set; } + + /// + /// Pushes the app button. + /// + /// The app button. + void PushAppButton(AppButton appButton); + + /// + /// Pops the app button. + /// + /// The app button. + void PopAppButton(AppButton appButton); + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/ItemBase.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/ItemBase.cs new file mode 100644 index 000000000..91e3b0998 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/ItemBase.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.Core.Commands; + +namespace Tango.FSE.Common.Notifications +{ + /// + /// Represents a base notification item class. + /// + /// + /// + public abstract class ItemBase : ExtendedObject, IDisposable + { + /// + /// Occurs when the item has been closed. + /// + public event EventHandler Closed; + + /// + /// Occurs when the item has been pressed. + /// + public event EventHandler Pressed; + + /// + /// Gets or sets the remove action. + /// + public Action RemoveAction { get; set; } + + /// + /// Gets or sets the view type. + /// + public abstract Type ViewType { get; } + + /// + /// Gets or sets the close command. + /// + public RelayCommand CloseCommand { get; set; } + + /// + /// Gets or sets the pressed command. + /// + /// Initializes a new instance of the class. + /// + public ItemBase() + { + CloseCommand = new RelayCommand(Close); + PressedCommand = new RelayCommand(OnPreesed); + } + + /// + /// Called when the item has been pressed. + /// + protected virtual void OnPreesed() + { + Pressed?.Invoke(this, new EventArgs()); + } + + /// + /// Called after the close command has been raised. + /// + public virtual void Close() + { + RemoveAction?.Invoke(); + Closed?.Invoke(this, new EventArgs()); + } + + /// + /// Disposes the item. + /// + public void Dispose() + { + Close(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/MessageBoxVM.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/MessageBoxVM.cs new file mode 100644 index 000000000..710939a8a --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/MessageBoxVM.cs @@ -0,0 +1,22 @@ +using MaterialDesignThemes.Wpf; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using Tango.SharedUI; + +namespace Tango.FSE.Common.Notifications +{ + public class MessageBoxVM : DialogViewVM + { + public MessageType Type { get; set; } + + public String Title { get; set; } + + public String Message { get; set; } + + public bool HasCancel { get; set; } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/MessageType.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/MessageType.cs new file mode 100644 index 000000000..2d9edcfd3 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/MessageType.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.FSE.Common.Notifications +{ + public enum MessageType + { + Info, + Warning, + Error, + Success + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/NotificationItem.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/NotificationItem.cs new file mode 100644 index 000000000..9708544cd --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/NotificationItem.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Timers; +using System.Windows.Media; +using Tango.Core; + +namespace Tango.FSE.Common.Notifications +{ + /// + /// Represents a base notification item. + /// + public abstract class NotificationItem : ItemBase + { + public enum NotificationPriority + { + Low, + Normal, + High, + VeryHigh, + Critical, + } + + /// + /// Initializes a new instance of the class. + /// + public NotificationItem() : base() + { + CanClose = true; + Priority = NotificationPriority.Normal; + } + + private bool _isExpanded; + /// + /// Gets or sets a value indicating whether the notification panel is expanded. + /// + public bool IsExpanded + { + get { return _isExpanded; } + set { _isExpanded = value; RaisePropertyChangedAuto(); } + } + + private bool _canClose; + /// + /// Gets or sets a value indicating whether this instance can close. + /// + public bool CanClose + { + get { return _canClose; } + set { _canClose = value; RaisePropertyChangedAuto(); } + } + + /// + /// Gets or sets the notification priority. + /// + public NotificationPriority Priority { get; set; } + + /// + /// Called when the item has been pressed. + /// + protected override void OnPreesed() + { + base.OnPreesed(); + + if (CanClose) + { + Close(); + } + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/TaskBarItem.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/TaskBarItem.cs new file mode 100644 index 000000000..030e7a22a --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/TaskBarItem.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.FSE.Common.Notifications +{ + public abstract class TaskBarItem : ItemBase + { + + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Properties/AssemblyInfo.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..b67d40216 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango.FSE.Common")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Tango.FSE.Common")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly:ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Properties/Resources.Designer.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Properties/Resources.Designer.cs new file mode 100644 index 000000000..34aae5903 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Properties/Resources.Designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.FSE.Common.Properties { + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if ((resourceMan == null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.FSE.Common.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Properties/Resources.resx b/Software/Visual_Studio/FSE/Tango.FSE.Common/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Properties/Settings.Designer.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Properties/Settings.Designer.cs new file mode 100644 index 000000000..8a03234d1 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.FSE.Common.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Properties/Settings.settings b/Software/Visual_Studio/FSE/Tango.FSE.Common/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Colors.xaml b/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Colors.xaml new file mode 100644 index 000000000..f58d24aa2 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Colors.xaml @@ -0,0 +1,43 @@ + + + + #303030 + #EEEEEE + #45000000 + #07D10F + + #FF0000 + #FF6200 + #07D10F + #404040 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Fonts.xaml b/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Fonts.xaml new file mode 100644 index 000000000..08e8dea6f --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Fonts.xaml @@ -0,0 +1,8 @@ + + + 16 + + \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj new file mode 100644 index 000000000..6fdd7acf2 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj @@ -0,0 +1,191 @@ + + + + + Debug + AnyCPU + {BC37CCCB-7392-4F78-8D1C-E9629E6E046E} + library + Tango.FSE.Common + Tango.FSE.Common + v4.6.1 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + + + + + true + full + false + ..\..\Build\FSE\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\Build\FSE\Release\ + TRACE + prompt + 4 + + + + ..\..\packages\ControlzEx.3.0.2.4\lib\net45\ControlzEx.dll + + + ..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll + + + ..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll + + + ..\..\packages\MahApps.Metro.1.6.5\lib\net46\MahApps.Metro.dll + + + ..\..\packages\MaterialDesignColors.1.2.2\lib\net45\MaterialDesignColors.dll + + + ..\..\packages\MaterialDesignThemes.3.0.1\lib\net45\MaterialDesignThemes.Wpf.dll + + + ..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + + + + + + + ..\..\packages\ControlzEx.3.0.2.4\lib\net45\System.Windows.Interactivity.dll + + + + + + + + + 4.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + + + + + + + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + {f441feee-322a-4943-b566-110e12fd3b72} + Tango.BL + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} + Tango.Settings + + + {8491d07b-c1f6-4b62-a412-41b9fd2d6538} + Tango.SharedUI + + + {74E700B0-1156-4126-BE40-EE450D3C3026} + Tango.Transport + + + {5001990f-977b-48ff-b217-0236a5022ad8} + Tango.Web + + + {d6f7d31d-7f8c-45e2-ae0a-fbbd1f5f9d5f} + Tango.FSE.Web + + + + + + nswag run "$(SolutionDir)Web\Tango.MachineService.Gateway\Nswag\GatewayClient.nswag" /variables:assembly="$(SolutionDir)Web\Tango.MachineService.Gateway\bin\Tango.MachineService.Gateway.dll",output="$(ProjectDir)Gateway\GatewayClient.cs" + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Themes/Generic.xaml b/Software/Visual_Studio/FSE/Tango.FSE.Common/Themes/Generic.xaml new file mode 100644 index 000000000..ec131133e --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Themes/Generic.xaml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Threading/IDispatcherProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Threading/IDispatcherProvider.cs new file mode 100644 index 000000000..f6b03f694 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Threading/IDispatcherProvider.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.FSE.Common.Threading +{ + /// + /// Represents a mechanism for invoking actions on the main application thread. + /// + public interface IDispatcherProvider + { + /// + /// Invokes the specified action asynchronously. + /// + /// The action. + void Invoke(Action action); + + /// + /// Invokes the specified action synchronously. + /// + /// The action. + void InvokeBlock(Action action); + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Web/FSEWebClient.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Web/FSEWebClient.cs new file mode 100644 index 000000000..4c15ff90f --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Web/FSEWebClient.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; + +namespace Tango.FSE.Common.Web +{ + public class FSEWebClient : FSEWebClientBase + { + public FSEWebClient() : base(String.Empty) + { + + } + + public FSEWebClient(string address) : base(address) + { + } + + public FSEWebClient(FSEWebClientBase cloned) : base(cloned) + { + } + + public FSEWebClient(string address, string token) : base(address, token) + { + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Web/FSEWebClientBase.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Web/FSEWebClientBase.cs new file mode 100644 index 000000000..d5fd41001 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Web/FSEWebClientBase.cs @@ -0,0 +1,43 @@ + +using System; +using System.Threading.Tasks; +using Tango.Web; + +namespace Tango.FSE.Common.Web +{ + /// + /// Represents a machine service FSE web client. + /// + /// + public abstract class FSEWebClientBase : TangoWebClientV2 + { + /// + /// Initializes a new instance of the class. + /// + /// The service address. + /// Existing token. + public FSEWebClientBase(String address, String token) : base(address, "FSE", token) + { + + } + + /// + /// Initializes a new instance of the class. + /// + /// The service address. + public FSEWebClientBase(String address) : this(address, null) + { + + } + + /// + /// Initializes a new instance of the class. + /// + /// Other instance. + public FSEWebClientBase(FSEWebClientBase cloned) : base(cloned) + { + + } + + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/packages.config b/Software/Visual_Studio/FSE/Tango.FSE.Common/packages.config new file mode 100644 index 000000000..f8d27760e --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/packages.config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/App.config b/Software/Visual_Studio/FSE/Tango.FSE.UI/App.config new file mode 100644 index 000000000..22e3d6062 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/App.config @@ -0,0 +1,91 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/App.xaml b/Software/Visual_Studio/FSE/Tango.FSE.UI/App.xaml new file mode 100644 index 000000000..b2ba0b65d --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/App.xaml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/App.xaml.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/App.xaml.cs new file mode 100644 index 000000000..9ccc9551e --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/App.xaml.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace Tango.FSE.UI +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Authentication/DefaultAuthenticationProvider.cs new file mode 100644 index 000000000..0dac693df --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Authentication/DefaultAuthenticationProvider.cs @@ -0,0 +1,170 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Authentication; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Builders; +using Tango.BL.Entities; +using Tango.Core; +using Tango.Core.DI; +using Tango.FSE.Common; +using Tango.FSE.Common.Authentication; +using Tango.FSE.Common.FSEApplication; +using Tango.FSE.Common.Navigation; +using Tango.FSE.Common.Web; +using Tango.FSE.Web.Messages; +using Tango.MachineService.Gateway; +using Tango.Settings; + +namespace Tango.FSE.UI.Authentication +{ + /// + /// Represents the default FSE authentication provider. + /// + /// + /// + public class DefaultAuthenticationProvider : ExtendedObject, IAuthenticationProvider + { + private FSEWebClient _webClient; + + [TangoInject(TangoInjectMode.WhenAvailable)] + private IFSEApplicationManager _appManager; + + /// + /// Gets or sets the navigation manager. + /// + [TangoInject(TangoInjectMode.WhenAvailable)] + private INavigationManager _navigationManager; + + /// + /// Occurs when the current logged-in user has changed. + /// + public event EventHandler CurrentUserChanged; + + private User _currentUser; + /// + /// Gets the current logged-in user. + /// + public User CurrentUser + { + get { return _currentUser; } + private set + { + _currentUser = value; + RaisePropertyChangedAuto(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// The web client. + public DefaultAuthenticationProvider(FSEWebClient webClient) + { + _webClient = webClient; + } + + /// + /// Logins the specified email. + /// + /// The email. + /// The password. + /// The environment. + /// + public Task Login(String email, String password, EnvironmentConfiguration environment) + { + return Task.Factory.StartNew(() => + { + LogManager.Log($"Logging in user {email}..."); + + var settings = SettingsManager.Default.GetOrCreate(); + + settings.LastEnvironmentId = environment.ID; + + if (_appManager.StartupArgs.Contains("-webDebug")) + { + _webClient.Address = "http://localhost:1111"; + } + else + { + _webClient.Address = environment.MachineServiceAddress; + } + + var appVersion = _appManager.Version.ToString(); + + if (settings.ForceVersionUpdate) + { + appVersion = "1.0.0.0"; + } + + LoginResponse response = null; + + try + { + response = _webClient.Login(new LoginRequest() + { + + Email = email, + Password = password, + Version = appVersion, + + }).Result; + } + catch (Exception ex) + { + throw new AggregateException(new AuthenticationException("Error logging in to machine service."), ex); + } + + if (settings.Environment == FSESettings.WorkingEnvironment.Remote) + { + ObservablesContext.OverrideSettingsDataSource(response.DataSource); + } + + if (response.PasswordChangeRequired) + { + return new AuthenticationResult() { Response = response }; + } + + using (var db = ObservablesContext.CreateDefault()) + { + CurrentUser = new UserBuilder(db).Set(x => x.Email.ToLower() == email.ToLower()) + .WithOrganization() + .WithRolesAndPermissions() + .Build(); + } + + if (CurrentUser != null) + { + LogManager.Log($"Current user is now: {CurrentUser.Contact.FullName}."); + } + else + { + throw new AuthenticationException("Login failed for some strange reason."); + } + + settings.Save(); + + CurrentUserChanged?.Invoke(this, CurrentUser); + + return new AuthenticationResult() + { + Response = response, + User = CurrentUser, + }; + }); + } + + /// + /// Logs-out the current logged-in user. + /// + public void LogOut() + { + LogManager.Log("Logging out current user."); + CurrentUser = null; + CurrentUserChanged?.Invoke(this, CurrentUser); + _navigationManager.NavigateTo(NavigationView.LoginView); + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/FSEApplication/DefaultFSEApplicationManager.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/FSEApplication/DefaultFSEApplicationManager.cs new file mode 100644 index 000000000..2155699ef --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/FSEApplication/DefaultFSEApplicationManager.cs @@ -0,0 +1,370 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; +using Tango.Settings; +using Tango.Core.DI; +using Tango.FSE.Common; +using System.Windows; +using Tango.Core; +using System.IO; +using Tango.Core.Helpers; +using Tango.FSE.Common.Modules; +using System.Windows.Threading; +using System.Data.SqlClient; +using Tango.BL.Builders; +using Tango.FSE.Common.Threading; +using System.Diagnostics; +using Tango.BL.Enumerations; +using Tango.FSE.Common.Notifications; +using Tango.Core.Threading; +using Tango.Core.ExtensionMethods; +using Tango.FSE.Common.Navigation; +using Tango.FSE.Common.FSEApplication; + +namespace Tango.FSE.UI.FSEApplication +{ + /// + /// Represents the default FSE application manager. + /// + /// + /// + public class DefaultFSEApplicationManager : ExtendedObject, IFSEApplicationManager + { + private List _notifiedViewModels; + private IDispatcherProvider _dispatcher; + private IFSEModuleLoader _moduleLoader; + private INotificationProvider _notificationProvider; + + /// + /// Occurs when the application has started. + /// + public event EventHandler ApplicationStarted; + + /// + /// Occurs when all FSE modules are ready and initialized. + /// + public event EventHandler ModulesInitialized; + + /// + /// Occurs when the application is ready and all modules are views are loaded. + /// + public event EventHandler ApplicationReady; + + /// + /// Occurs when the main window content has been rendered. + /// + public event EventHandler ContentRendered; + + /// + /// Occurs when the application has encountered an error when initializing. + /// + public event EventHandler ApplicationInitializationError; + + /// + /// Gets the application startup arguments. + /// + public List StartupArgs { get; private set; } + + /// + /// Gets a value indicating whether the application is shutting down. + /// + public bool IsShuttingDown { get; private set; } + + /// + /// Gets the application version. + /// + public Version Version + { + get + { + return AssemblyHelper.GetCurrentAssemblyVersion(); + } + } + + /// + /// Gets the application build date. + /// + public String BuildDate + { + get + { + return AssemblyHelper.GetCurrentAssemblyBuildDate().ToShortDateString(); + } + } + + /// + /// Gets the application startup date. + /// + public DateTime StartUpDate { get; private set; } + + /// + /// Gets a value indicating whether an update has occurred before the application started. + /// + public bool IsAfterUpdate { get; private set; } + + /// + /// Gets or sets the application folder. + /// + public String StartPath { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + public DefaultFSEApplicationManager(IDispatcherProvider dispatcherProvider, IFSEModuleLoader moduleLoader, INotificationProvider notificationProvider) + { + StartPath = AssemblyHelper.GetCurrentAssemblyFolder(); + StartupArgs = Environment.GetCommandLineArgs().Skip(1).ToList(); + + _notificationProvider = notificationProvider; + _dispatcher = dispatcherProvider; + _moduleLoader = moduleLoader; + + if (!DesignMode) + { + _notifiedViewModels = new List(); + + MainWindow.Instance.ContentRendered += (_, __) => + { + OnMainWindowContentRendered(); + }; + } + } + + /// + /// Called when the main window content has been rendered + /// + private void OnMainWindowContentRendered() + { + LogManager.Log("Main window content rendered."); + + ContentRendered?.Invoke(this, new EventArgs()); + + StartApplication(); + } + + private async void StartApplication() + { + FSESettings settings = null; + + bool initialized = false; + + StartUpDate = DateTime.Now; + + await Task.Factory.StartNew(() => + { + try + { + initialized = true; + } + catch (Exception ex) + { + LogManager.Log(ex, "Application Initialization Error!"); + ApplicationInitializationError?.Invoke(this, ex); + return; + } + }); + + + if (initialized) + { + try + { + PostDbInitialize(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Application Post Initialization Error!"); + ApplicationInitializationError?.Invoke(this, ex); + return; + } + } + } + + /// + /// Called when the database has been initialized + /// + private void PostDbInitialize() + { + LogManager.Log($"Raising {nameof(ApplicationStarted)} event..."); + + ApplicationStarted?.Invoke(this, new EventArgs()); + + LogManager.Log("Invoking FSE view models OnApplicationStarted methods..."); + foreach (var vm in TangoIOC.Default.GetAllInstancesByBase()) + { + if (!_notifiedViewModels.Contains(vm)) + { + LogManager.Log($"Invoking {vm.GetType().Name}.OnApplicationStarted..."); + vm.OnApplicationStarted(); + _notifiedViewModels.Add(vm); + } + } + + var internalModules = this.GetType().Assembly.GetTypes().Where(xx => typeof(FSEModuleBase).IsAssignableFrom(xx)).ToList(); + + LogManager.Log("Waiting for IFSEModuleLoader instance injection..."); + TangoIOC.Default.GetInstanceWhenAvailable((loader) => + { + LogManager.Log("Module loader instance has been registered. Registering for the ModulesLoaded event..."); + + loader.ModulesLoaded += (x, y) => + { + LogManager.Log("Loading modules views"); + _dispatcher.InvokeBlock(() => + { + foreach (var module in TangoIOC.Default.GetInstance().UserModules) + { + if (!Views.LayoutView.Instance.NavigationControl.Elements.ToList().Exists(m => m.GetType() == module.MainViewType)) + { + try + { + LogManager.Log("Loading module view " + module.Name + "..."); + FrameworkElement view = Activator.CreateInstance(module.MainViewType) as FrameworkElement; + SharedUI.Controls.NavigationControl.SetNavigationName(view, module.Name); + Views.LayoutView.Instance.NavigationControl.Elements.Add(view); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error loading module view for module {module.Name}."); + } + } + } + + //Adding internal modules. + LogManager.Log("Loading internal modules..."); + foreach (var type in internalModules) + { + var module = Activator.CreateInstance(type) as IFSEModule; + LogManager.Log("Loading module view " + module.Name + "..."); + FrameworkElement view = Activator.CreateInstance(module.MainViewType) as FrameworkElement; + SharedUI.Controls.NavigationControl.SetNavigationName(view, module.Name); + Views.LayoutView.Instance.NavigationControl.Elements.Add(view); + _moduleLoader.AllModules.Add(module); + _moduleLoader.UserModules.Add(module); + } + }); + + LogManager.Log($"{loader.UserModules.Count} modules loaded."); + + LogManager.Log($"Invoking {nameof(ModulesInitialized)} event."); + ModulesInitialized?.Invoke(this, new EventArgs()); + + FinalizeModuleInitialization(); + }; + }); + } + + /// + /// Finalizes the module initialization. + /// + private void FinalizeModuleInitialization() + { + var settings = SettingsManager.Default.GetOrCreate(); + + LogManager.Log("Finalizing application initialization..."); + + //LogManager.Log("Initializing Machine Provider..."); + //_machineProvider.Init(_machine, _machineContext); + + //LogManager.Log("Starting Machine Data Synchronizer..."); + //_machineDataSynchronizer.IsEnabled = true; + + LogManager.Log("Applications initialization completed!"); + + LogManager.Log("Checking for un-notified FSE view models..."); + foreach (var vm in TangoIOC.Default.GetAllInstancesByBase()) + { + if (!_notifiedViewModels.Contains(vm)) + { + LogManager.Log($"Invoking {vm.GetType().Name}.OnApplicationStarted..."); + vm.OnApplicationStarted(); + _notifiedViewModels.Add(vm); + } + } + + _dispatcher.Invoke(() => + { + LogManager.Log($"Invoking {nameof(ApplicationReady)} event."); + ApplicationReady?.Invoke(this, new EventArgs()); + + LogManager.Log("Notifying view models about application ready..."); + foreach (var vm in TangoIOC.Default.GetAllInstancesByBase()) + { + LogManager.Log($"Invoking {vm.GetType().Name}.OnApplicationReady..."); + vm.OnApplicationReady(); + } + }); + } + + /// + /// Shutdown the application. + /// + public void ShutDown() + { + if (IsShuttingDown) return; + + IsShuttingDown = true; + + try + { + LogManager.Log("Shutting down application..."); + + foreach (var vm in TangoIOC.Default.GetAllInstancesByBase()) + { + vm.OnApplicationShuttingDown(); + } + } + catch { } + + Environment.Exit(0); + } + + /// + /// Restarts the application. + /// + public async void Restart() + { + if (IsShuttingDown) return; + + IsShuttingDown = true; + + try + { + _dispatcher.Invoke(() => + { + var nav = TangoIOC.Default.GetInstance(); + if (nav != null) + { + nav.NavigateTo(NavigationView.RestartingView); + } + }); + + LogManager.Log("Restarting the application..."); + + await Task.Delay(8000); + + foreach (var vm in TangoIOC.Default.GetAllInstancesByBase()) + { + vm.OnApplicationShuttingDown(); + } + } + catch { } + + //try + //{ + // if (_machineProvider.MachineOperator.State == Transport.TransportComponentState.Connected) + // { + // _machineProvider.MachineOperator.Adapter.Disconnect().Wait(); + // } + //} + //catch { } + + Process.Start(Application.ResourceAssembly.Location); + Environment.Exit(0); + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Gateway/DefaultGatewayService.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Gateway/DefaultGatewayService.cs new file mode 100644 index 000000000..c003ce59c --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Gateway/DefaultGatewayService.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Configuration; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.FSE.Common.Gateway; +using Tango.MachineService.Gateway; + +namespace Tango.FSE.UI.Gateway +{ + public class DefaultGatewayService : ExtendedObject, IGatewayService + { + private ReadOnlyObservableCollection _environments; + public ReadOnlyObservableCollection Environments + { + get { return _environments; } + set { _environments = value; RaisePropertyChangedAuto(); } + } + + + public async Task> GetEnvironments() + { + using (HttpClient http = new HttpClient()) + { + GatewayClient client = new GatewayClient(ConfigurationManager.AppSettings.Get("GatewayUrl"), http); + var list = (await client.GetEnvironmentsAsync(new EnvironmentsRequest())).Environments.ToList(); + Environments = new ReadOnlyObservableCollection(new ObservableCollection(list)); + return list; + } + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/MainWindow.xaml b/Software/Visual_Studio/FSE/Tango.FSE.UI/MainWindow.xaml new file mode 100644 index 000000000..4802e7b57 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/MainWindow.xaml @@ -0,0 +1,22 @@ + + + + + + diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/MainWindow.xaml.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/MainWindow.xaml.cs new file mode 100644 index 000000000..28385d2dc --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/MainWindow.xaml.cs @@ -0,0 +1,32 @@ +using MahApps.Metro.Controls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.FSE.UI +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : MetroWindow + { + public static MainWindow Instance { get; set; } + + public MainWindow() + { + Instance = this; + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Modules/DefaultFSEModuleLoader.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Modules/DefaultFSEModuleLoader.cs new file mode 100644 index 000000000..7c5c6ce39 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Modules/DefaultFSEModuleLoader.cs @@ -0,0 +1,146 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.BL.Entities; +using Tango.Logging; +using Tango.FSE.Common.Modules; +using Tango.FSE.Common; +using System.Windows.Data; +using Tango.Core.DI; +using Tango.FSE.Common.Authentication; + +namespace Tango.FSE.UI.Modules +{ + /// + /// Represents the default PPC . + /// + /// + /// + public class DefaultFSEModuleLoader : ExtendedObject, IFSEModuleLoader + { + private static object _syncObject = new object(); + private IAuthenticationProvider _authenticationProvider; + private bool _loaded; + + /// + /// Occurs when the user has logged in and user modules are loaded. + /// + public event EventHandler ModulesLoaded; + + /// + /// Initializes a new instance of the class. + /// + /// The authentication provider. + public DefaultFSEModuleLoader(IAuthenticationProvider authenticationProvider) + { + _authenticationProvider = authenticationProvider; + AllModules = new ObservableCollection(); + UserModules = new ObservableCollection(); + + BindingOperations.EnableCollectionSynchronization(UserModules, _syncObject); + + _authenticationProvider.CurrentUserChanged += _authenticationProvider_CurrentUserChanged; + } + + /// + /// Handles the authentication provider user changed event. + /// + /// The sender. + /// The e. + private void _authenticationProvider_CurrentUserChanged(object sender, User e) + { + LoadModules(); + } + + private ObservableCollection _allModules; + /// + /// Gets all loaded modules. + /// + public ObservableCollection AllModules + { + get { return _allModules; } + private set { _allModules = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection _userModules; + /// + /// Gets all the user permitted modules. + /// + public ObservableCollection UserModules + { + get { return _userModules; } + private set { _userModules = value; RaisePropertyChangedAuto(); } + } + + /// + /// Loads all available PPC modules. + /// + public void LoadModules() + { + if (!_loaded) + { + AllModules.Clear(); + string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + + foreach (var file in Directory.GetFiles(assemblyFolder, "*.dll").Where(x => x.Contains("Tango.FSE"))) + { + try + { + Assembly moduleAssembly = null; + moduleAssembly = Assembly.LoadFrom(file); + + if (moduleAssembly != null) + { + foreach (var moduleType in moduleAssembly.GetLoadableTypes().Where(x => !x.IsInterface && typeof(IFSEModule).IsAssignableFrom(x) && !x.IsAbstract)) + { + if (!AllModules.ToList().Exists(x => x.GetType() == moduleType)) + { + try + { + LogManager.Log(String.Format("Loading module '{0}'...", moduleType.Name)); + var module = Activator.CreateInstance(moduleType) as IFSEModule; + AllModules.Add(module); + } + catch (Exception ex) + { + LogManager.Log(ex, "Could not load module " + moduleType.Name); + } + } + } + } + } + catch { } + } + + _loaded = true; + } + + AllModules = AllModules.OrderBy(x => x.GetType().GetCustomAttribute().Index).ToObservableCollection(); + + UserModules.Clear(); + + if (_authenticationProvider.CurrentUser != null) + { + UserModules = AllModules.Where(x => _authenticationProvider.CurrentUser.HasPermission(x.Permission)).ToObservableCollection(); + } + + ModulesLoaded?.Invoke(this, new EventArgs()); + } + + /// + /// Gets the PPC module of type T if loaded. + /// + /// + /// + public T GetFSEModule() where T : IFSEModule + { + return UserModules.OfType().FirstOrDefault(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Navigation/DefaultNavigationManager.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Navigation/DefaultNavigationManager.cs new file mode 100644 index 000000000..66d2bb40b --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Navigation/DefaultNavigationManager.cs @@ -0,0 +1,539 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media; +using Tango.Core; +using Tango.Core.Commands; +using Tango.FSE.Common; +using Tango.FSE.Common.Modules; +using Tango.FSE.Common.Navigation; +using Tango.FSE.Common.Notifications; +using Tango.FSE.Common.Threading; +using Tango.FSE.UI.Views; +using Tango.SharedUI.Controls; + +namespace Tango.FSE.UI.Navigation +{ + /// + /// Represents the default FSE navigation manager. + /// + /// + public class DefaultNavigationManager : ExtendedObject, INavigationManager + { + //private event Action NavigationCycleCompleted; + //private event Action BeforeNavigationCycleCompleted; + private class AwaitingVMResult + { + public FSEViewModel FromVM { get; set; } + public FSEViewModel ToVM { get; set; } + public Action Action { get; set; } + } + + private List _awaitingVMResults; + private IDispatcherProvider _dispatcherProvider; + private IFSEModuleLoader _moduleLoader; + private INotificationProvider _notificationProvider; + private Object _currentVM; + private String _lastFullPath; + private bool _preventHistory; + private bool _navigating_back; + + private Stack _navigationHistory; + + /// + /// Gets the current view model. + /// + public FSEViewModel CurrentVM + { + get { return _currentVM as FSEViewModel; } + } + + private IFSEModule _currentModule; + /// + /// Gets or sets the current module. + /// + public IFSEModule CurrentModule + { + get { return _currentModule; } + private set { _currentModule = value; RaisePropertyChangedAuto(); } + } + + /// + /// Navigates to the previous view. + /// + public RelayCommand NavigateBackCommand { get; private set; } + + /// + /// Navigates to the specified full path in command parameter. + /// + public RelayCommand NavigateToCommand { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + /// The module loader. + public DefaultNavigationManager(IFSEModuleLoader moduleLoader, IDispatcherProvider dispatcherProvider, INotificationProvider notificationProvider) + { + IsBackEnabled = true; + _awaitingVMResults = new List(); + _navigationHistory = new Stack(); + _moduleLoader = moduleLoader; + _notificationProvider = notificationProvider; + + NavigateToCommand = new RelayCommand(async (x) => await NavigateTo(x)); + NavigateBackCommand = new RelayCommand(async () => await NavigateBack()); + + _dispatcherProvider = dispatcherProvider; + } + + /// + /// Navigates to the specified FSE view. + /// + /// The view. + public Task NavigateTo(NavigationView view, bool pushToHistory = true) + { + if (view == NavigationView.Home) + { + _navigationHistory.Clear(); + _lastFullPath = null; + + var firstModule = _moduleLoader.UserModules.FirstOrDefault(); + + if (firstModule != null) + { + var moduleAtt = firstModule.GetType().GetCustomAttribute(); + + if (moduleAtt != null) + { + return NavigateTo(firstModule.GetType(), pushToHistory, moduleAtt.HomeViewName); + } + else + { + return NavigateTo(firstModule.GetType(), pushToHistory); + } + } + else + { + return NavigateTo(NavigationView.NoPermissionsView); + } + } + else + { + + LogManager.Log($"Navigating to: {view.ToString()}..."); + + var fromView = MainView.Instance.NavigationControl.SelectedElement; + FrameworkElement toView = null; + + toView = MainView.Instance.NavigationControl.NavigateTo(view.ToString(), () => + { + _currentVM = toView.DataContext; + NotifyOnNavigated(fromView.DataContext, toView.DataContext); + + }); + + NotifyOnBeforeNavigated(fromView.DataContext, toView.DataContext); + + return Task.FromResult(true); + } + } + + /// + /// Navigates to the specified FSE view with the specified receive object. + /// + /// The view. + /// + /// + /// + public Task NavigateWithObject(NavigationView view, TPass obj, bool pushToHistory = true) + { + LogManager.Log($"Navigating to: {view.ToString()}, with object {typeof(TPass).Name}..."); + MainView.Instance.NavigationControl.NavigateTo(view.ToString()); + INavigationObjectReceiver receiver = MainView.Instance.NavigationControl.Elements.FirstOrDefault(x => (x.GetType().Name == view.ToString() || NavigationControl.GetNavigationName(x) == view.ToString()) && x.DataContext is INavigationObjectReceiver).DataContext as INavigationObjectReceiver; + + if (receiver != null) + { + receiver.OnNavigatedToWithObject(obj); + } + + return Task.FromResult(true); + } + + /// + /// Navigates to the specified module. + /// + /// + public Task NavigateTo(bool pushToHistory = true) where T : IFSEModule + { + return NavigateTo(typeof(T)); + } + + /// + /// Navigates to the specified module using the view path (e.g MainView.JobsView). + /// + /// + /// The view path. + public Task NavigateTo(string viewPath, bool pushToHistory = true) where T : IFSEModule + { + return NavigateTo(pushToHistory, viewPath.Split('.')); + } + + /// + /// Navigates to the specified module using the view path (e.g MainView,JobsView). + /// This method makes it easy to do stuff like NavigateTo(nameof(MainView),nameof(JobsView)); + /// + /// + /// The view path. + public Task NavigateTo(bool pushToHistory = true, params String[] viewPath) where T : IFSEModule + { + return NavigateTo(typeof(T), pushToHistory, viewPath); + } + + /// + /// Navigates to the specified module and view by full path (e.g Jobs.JobsView). + /// + /// The full path. + public async Task NavigateTo(String fullPath, bool pushToHistory = true, Action onNavigating = null, Action onNavigated = null) + { + try + { + String[] path = fullPath.Split('.'); + var module = _moduleLoader.UserModules.SingleOrDefault(x => x.GetType().Name == path[0] || x.Name == path[0]); + + if (module == null) + { + await _notificationProvider.ShowError("The specified module was not loaded."); + return false; + } + + if (path.Length == 1 && path[0] == CurrentModule.Name) return true; + + LogManager.Log($"Navigating to: {fullPath}..."); + + var fromVM = _currentVM; + + if (_currentVM != null && _currentVM is INavigationBlocker) + { + if (_navigating_back) + { + if (!await (_currentVM as INavigationBlocker).OnNavigateBackRequest()) + { + return false; + } + } + else + { + if (!await (_currentVM as INavigationBlocker).OnNavigateOutRequest()) + { + return false; + } + } + } + + + + if (pushToHistory && _lastFullPath != null && !_preventHistory) + { + _navigationHistory.Push(_lastFullPath); + RaisePropertyChanged(nameof(CanNavigateBack)); + } + + _lastFullPath = fullPath; + + MainView.Instance.NavigationControl.NavigateTo(NavigationView.LayoutView.ToString()); + var navigationControl = LayoutView.Instance.NavigationControl; + CurrentModule = module; + var moduleView = navigationControl.NavigateTo(module.Name); + + _currentVM = moduleView.DataContext; + + if (path.Length > 1) + { + var moduleNavigation = moduleView.FindChildOffline(); + + if (moduleNavigation != null) + { + moduleNavigation.RegisterForLoadedOrNow(async (x, e) => + { + var lastView = moduleNavigation.GetElement(path.Last()); + + if (lastView != null) + { + onNavigating?.Invoke(fromVM as FSEViewModel, lastView.DataContext as FSEViewModel); + } + + foreach (var view in path.Skip(1)) + { + await Task.Delay(100); + + FrameworkElement v = null; + + v = moduleNavigation.NavigateTo(view, () => + { + if (v != null) + { + NotifyOnNavigated(fromVM, v.DataContext); + onNavigated?.Invoke(fromVM as FSEViewModel, v.DataContext as FSEViewModel); + NotifyAwaitingVMResults(fromVM as FSEViewModel, v.DataContext as FSEViewModel); + } + }); + + NotifyOnBeforeNavigated(fromVM, v.DataContext); + + if (v != null) + { + _currentVM = v.DataContext; + + if (view != path.Last()) + { + moduleNavigation = v.FindChildOffline(); + } + } + else + { + throw LogManager.Log(new ArgumentNullException("Could not navigate to " + fullPath)); + } + } + }); + } + else + { + onNavigating?.Invoke(fromVM as FSEViewModel, _currentVM as FSEViewModel); + + NotifyOnBeforeNavigated(fromVM, _currentVM); + + await Task.Delay(navigationControl.TransitionDuration.TimeSpan); + + NotifyOnNavigated(fromVM, _currentVM); + + onNavigated?.Invoke(fromVM as FSEViewModel, _currentVM as FSEViewModel); + NotifyAwaitingVMResults(fromVM as FSEViewModel, _currentVM as FSEViewModel); + } + } + else + { + NotifyOnBeforeNavigated(fromVM, _currentVM); + + onNavigating?.Invoke(fromVM as FSEViewModel, _currentVM as FSEViewModel); + + await Task.Delay(navigationControl.TransitionDuration.TimeSpan); + + NotifyOnNavigated(fromVM, _currentVM); + + onNavigated?.Invoke(fromVM as FSEViewModel, _currentVM as FSEViewModel); + NotifyAwaitingVMResults(fromVM as FSEViewModel, _currentVM as FSEViewModel); + } + + return true; + } + catch (Exception ex) + { + await _notificationProvider.ShowError($"Error navigating to '{fullPath}'."); + return false; + } + } + + /// + /// Navigates for result. + /// + /// The type of the module. + /// The type of the view. + /// The type of the result. + /// The type of the object. + /// The object. + /// if set to true [push to history]. + /// + public async Task NavigateForResult(TObject obj, bool pushToHistory = true) + where TModule : IFSEModule + { + TaskCompletionSource source = new TaskCompletionSource(); + + var fromVM = _currentVM; + + await NavigateTo(typeof(TModule).Name + "." + typeof(TView).Name, pushToHistory, (from, to) => + { + _awaitingVMResults.Add(new AwaitingVMResult() + { + FromVM = fromVM as FSEViewModel, + ToVM = to as FSEViewModel, + Action = () => + { + if (to is INavigationResultProvider) + { + source.SetResult((to as INavigationResultProvider).GetNavigationResult()); + } + } + }); + + if (to is INavigationResultProvider) + { + (to as INavigationResultProvider).OnNavigationObjectReceived(obj); + } + }); + + return await source.Task; + } + + /// + /// Navigates to the specified module and view with the specified object. + /// + /// The type of the module. + /// The type of the view. + /// The type of the pass. + /// The object. + /// if set to true [push to history]. + /// + public Task NavigateWithObject(TPass obj, bool pushToHistory = true) where TModule : IFSEModule + { + return NavigateTo(typeof(TModule).Name + "." + typeof(TView).Name, pushToHistory, (fromVM, toVM) => + { + if (toVM is INavigationObjectReceiver) + { + (toVM as INavigationObjectReceiver).OnNavigatedToWithObject(obj); + } + }); + } + + private Task NavigateTo(Type moduleType, bool pushToHistory = true, params String[] viewPath) + { + if (viewPath != null && viewPath.Length > 0) + { + return NavigateTo(moduleType.Name + "." + String.Join(".", viewPath), pushToHistory); + } + else + { + return NavigateTo(moduleType.Name, pushToHistory); + } + } + + /// + /// Gets a value indicating whether the navigation system is able to navigate to the previous view. + /// + public bool CanNavigateBack + { + get { return _navigationHistory.Count > 0; } + } + + private bool _isBackEnabled; + /// + /// Gets a value indicating whether the back should be enabled. + /// + public bool IsBackEnabled + { + get { return _isBackEnabled; } + set { _isBackEnabled = value; RaisePropertyChangedAuto(); } + } + + /// + /// Navigates to the previous view if is true. + /// + public async Task NavigateBack() + { + LogManager.Log("Navigating back..."); + + _navigating_back = true; + + if (_navigationHistory.Count > 0) + { + String first = _navigationHistory.Pop(); + _preventHistory = true; + + if (await NavigateTo(first)) + { + RaisePropertyChanged(nameof(CanNavigateBack)); + _preventHistory = false; + _navigating_back = false; + return true; + } + else + { + _navigationHistory.Push(first); + _preventHistory = false; + _navigating_back = false; + RaisePropertyChanged(nameof(CanNavigateBack)); + return false; + } + } + else + { + await NavigateTo(NavigationView.Home); + RaisePropertyChanged(nameof(CanNavigateBack)); + _preventHistory = false; + _navigating_back = false; + return true; + } + } + + /// + /// Clears the navigation back history. + /// + public void ClearHistory() + { + LogManager.Log("Navigation history cleared."); + _navigationHistory.Clear(); + RaisePropertyChanged(nameof(CanNavigateBack)); + } + + /// + /// Clears the navigation back history except the specified view type. + /// + /// + public void ClearHistoryExcept() + { + LogManager.Log($"Navigation history cleared except for {typeof(T).Name}."); + + var history_list = _navigationHistory.ToList(); + history_list = history_list.Where(x => x.Contains(typeof(T).Name)).Distinct().ToList(); + _navigationHistory.Clear(); + + foreach (var item in history_list) + { + _navigationHistory.Push(item); + } + + RaisePropertyChanged(nameof(CanNavigateBack)); + } + + private void NotifyOnBeforeNavigated(object fromVM, object toVM) + { + if (fromVM is FSEViewModel) + { + (fromVM as FSEViewModel)?.OnBeforeNavigatedFrom(); + } + + if (toVM is FSEViewModel) + { + (toVM as FSEViewModel)?.OnBeforeNavigatedTo(); + } + } + + private void NotifyOnNavigated(object fromVM, object toVM) + { + if (fromVM is FSEViewModel) + { + (fromVM as FSEViewModel)?.OnNavigatedFrom(); + } + + if (toVM is FSEViewModel) + { + (toVM as FSEViewModel)?.OnNavigatedTo(); + (toVM as FSEViewModel)?.OnNavigatedTo(fromVM as FSEViewModel); + } + } + + private void NotifyAwaitingVMResults(FSEViewModel fromVM, FSEViewModel toVM) + { + var awaiter = _awaitingVMResults.SingleOrDefault(x => x.FromVM == toVM && x.ToVM == fromVM); + if (awaiter != null) + { + _awaitingVMResults.Remove(awaiter); + awaiter.Action(); + } + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Notifications/DefaultNotificationProvider.cs new file mode 100644 index 000000000..c3c541486 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Notifications/DefaultNotificationProvider.cs @@ -0,0 +1,547 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media; +using Tango.FSE.Common.Notifications; +using Tango.Core; +using System.Collections.Concurrent; +using System.Windows.Media.Imaging; +using Tango.SharedUI.Helpers; +using System.Timers; +using Tango.Core.Commands; +using Tango.SharedUI; +using System.Reflection; +using Tango.Core.DI; +using System.ComponentModel; +using System.Windows.Data; +using MaterialDesignThemes.Wpf; + +namespace Tango.FSE.UI.Notifications +{ + /// + /// Represents the default FSE notification provider. + /// + /// + /// + public class DefaultNotificationProvider : ExtendedObject, INotificationProvider + { + private ConcurrentQueue> _pendingMessageBoxes; + private ConcurrentQueue> _pendingDialogs; + private List _appButtons; + + private bool _notificationsVisible; + /// + /// Gets or sets a value indicating whether to allow notifications visibility. + /// + public bool NotificationsVisible + { + get { return _notificationsVisible; } + set { _notificationsVisible = value; RaisePropertyChangedAuto(); } + } + + /// + /// Gets the collection of notification items. + /// + public ObservableCollection NotificationItems { get; private set; } + + /// + /// Gets the notification items view. + /// + public ICollectionView NotificationItemsView { get; private set; } + + /// + /// Gets the collection of taskbar items. + /// + public ObservableCollection TaskBarItems { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + public DefaultNotificationProvider() + { + NotificationsVisible = true; + NotificationItems = new ObservableCollection(); + TaskBarItems = new ObservableCollection(); + _pendingMessageBoxes = new ConcurrentQueue>(); + _pendingDialogs = new ConcurrentQueue>(); + _appButtons = new List(); + + PopNotificationCommand = new RelayCommand((x) => PopNotification(x)); + + NotificationItems.EnableCrossThreadOperations(); + + NotificationItemsView = CollectionViewSource.GetDefaultView(NotificationItems); + NotificationItemsView.SortDescriptions.Add(new SortDescription(nameof(NotificationItem.Priority), ListSortDirection.Descending)); + } + + private MessageBoxVM _currentMessageBox; + /// + /// Gets the current message box if any. + /// + public MessageBoxVM CurrentMessageBox + { + get { return _currentMessageBox; } + private set + { + _currentMessageBox = value; + RaisePropertyChangedAuto(); + RaisePropertyChanged(nameof(HasMessageBox)); + } + } + + /// + /// Gets a value indicating whether a message box is available. + /// + public bool HasMessageBox + { + get + { + return CurrentMessageBox != null; + } + } + + private FrameworkElement _currentDialog; + /// + /// Gets the current dialog if any. + /// + public FrameworkElement CurrentDialog + { + get { return _currentDialog; } + private set + { + _currentDialog = value; + RaisePropertyChangedAuto(); + RaisePropertyChanged(nameof(HasDialog)); + } + } + + private AppButton _currentAppButton; + /// + /// Gets the current app button. + /// + public AppButton CurrentAppButton + { + get { return _currentAppButton; } + private set { _currentAppButton = value; RaisePropertyChangedAuto(); } + } + + /// + /// Gets a value indicating whether a dialog is available. + /// + public bool HasDialog + { + get + { + return CurrentDialog != null; + } + } + + /// + /// Shows an error message box. + /// + /// The message. + /// + public Task ShowError(string message) + { + return ShowMessageBox(new MessageBoxVM() + { + Message = message, + Title = "Error", + Type = MessageType.Error, + }); + } + /// + /// Shows an information message box. + /// + /// The message. + /// + public Task ShowInfo(string message) + { + return ShowMessageBox(new MessageBoxVM() + { + Message = message, + Title = "Information", + Type = MessageType.Info, + }); + } + + /// + /// Shows warning message box. + /// + /// The message. + /// + public Task ShowWarning(string message) + { + return ShowMessageBox(new MessageBoxVM() + { + Message = message, + Title = "Warning", + Type = MessageType.Warning, + }); + } + + /// + /// Shows a question message box. + /// + /// The message. + /// + public Task ShowQuestion(string message) + { + return ShowMessageBox(new MessageBoxVM() + { + Message = message, + Title = "Confirm", + HasCancel = true, + Type = MessageType.Info, + }); + } + + /// + /// Shows a success message box. + /// + /// The message. + /// + public Task ShowSuccess(string message) + { + return ShowMessageBox(new MessageBoxVM() + { + Message = message, + Title = "Success", + Type = MessageType.Success, + }); + } + + /// + /// Shows the message box. + /// + /// The view model. + /// + private Task ShowMessageBox(MessageBoxVM vm) + { + ReleaseGlobalBusyMessage(); + + LogManager.Log($"Displaying MessagBox '{vm.Message}'."); + + TaskCompletionSource source = new TaskCompletionSource(); + + vm.Accepted += () => { OnMessageBoxClosed(); source.SetResult(true); }; + vm.Canceled += () => { OnMessageBoxClosed(); source.SetResult(false); }; + + if (CurrentMessageBox == null) + { + CurrentMessageBox = vm; + } + else + { + _pendingMessageBoxes.Enqueue(new PendingNotification(vm, source)); + } + + return source.Task; + } + + /// + /// Called when the message box has been closed. + /// + private void OnMessageBoxClosed() + { + LogManager.Log("MessageBox closed."); + + CurrentMessageBox = null; + + if (_pendingMessageBoxes.Count > 0) + { + PendingNotification p = null; + if (_pendingMessageBoxes.TryDequeue(out p)) + { + CurrentMessageBox = p.Item; + } + } + } + + /// + /// Inserts the notification item to the bottom of the notifications collection. + /// + /// The item. + /// + public NotificationItem PushNotification(NotificationItem item) + { + LogManager.Log($"Pushing NotificationItem '{item.GetType().Name}'."); + item.RemoveAction = () => { PopNotification(item); }; + NotificationItems.Insert(0, item); + RaisePropertyChanged(nameof(HasNotificationItems)); + return item; + } + + /// + /// Pushes the notification. + /// + /// + /// + public NotificationItem PushNotification() where T : NotificationItem + { + return PushNotification(Activator.CreateInstance()); + } + + /// + /// Removed the specified notification item. + /// + /// The item. + public void PopNotification(NotificationItem item) + { + LogManager.Log($"Popping out NotificationItem '{item.GetType().Name}'."); + NotificationItems.Remove(item); + RaisePropertyChanged(nameof(HasNotificationItems)); + } + + /// + /// Gets a value indicating whether this instance has notification items. + /// + public bool HasNotificationItems + { + get + { + return NotificationItems.Count > 0; + } + } + + /// + /// Gets the pop notification command. + /// + public RelayCommand PopNotificationCommand { get; private set; } + + /// + /// Displays the specified dialog in a modal design. + /// + /// + /// The data context. + /// The view. + /// + public async Task ShowDialog(T datacontext, FrameworkElement view) where T : DialogViewVM + { + view.DataContext = datacontext; + + TangoIOC.Default.Inject(datacontext); + + view.Loaded += (_, __) => + { + view.DataContext = datacontext; + datacontext.OnShow(); + }; + + TaskCompletionSource source = new TaskCompletionSource(); + + datacontext.Accepted += () => { OnDialogClosed(); source.SetResult(datacontext); }; + datacontext.Canceled += () => { OnDialogClosed(); source.SetResult(datacontext); }; + + if (CurrentDialog == null) + { + CurrentDialog = view; + } + else + { + _pendingDialogs.Enqueue(new PendingNotification(new DialogAndView(datacontext, view), source)); + } + + var result = await source.Task; + return result as T; + } + + /// + /// Called when [dialog closed]. + /// + private void OnDialogClosed() + { + CurrentDialog = null; + + if (_pendingDialogs.Count > 0) + { + PendingNotification p = null; + if (_pendingDialogs.TryDequeue(out p)) + { + CurrentDialog = p.Item.View; + } + } + } + + /// + /// Displays the specified dialog in a modal design. + /// The notification provider will try to locate the view automatically using conventions. + /// + /// + /// The data context. + /// + public Task ShowDialog(T datacontext) where T : DialogViewVM + { + var callingAssembly = datacontext.GetType().Assembly; + String viewName = datacontext.GetType().FullName.Replace("VM", ""); + var viewType = callingAssembly.GetType(viewName); + + if (viewType == null) + { + throw new NullReferenceException("View type for " + datacontext.GetType().Name + " could not be found!"); + } + + var view = Activator.CreateInstance(viewType) as FrameworkElement; + + if (view == null) + { + throw new NullReferenceException("The view " + viewType.ToString() + " is not of type framework element."); + } + + return ShowDialog(datacontext, view); + } + + /// + /// Displays the specified dialog in a modal design. + /// The data context instance will be automatically created. + /// The notification provider will try to locate the view automatically using conventions. + /// + /// + /// + public Task ShowDialog() where T : DialogViewVM + { + return ShowDialog(Activator.CreateInstance()); + } + + /// + /// Sets the global busy message. + /// + /// The message. + public void SetGlobalBusyMessage(string message) + { + GlobalBusyMessage = message; + IsInGlobalBusyState = true; + + RaisePropertyChanged(nameof(IsInGlobalBusyState)); + RaisePropertyChanged(nameof(GlobalBusyMessage)); + } + + /// + /// Releases the global busy message. + /// + public void ReleaseGlobalBusyMessage() + { + GlobalBusyMessage = null; + IsInGlobalBusyState = false; + + RaisePropertyChanged(nameof(IsInGlobalBusyState)); + RaisePropertyChanged(nameof(GlobalBusyMessage)); + } + + /// + /// Gets the current global busy message. + /// + public string GlobalBusyMessage { get; private set; } + + /// + /// Gets a value indicating whether this instance is in global busy state. + /// + public bool IsInGlobalBusyState { get; private set; } + + private AppBarItem _currentAppBarItem; + /// + /// Gets the current application bar item. + /// + public AppBarItem CurrentAppBarItem + { + get { return _currentAppBarItem; } + set { _currentAppBarItem = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(HasAppBarItem)); } + } + + /// + /// Gets a value indicating whether this instance has application bar item. + /// + public bool HasAppBarItem + { + get { return CurrentAppBarItem != null; } + } + + /// + /// Pushes the application bar item. + /// + /// The application bar item. + /// + public AppBarItem PushAppBarItem(AppBarItem appBarItem) + { + LogManager.Log($"Pushing AppBarItem '{appBarItem.GetType().Name}'."); + CurrentAppBarItem = appBarItem; + appBarItem.RemoveAction = () => PopAppBarItem(appBarItem); + return appBarItem; + } + + /// + /// Pushes the application bar item. + /// + /// + /// + public AppBarItem PushAppBarItem() where T : AppBarItem + { + return PushAppBarItem(Activator.CreateInstance()); + } + + /// + /// Pops the application bar item. + /// + /// The application bar item. + public void PopAppBarItem(AppBarItem appBarItem) + { + LogManager.Log($"Popping out AppBarItem '{appBarItem.GetType().Name}'."); + CurrentAppBarItem = null; + } + + /// + /// Pushes the task bar item. + /// + /// The task bar item. + /// + public TaskBarItem PushTaskBarItem(TaskBarItem taskBarItem) + { + TaskBarItems.Add(taskBarItem); + return taskBarItem; + } + + /// + /// Handles the Push Task Bar Item event. + /// + /// + /// + public TaskBarItem PushTaskBarItem() where T : TaskBarItem + { + return PushTaskBarItem(Activator.CreateInstance()); + } + + /// + /// Pops the task bar item. + /// + /// + public void PopTaskBarItem(TaskBarItem taskBarItem) + { + TaskBarItems.Remove(taskBarItem); + } + + /// + /// Pushes the app button. + /// + /// The app button. + public void PushAppButton(AppButton appButton) + { + _appButtons.Insert(0, appButton); + CurrentAppButton = appButton; + } + + /// + /// Pops the app button. + /// + /// The app button. + public void PopAppButton(AppButton appButton) + { + _appButtons.RemoveAll(x => x == appButton); + + CurrentAppButton = _appButtons.FirstOrDefault(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Notifications/DialogAndView.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Notifications/DialogAndView.cs new file mode 100644 index 000000000..47d8ba762 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Notifications/DialogAndView.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using Tango.SharedUI; + +namespace Tango.FSE.UI.Notifications +{ + /// + /// Represents a dialog and view couple. + /// + public class DialogAndView + { + /// + /// Gets or sets the vm. + /// + public DialogViewVM VM { get; set; } + + /// + /// Gets or sets the view. + /// + public FrameworkElement View { get; set; } + + /// + /// Initializes a new instance of the class. + /// + public DialogAndView() + { + + } + + /// + /// Initializes a new instance of the class. + /// + /// The vm. + /// The view. + public DialogAndView(DialogViewVM vm, FrameworkElement view) : this() + { + VM = vm; + View = view; + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Notifications/PendingNotification.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Notifications/PendingNotification.cs new file mode 100644 index 000000000..8eedcd362 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Notifications/PendingNotification.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.FSE.UI.Notifications +{ + /// + /// Represents a pending notification item. + /// + /// + /// The type of the result. + public class PendingNotification + { + /// + /// Gets or sets the item. + /// + public T Item { get; set; } + + /// + /// Gets or sets the completion source. + /// + public TaskCompletionSource CompletionSource { get; set; } + + /// + /// Initializes a new instance of the class. + /// + public PendingNotification() + { + + } + + /// + /// Initializes a new instance of the class. + /// + /// The item. + /// The completion source. + public PendingNotification(T item, TaskCompletionSource completionSource) : this() + { + Item = item; + CompletionSource = completionSource; + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..1f3a92752 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango.FSE.UI")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Tango.FSE.UI")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Resources.Designer.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Resources.Designer.cs new file mode 100644 index 000000000..b9a160c5e --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.FSE.UI.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.FSE.UI.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Resources.resx b/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Settings.Designer.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Settings.Designer.cs new file mode 100644 index 000000000..dd9284a2e --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.FSE.UI.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Settings.settings b/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj new file mode 100644 index 000000000..820d20e5d --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj @@ -0,0 +1,218 @@ + + + + + Debug + AnyCPU + {26C54A4F-315D-4B79-B163-EDDDE8F93A86} + WinExe + Tango.FSE.UI + Tango.FSE.UI + v4.6.1 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + true + + + + + AnyCPU + true + full + false + ..\..\Build\FSE\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + ..\..\Build\FSE\Release\ + TRACE + prompt + 4 + + + + ..\..\packages\ControlzEx.3.0.2.4\lib\net45\ControlzEx.dll + + + ..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll + + + ..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll + + + ..\..\packages\MahApps.Metro.1.6.5\lib\net46\MahApps.Metro.dll + + + ..\..\packages\MaterialDesignColors.1.2.2\lib\net45\MaterialDesignColors.dll + + + ..\..\packages\MaterialDesignThemes.3.0.1\lib\net45\MaterialDesignThemes.Wpf.dll + + + ..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + + + + + + + ..\..\packages\ControlzEx.3.0.2.4\lib\net45\System.Windows.Interactivity.dll + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + + + + + + + + + + + + + + + LayoutView.xaml + + + LoadingView.xaml + + + LoginView.xaml + + + MainView.xaml + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + MainWindow.xaml + Code + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + {f441feee-322a-4943-b566-110e12fd3b72} + Tango.BL + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} + Tango.Logging + + + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} + Tango.Settings + + + {8491d07b-c1f6-4b62-a412-41b9fd2d6538} + Tango.SharedUI + + + {74e700b0-1156-4126-be40-ee450d3c3026} + Tango.Transport + + + {5001990f-977b-48ff-b217-0236a5022ad8} + Tango.Web + + + {8cffa4fc-f46f-475d-a270-dafbfb532bc8} + Tango.FSE.Diagnostics + + + {bc37cccb-7392-4f78-8d1c-e9629e6e046e} + Tango.FSE.Common + + + {d6f7d31d-7f8c-45e2-ae0a-fbbd1f5f9d5f} + Tango.FSE.Web + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Threading/DefaultDispatcherProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Threading/DefaultDispatcherProvider.cs new file mode 100644 index 000000000..c83041fd5 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Threading/DefaultDispatcherProvider.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Threading; +using Tango.FSE.Common.Threading; + +namespace Tango.FSE.UI.Threading +{ + /// + /// Represents the default PPC which will invoke action on the current application dispatcher. + /// + /// + public class DefaultDispatcherProvider : IDispatcherProvider + { + private Dispatcher _dispatcher; + + /// + /// Initializes a new instance of the class. + /// + /// The dispatcher. + public DefaultDispatcherProvider(Dispatcher dispatcher) + { + _dispatcher = dispatcher; + } + + /// + /// Invokes the specified action asynchronously. + /// + /// The action. + public void Invoke(Action action) + { + _dispatcher.BeginInvoke(action); + } + + /// + /// Invokes the specified action synchronously. + /// + /// The action. + public void InvokeBlock(Action action) + { + _dispatcher.Invoke(action); + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs new file mode 100644 index 000000000..c1168253d --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using Tango.Core.DI; +using Tango.FSE.Common.Authentication; +using Tango.FSE.Common.FSEApplication; +using Tango.FSE.Common.Gateway; +using Tango.FSE.Common.Modules; +using Tango.FSE.Common.Navigation; +using Tango.FSE.Common.Notifications; +using Tango.FSE.Common.Threading; +using Tango.FSE.Common.Web; +using Tango.FSE.UI.Authentication; +using Tango.FSE.UI.FSEApplication; +using Tango.FSE.UI.Gateway; +using Tango.FSE.UI.Modules; +using Tango.FSE.UI.Navigation; +using Tango.FSE.UI.Notifications; +using Tango.FSE.UI.Threading; +using Tango.FSE.UI.ViewModels; + +namespace Tango.FSE.UI +{ + public static class ViewModelLocator + { + static ViewModelLocator() + { + TangoIOC.Default.Unregister(); + TangoIOC.Default.Unregister(); + TangoIOC.Default.Unregister(); + TangoIOC.Default.Unregister(); + TangoIOC.Default.Unregister(); + TangoIOC.Default.Unregister(); + TangoIOC.Default.Unregister(); + //TangoIOC.Default.Unregister(); + TangoIOC.Default.Unregister(); + //TangoIOC.Default.Unregister(); + //TangoIOC.Default.Unregister(); + //TangoIOC.Default.Unregister(); + //TangoIOC.Default.Unregister(); + //TangoIOC.Default.Unregister(); + //TangoIOC.Default.Unregister(); + + TangoIOC.Default.Register(); + TangoIOC.Default.Register(new FSEWebClient()); + TangoIOC.Default.Register(new DefaultDispatcherProvider(Application.Current.Dispatcher)); + TangoIOC.Default.Register(); + TangoIOC.Default.Register(); + TangoIOC.Default.Register(); + TangoIOC.Default.Register(); + //TangoIOC.Default.Register(); + TangoIOC.Default.Register(); + + TangoIOC.Default.Register(); + TangoIOC.Default.Register(); + TangoIOC.Default.Register(); + TangoIOC.Default.Register(); + } + + public static MainViewVM MainViewVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } + + public static LoadingViewVM LoadingViewVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } + + public static LayoutViewVM LayoutViewVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } + + public static LoginViewVM LoginViewVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LayoutViewVM.cs new file mode 100644 index 000000000..13d2baff0 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LayoutViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.FSE.Common; + +namespace Tango.FSE.UI.ViewModels +{ + public class LayoutViewVM : FSEViewModel + { + public override void OnApplicationStarted() + { + + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LoadingViewVM.cs new file mode 100644 index 000000000..ec6042046 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LoadingViewVM.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using Tango.FSE.Common; +using Tango.FSE.Common.Gateway; +using Tango.FSE.Common.Navigation; +using Tango.MachineService.Gateway; + +namespace Tango.FSE.UI.ViewModels +{ + public class LoadingViewVM : FSEViewModel + { + public LoadingViewVM() + { + + } + + public async override void OnApplicationStarted() + { + await GatewayService.GetEnvironments(); + await NavigationManager.NavigateTo(NavigationView.LoginView); + } + + public override void OnApplicationReady() + { + + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LoginViewVM.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LoginViewVM.cs new file mode 100644 index 000000000..77b15adc4 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LoginViewVM.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.FSE.Common; +using Tango.FSE.Common.Navigation; +using Tango.MachineService.Gateway; + +namespace Tango.FSE.UI.ViewModels +{ + public class LoginViewVM : FSEViewModel + { + private String _email; + public String Email + { + get { return _email; } + set { _email = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + private String _password; + public String Password + { + get { return _password; } + set { _password = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + private EnvironmentConfiguration _selectedEnvironment; + public EnvironmentConfiguration SelectedEnvironment + { + get { return _selectedEnvironment; } + set { _selectedEnvironment = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + public RelayCommand LoginCommand { get; set; } + + public LoginViewVM() + { + LoginCommand = new RelayCommand(Login,() => Email.IsNotNullOrEmpty() && Password.IsNotNullOrEmpty() && SelectedEnvironment != null); + } + + public override void OnApplicationStarted() + { + Email = "roy@twine-s.com"; + Password = "1Creativity"; + } + + public override void OnNavigatedTo() + { + base.OnNavigatedTo(); + SelectedEnvironment = GatewayService.Environments.FirstOrDefault(); + } + + private async void Login() + { + try + { + var result = await AuthenticationProvider.Login(Email, Password, SelectedEnvironment); + + if (!result.Response.PasswordChangeRequired) + { + await NavigationManager.NavigateTo(NavigationView.Home); + } + } + catch (Exception ex) + { + await NotificationProvider.ShowError(ex.Message); + } + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/MainViewVM.cs new file mode 100644 index 000000000..4d88a8967 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/MainViewVM.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.FSE.Common; + +namespace Tango.FSE.UI.ViewModels +{ + public class MainViewVM : FSEViewModel + { + public String Text { get; set; } = "This is a simple text binding"; + + public override void OnApplicationStarted() + { + + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml new file mode 100644 index 000000000..a08123e1b --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml @@ -0,0 +1,17 @@ + + + + + + + diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml.cs new file mode 100644 index 000000000..610bcc867 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LayoutView.xaml.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.FSE.UI.Views +{ + /// + /// Interaction logic for LayoutView.xaml + /// + public partial class LayoutView : UserControl + { + public static LayoutView Instance { get; set; } + + public LayoutView() + { + Instance = this; + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LoadingView.xaml b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LoadingView.xaml new file mode 100644 index 000000000..167f78f8a --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LoadingView.xaml @@ -0,0 +1,14 @@ + + + Loading View + + diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LoadingView.xaml.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LoadingView.xaml.cs new file mode 100644 index 000000000..3dfc6e573 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LoadingView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.FSE.UI.Views +{ + /// + /// Interaction logic for LoadingView.xaml + /// + public partial class LoadingView : UserControl + { + public LoadingView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LoginView.xaml b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LoginView.xaml new file mode 100644 index 000000000..769b28021 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LoginView.xaml @@ -0,0 +1,23 @@ + + + + + + + + + + + + diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LoginView.xaml.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LoginView.xaml.cs new file mode 100644 index 000000000..7948ee473 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/LoginView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.FSE.UI.Views +{ + /// + /// Interaction logic for LoginView.xaml + /// + public partial class LoginView : UserControl + { + public LoginView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/MainView.xaml b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/MainView.xaml new file mode 100644 index 000000000..ac5cbfcf6 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/MainView.xaml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/MainView.xaml.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/MainView.xaml.cs new file mode 100644 index 000000000..c410a4fa3 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/MainView.xaml.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.FSE.UI.Views +{ + /// + /// Interaction logic for MainView.xaml + /// + public partial class MainView : UserControl + { + public static MainView Instance { get; set; } + + public MainView() + { + Instance = this; + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/packages.config b/Software/Visual_Studio/FSE/Tango.FSE.UI/packages.config new file mode 100644 index 000000000..f8d27760e --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/packages.config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/LoginRequest.cs b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/LoginRequest.cs new file mode 100644 index 000000000..6898364ae --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/LoginRequest.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Transport.Web; + +namespace Tango.FSE.Web.Messages +{ + public class LoginRequest : WebRequestMessage + { + public String Version { get; set; } + public String Email { get; set; } + public String Password { get; set; } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/LoginResponse.cs b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/LoginResponse.cs new file mode 100644 index 000000000..83fd59439 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Web/Messages/LoginResponse.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.Web.Security; + +namespace Tango.FSE.Web.Messages +{ + public class LoginResponse : WebTokenResponse + { + 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/FSE/Tango.FSE.Web/Properties/AssemblyInfo.cs b/Software/Visual_Studio/FSE/Tango.FSE.Web/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..4a8bdfddc --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Web/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango.FSE.Web")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Tango.FSE.Web")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("d6f7d31d-7f8c-45e2-ae0a-fbbd1f5f9d5f")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Web/Tango.FSE.Web.csproj b/Software/Visual_Studio/FSE/Tango.FSE.Web/Tango.FSE.Web.csproj new file mode 100644 index 000000000..166162caf --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Web/Tango.FSE.Web.csproj @@ -0,0 +1,63 @@ + + + + + Debug + AnyCPU + {D6F7D31D-7F8C-45E2-AE0A-FBBD1F5F9D5F} + Library + Properties + Tango.FSE.Web + Tango.FSE.Web + v4.6.1 + 512 + true + + + true + full + false + ..\..\Build\FSE\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\Build\FSE\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + {A34EE0F0-649D-41C8-8489-B6F1CC6924EE} + Tango.Core + + + {74E700B0-1156-4126-BE40-EE450D3C3026} + Tango.Transport + + + {5001990F-977B-48FF-B217-0236A5022AD8} + Tango.Web + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/Installers/Nswag/NSwagStudio.msi b/Software/Visual_Studio/Installers/Nswag/NSwagStudio.msi new file mode 100644 index 000000000..3cab2e601 Binary files /dev/null and b/Software/Visual_Studio/Installers/Nswag/NSwagStudio.msi differ 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 2df984c7c..d07f75dbd 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 @@ -430,4 +430,8 @@ + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/Notes/Tango.Notes/Nswag/Pre-Build Example.txt b/Software/Visual_Studio/Notes/Tango.Notes/Nswag/Pre-Build Example.txt new file mode 100644 index 000000000..eb9849fba --- /dev/null +++ b/Software/Visual_Studio/Notes/Tango.Notes/Nswag/Pre-Build Example.txt @@ -0,0 +1 @@ +nswag run "$(SolutionDir)Web\Tango.MachineService.Gateway\Nswag\GatewayClient.nswag" /variables:assembly="$(SolutionDir)Web\Tango.MachineService.Gateway\bin\Tango.MachineService.Gateway.dll",output="$(ProjectDir)Gateway\GatewayClient.cs" \ No newline at end of file diff --git a/Software/Visual_Studio/Notes/Tango.Notes/Tango.Notes.csproj b/Software/Visual_Studio/Notes/Tango.Notes/Tango.Notes.csproj index e95fe1069..023a4bc69 100644 --- a/Software/Visual_Studio/Notes/Tango.Notes/Tango.Notes.csproj +++ b/Software/Visual_Studio/Notes/Tango.Notes/Tango.Notes.csproj @@ -49,6 +49,7 @@ + @@ -60,7 +61,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Modules/DefaultPPCModuleLoader.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Modules/DefaultPPCModuleLoader.cs new file mode 100644 index 000000000..375b648d0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Modules/DefaultPPCModuleLoader.cs @@ -0,0 +1,152 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.BL.Entities; +using Tango.Logging; +using Tango.PPC.Common.Authentication; +using Tango.PPC.Common.Modules; +using Tango.PPC.Common; +using Tango.PPC.Jobs; +using System.Windows.Data; +using Tango.Core.DI; + +namespace Tango.PPC.UI.Modules +{ + /// + /// Represents the default PPC . + /// + /// + /// + public class DefaultPPCModuleLoader : ExtendedObject, IPPCModuleLoader + { + private static object _syncObject = new object(); + private IAuthenticationProvider _authenticationProvider; + private bool _loaded; + + /// + /// Occurs when the user has logged in and user modules are loaded. + /// + public event EventHandler ModulesLoaded; + + /// + /// Initializes a new instance of the class. + /// + /// The authentication provider. + public DefaultPPCModuleLoader(IAuthenticationProvider authenticationProvider) + { + _authenticationProvider = authenticationProvider; + AllModules = new ObservableCollection(); + UserModules = new ObservableCollection(); + + BindingOperations.EnableCollectionSynchronization(UserModules, _syncObject); + + _authenticationProvider.CurrentUserChanged += _authenticationProvider_CurrentUserChanged; + } + + /// + /// Handles the authentication provider user changed event. + /// + /// The sender. + /// The e. + private void _authenticationProvider_CurrentUserChanged(object sender, User e) + { + LoadModules(); + } + + private ObservableCollection _allModules; + /// + /// Gets all loaded modules. + /// + public ObservableCollection AllModules + { + get { return _allModules; } + private set { _allModules = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection _userModules; + /// + /// Gets all the user permitted modules. + /// + public ObservableCollection UserModules + { + get { return _userModules; } + private set { _userModules = value; RaisePropertyChangedAuto(); } + } + + /// + /// Loads all available PPC modules. + /// + public void LoadModules() + { + if (!_loaded) + { + //Preloaded + LogManager.Log(String.Format("Loading module '{0}'...", nameof(JobsModule))); + AllModules.Add(new JobsModule()); + //Preloaded + + AllModules.Clear(); + string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + + foreach (var file in Directory.GetFiles(assemblyFolder, "*.dll").Where(x => x.Contains("Tango.PPC"))) + { + try + { + Assembly moduleAssembly = null; + moduleAssembly = Assembly.LoadFrom(file); + + if (moduleAssembly != null) + { + foreach (var moduleType in moduleAssembly.GetLoadableTypes().Where(x => !x.IsInterface && typeof(IPPCModule).IsAssignableFrom(x) && !x.IsAbstract)) + { + if (!AllModules.ToList().Exists(x => x.GetType() == moduleType)) + { + try + { + LogManager.Log(String.Format("Loading module '{0}'...", moduleType.Name)); + var module = Activator.CreateInstance(moduleType) as IPPCModule; + AllModules.Add(module); + } + catch (Exception ex) + { + LogManager.Log(ex, "Could not load module " + moduleType.Name); + } + } + } + } + } + catch { } + } + + _loaded = true; + } + + AllModules = AllModules.OrderBy(x => x.GetType().GetCustomAttribute().Index).ToObservableCollection(); + + UserModules.Clear(); + + if (_authenticationProvider.CurrentUser != null) + { + UserModules = AllModules.Where(x => _authenticationProvider.CurrentUser.HasPermission(x.Permission)).ToObservableCollection(); + } + + ModulesLoaded?.Invoke(this, new EventArgs()); + } + + /// + /// Gets the PPC module of type T if loaded. + /// + /// + /// + public T GetPPCModule() where T : IPPCModule + { + return UserModules.OfType().FirstOrDefault(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Modules/DefaultStudioModuleLoader.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Modules/DefaultStudioModuleLoader.cs deleted file mode 100644 index 375b648d0..000000000 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Modules/DefaultStudioModuleLoader.cs +++ /dev/null @@ -1,152 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using Tango.Core; -using Tango.BL.Entities; -using Tango.Logging; -using Tango.PPC.Common.Authentication; -using Tango.PPC.Common.Modules; -using Tango.PPC.Common; -using Tango.PPC.Jobs; -using System.Windows.Data; -using Tango.Core.DI; - -namespace Tango.PPC.UI.Modules -{ - /// - /// Represents the default PPC . - /// - /// - /// - public class DefaultPPCModuleLoader : ExtendedObject, IPPCModuleLoader - { - private static object _syncObject = new object(); - private IAuthenticationProvider _authenticationProvider; - private bool _loaded; - - /// - /// Occurs when the user has logged in and user modules are loaded. - /// - public event EventHandler ModulesLoaded; - - /// - /// Initializes a new instance of the class. - /// - /// The authentication provider. - public DefaultPPCModuleLoader(IAuthenticationProvider authenticationProvider) - { - _authenticationProvider = authenticationProvider; - AllModules = new ObservableCollection(); - UserModules = new ObservableCollection(); - - BindingOperations.EnableCollectionSynchronization(UserModules, _syncObject); - - _authenticationProvider.CurrentUserChanged += _authenticationProvider_CurrentUserChanged; - } - - /// - /// Handles the authentication provider user changed event. - /// - /// The sender. - /// The e. - private void _authenticationProvider_CurrentUserChanged(object sender, User e) - { - LoadModules(); - } - - private ObservableCollection _allModules; - /// - /// Gets all loaded modules. - /// - public ObservableCollection AllModules - { - get { return _allModules; } - private set { _allModules = value; RaisePropertyChangedAuto(); } - } - - private ObservableCollection _userModules; - /// - /// Gets all the user permitted modules. - /// - public ObservableCollection UserModules - { - get { return _userModules; } - private set { _userModules = value; RaisePropertyChangedAuto(); } - } - - /// - /// Loads all available PPC modules. - /// - public void LoadModules() - { - if (!_loaded) - { - //Preloaded - LogManager.Log(String.Format("Loading module '{0}'...", nameof(JobsModule))); - AllModules.Add(new JobsModule()); - //Preloaded - - AllModules.Clear(); - string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - - foreach (var file in Directory.GetFiles(assemblyFolder, "*.dll").Where(x => x.Contains("Tango.PPC"))) - { - try - { - Assembly moduleAssembly = null; - moduleAssembly = Assembly.LoadFrom(file); - - if (moduleAssembly != null) - { - foreach (var moduleType in moduleAssembly.GetLoadableTypes().Where(x => !x.IsInterface && typeof(IPPCModule).IsAssignableFrom(x) && !x.IsAbstract)) - { - if (!AllModules.ToList().Exists(x => x.GetType() == moduleType)) - { - try - { - LogManager.Log(String.Format("Loading module '{0}'...", moduleType.Name)); - var module = Activator.CreateInstance(moduleType) as IPPCModule; - AllModules.Add(module); - } - catch (Exception ex) - { - LogManager.Log(ex, "Could not load module " + moduleType.Name); - } - } - } - } - } - catch { } - } - - _loaded = true; - } - - AllModules = AllModules.OrderBy(x => x.GetType().GetCustomAttribute().Index).ToObservableCollection(); - - UserModules.Clear(); - - if (_authenticationProvider.CurrentUser != null) - { - UserModules = AllModules.Where(x => _authenticationProvider.CurrentUser.HasPermission(x.Permission)).ToObservableCollection(); - } - - ModulesLoaded?.Invoke(this, new EventArgs()); - } - - /// - /// Gets the PPC module of type T if loaded. - /// - /// - /// - public T GetPPCModule() where T : IPPCModule - { - return UserModules.OfType().FirstOrDefault(); - } - } -} 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 467b68d8b..f06109584 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 @@ -162,7 +162,7 @@ - + @@ -693,7 +693,7 @@ if $(ConfigurationName) == Debug copy /Y "$(TargetDir)Packages" "$(TargetDir)" - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj b/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj index 4c2793367..41413f4bd 100644 --- a/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj +++ b/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj @@ -90,6 +90,7 @@ + @@ -125,11 +126,12 @@ + - + + + +
+ - - - + - - - - @@ -104,4 +102,13 @@ - + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/Web/Tango.MachineService.Gateway/packages.config b/Software/Visual_Studio/Web/Tango.MachineService.Gateway/packages.config index 8f284e11d..72f15dbf6 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService.Gateway/packages.config +++ b/Software/Visual_Studio/Web/Tango.MachineService.Gateway/packages.config @@ -2,6 +2,7 @@ + diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEController.cs new file mode 100644 index 000000000..abcd1c41f --- /dev/null +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/FSEController.cs @@ -0,0 +1,113 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Security.Authentication; +using System.Web.Http; +using Tango.BL.Builders; +using Tango.BL.Entities; +using Tango.Core; +using Tango.Core.Cryptography; +using Tango.FSE.Web.Messages; +using Tango.Web.Controllers; +using Tango.Web.Helpers; +using Tango.Web.Security; +using Tango.Web.SQLServer; + +namespace Tango.MachineService.Controllers +{ + public class FSEController : TangoController + { + public class TokenObject + { + public String UserGuid { get; set; } + } + + /// + /// Login to the service. + /// + /// The request. + /// + /// + [HttpPost] + public LoginResponse Login(LoginRequest request) + { + User user = null; + DataSource dataSource = null; + IHashGenerator hash = new BasicHashGenerator(); + + Version client_version; + + if (!Version.TryParse(request.Version, out client_version)) + { + client_version = new Version("1.0.0.0"); + } + + bool versionChangeRequired = false; + String requiredVersion = null; + + var password = hash.Encrypt(request.Password); + + using (var db = ObservablesContextHelper.CreateContext()) + { + user = new UserBuilder(db).Set(x => x.Email.ToLower() == request.Email.ToLower() && x.Password == password).WithRolesAndPermissions().WithDeleted().Build(); + + if (user == null) + { + throw new AuthenticationException("Invalid email or password."); + } + + if (user.Deleted) + { + throw new AuthenticationException("Your account has been disabled. Please contact your administrator."); + } + + user.LastLogin = DateTime.UtcNow; + db.SaveChanges(); + } + + SQLServerManager sqlServer = new SQLServerManager(); + var accessToken = sqlServer.GetAccessToken(); + + dataSource = new DataSource() + { + Address = MachineServiceConfig.DB_ADDRESS, + Catalog = MachineServiceConfig.DB_CATALOG, + Type = DataSourceType.AccessToken, + IntegratedSecurity = false, + AccessToken = accessToken.AccessToken, + AccessTokenExpiration = accessToken.ExpiresOn.UtcDateTime + }; + + + //Enforce Machine Studio Version ? + //if (MachineServiceConfig.ENFORCE_MACHINE_STUDIO_VERSION) + //{ + // using (var db = ObservablesContextHelper.CreateContext()) + // { + // var latest_version = db.MachineStudioVersions.ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); + + // if (latest_version != null && Version.Parse(latest_version.Version) != client_version) + // { + // versionChangeRequired = true; + // requiredVersion = latest_version.Version; + // } + // } + //} + + //Return data source + return new LoginResponse() + { + DataSource = dataSource, + AccessToken = WebToken.CreateNew(MachineServiceConfig.JWT_TOKEN_SECRET, new TokenObject() + { + UserGuid = user.Guid, + }, DateTime.UtcNow.AddDays(1)).AccessToken, + VersionChangeRequired = versionChangeRequired, + RequiredVersion = requiredVersion, + PasswordChangeRequired = user.PasswordChangeRequired + }; + } + } +} diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs index 1be2a5de8..f508fea15 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs @@ -89,7 +89,7 @@ namespace Tango.MachineService.Controllers String comments = String.Join(Environment.NewLine, versions.OrderBy(x => Version.Parse(x.Version)).Where(x => Version.Parse(x.Version) > currentVersion).Select(x => x.Comments)); - if (latestVersion != null && Version.Parse(latestVersion.Version) > currentVersion) + if (latestVersion != null && Version.Parse(latestVersion.Version) != currentVersion) { var manager = new BlobStorageManager(); var container = manager.GetContainer(MachineServiceConfig.MACHINE_STUDIO_VERSIONS_CONTAINER); diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index 6ac2e3657..b132a4c48 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -317,7 +317,7 @@ namespace Tango.MachineService.Controllers var latest_machine_version = db.TangoVersions.Where(x => x.MachineVersionGuid == machine_version.Guid).ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); - if (Version.Parse(latest_machine_version.Version) > Version.Parse(request.Version)) + if (Version.Parse(latest_machine_version.Version) != Version.Parse(request.Version)) { response.IsUpdateAvailable = true; } diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj b/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj index e916f01e6..a05fee42f 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj +++ b/Software/Visual_Studio/Web/Tango.MachineService/Tango.MachineService.csproj @@ -306,6 +306,7 @@ + @@ -372,6 +373,10 @@ + + {d6f7d31d-7f8c-45e2-ae0a-fbbd1f5f9d5f} + Tango.FSE.Web + {CB0B0AA2-BB24-4BCA-A720-45E397684E12} Tango.MachineStudio.Common @@ -456,7 +461,7 @@ False - + -- cgit v1.3.1