aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels
diff options
context:
space:
mode:
authorRoy Ben Shabat <roy.mail.net@gmail.com>2025-10-19 16:20:01 +0300
committerRoy Ben Shabat <roy.mail.net@gmail.com>2025-10-19 16:20:01 +0300
commit72fc39f873de467c1431d928bce4d39442205691 (patch)
treefc92559db7b57bb44606e040cd8ed4bd34494256 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels
parent22ddd9e0b6efe5aef685c7fc9886e3d93cb350c0 (diff)
downloadTango-72fc39f873de467c1431d928bce4d39442205691.tar.gz
Tango-72fc39f873de467c1431d928bce4d39442205691.zip
MS LITE
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs24
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs49
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs18
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs41
4 files changed, 109 insertions, 23 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs
index e55d0534e..05181fd3f 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs
@@ -21,6 +21,7 @@ using Tango.MachineStudio.Common.Web;
using Tango.Core.DI;
using Tango.Settings;
using Tango.Core;
+using Tango.MachineStudio.Common.Buid;
namespace Tango.MachineStudio.UI.ViewModels
{
@@ -35,6 +36,7 @@ namespace Tango.MachineStudio.UI.ViewModels
private INavigationManager _navigationManager;
private IStudioModuleLoader _studioModuleLoader;
private IEventLogger _eventLogger;
+ private IBuildProvider _buildProvider;
private LogManager logManager = LogManager.Default;
public IStudioApplicationManager ApplicationManager { get; set; }
@@ -58,7 +60,7 @@ namespace Tango.MachineStudio.UI.ViewModels
/// <param name="navigationManager">The navigation manager.</param>
/// <param name="studioModuleLoader">The studio module loader.</param>
/// <param name="notificationProvider">The notification provider.</param>
- public LoadingViewVM(IStudioApplicationManager applicationManager, INavigationManager navigationManager, IStudioModuleLoader studioModuleLoader, INotificationProvider notificationProvider, IEventLogger eventLogger, TeamFoundationServiceExtendedClient teamFoundationClient)
+ public LoadingViewVM(IBuildProvider buildProvider, IStudioApplicationManager applicationManager, INavigationManager navigationManager, IStudioModuleLoader studioModuleLoader, INotificationProvider notificationProvider, IEventLogger eventLogger, TeamFoundationServiceExtendedClient teamFoundationClient)
{
Status = "Loading, please wait...";
_tfs = teamFoundationClient;
@@ -67,6 +69,7 @@ namespace Tango.MachineStudio.UI.ViewModels
_navigationManager = navigationManager;
_studioModuleLoader = studioModuleLoader;
_notificationProvider = notificationProvider;
+ _buildProvider = buildProvider;
}
/// <summary>
@@ -89,15 +92,18 @@ namespace Tango.MachineStudio.UI.ViewModels
{
try
{
- try
+ if (_buildProvider.BuildType == MSBuildType.Default)
{
- Status = "Connecting to Team Foundation Services...";
- _tfs.Initialize();
- Thread.Sleep(500);
- }
- catch (Exception ex)
- {
- LogManager.Log(ex, "Could not initialize Team Foundation Service client.");
+ try
+ {
+ Status = "Connecting to Team Foundation Services...";
+ _tfs.Initialize();
+ Thread.Sleep(500);
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Could not initialize Team Foundation Service client.");
+ }
}
Status = "Loading, please wait...";
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs
index 7fa79984b..e7a32d107 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs
@@ -25,6 +25,8 @@ using Tango.Web;
using SimpleValidator.Extensions;
using Tango.BL.Entities;
using System.Data.Entity;
+using Tango.MachineStudio.Common.Buid;
+using System.Diagnostics;
namespace Tango.MachineStudio.UI.ViewModels
{
@@ -42,6 +44,7 @@ namespace Tango.MachineStudio.UI.ViewModels
private MachineStudioSettings _settings;
private MachineStudioWebClient _machineStudioWebClient;
private TaskCompletionSource<object> _updatePasswordCompletionSource;
+ private IBuildProvider _buildProvider;
private String _email;
/// <summary>
@@ -66,6 +69,17 @@ namespace Tango.MachineStudio.UI.ViewModels
set { _password = value; RaisePropertyChangedAuto(); }
}
+ private String _serialNumber;
+ /// <summary>
+ /// Gets or sets the password.
+ /// </summary>
+ [Required(ErrorMessage = "Serial Number is required")]
+ public String SerialNumber
+ {
+ get { return _serialNumber; }
+ set { _serialNumber = value; RaisePropertyChangedAuto(); }
+ }
+
private DeploymentSlot _deploymentSlot;
/// <summary>
/// Gets or sets the deployment slot.
@@ -156,6 +170,8 @@ namespace Tango.MachineStudio.UI.ViewModels
set { _newPassword2 = value; RaisePropertyChangedAuto(); }
}
+ public List<DeploymentSlot> Environments { get; set; }
+
/// <summary>
/// Gets or sets the login command.
/// </summary>
@@ -172,24 +188,42 @@ namespace Tango.MachineStudio.UI.ViewModels
/// <param name="authenticationProvider">The authentication provider.</param>
/// <param name="navigationManager">The navigation manager.</param>
/// <param name="notificationProvider">The notification provider.</param>
- public LoginViewVM(MachineStudioWebClient machineStudioWebClient, IAuthenticationProvider authenticationProvider, INavigationManager navigationManager, INotificationProvider notificationProvider, IEventLogger eventLogger)
+ public LoginViewVM(IBuildProvider buildProvider, MachineStudioWebClient machineStudioWebClient, IAuthenticationProvider authenticationProvider, INavigationManager navigationManager, INotificationProvider notificationProvider, IEventLogger eventLogger)
{
EnableSlotSelection = true;
ShowLoggingDetails = true;
_machineStudioWebClient = machineStudioWebClient;
+ _buildProvider = buildProvider;
_settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>();
+ if (_buildProvider.BuildType == MSBuildType.Default)
+ {
+ Environments = Enum.GetValues(typeof(DeploymentSlot)).Cast<DeploymentSlot>().ToList();
+ }
+ else
+ {
+ Environments = new List<DeploymentSlot>();
+
+ Environments.Add(DeploymentSlot.DEV);
+ Environments.Add(DeploymentSlot.TEST);
+ Environments.Add(DeploymentSlot.BETA);
+ Environments.Add(DeploymentSlot.PROD);
+ }
+
_notificationProvider = notificationProvider;
_navigationManager = navigationManager;
_authenticationProvider = authenticationProvider;
+ _buildProvider = buildProvider;
_eventLogger = eventLogger;
LoginCommand = new RelayCommand(Login, () => !IsLogging);
UpdatePasswordCommand = new RelayCommand(UpdatePassword, () => IsChangingPassword);
cryptographer = new Rfc2898Cryptographer();
Email = _settings.LastLoginEmail;
+ SerialNumber = _settings.LastLoginSerialNumber;
DeploymentSlot = _settings.DeploymentSlot;
+
RememberMe = _settings.RememberMe;
if (_settings.LastLoginMethod == LoginMethod.ActiveDirectory)
@@ -201,6 +235,12 @@ namespace Tango.MachineStudio.UI.ViewModels
IsStandardUser = true;
}
+ if (_buildProvider.BuildType == MSBuildType.Lite)
+ {
+ IsStandardUser = true;
+ }
+
+
try
{
Password = cryptographer.Decrypt(_settings.LastLoginPassword);
@@ -236,7 +276,7 @@ namespace Tango.MachineStudio.UI.ViewModels
LoginResponse result = _authenticationProvider.Login(Email, Password, loginMethod, _settings.ByPassEnvironmentVersionCheck, (progress) =>
{
ProgressLog = progress;
- }).Response;
+ }, SerialNumber).Response;
if (result.VersionChangeRequired && !_settings.ByPassEnvironmentVersionCheck)
{
@@ -271,6 +311,7 @@ namespace Tango.MachineStudio.UI.ViewModels
_settings.RememberMe = RememberMe;
_settings.LastLoginMethod = loginMethod;
_settings.LastLoginPassword = RememberMe ? cryptographer.Encrypt(Password) : null;
+ _settings.LastLoginSerialNumber = SerialNumber;
_settings.Save();
EnableSlotSelection = false;
@@ -280,11 +321,11 @@ namespace Tango.MachineStudio.UI.ViewModels
IsChangingPassword = false;
InvalidateRelayCommands();
- InvokeUI(() =>
+ InvokeUI(() =>
{
MainWindow.Instance.Title += $" - {_settings.DeploymentSlot}";
});
-
+
});
}
catch (Exception ex)
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs
index 511733984..04e645afd 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs
@@ -9,6 +9,7 @@ using Tango.Emulations.ExternalBridge;
using Tango.Integration.ExternalBridge;
using Tango.MachineStudio.Common;
using Tango.MachineStudio.Common.Authentication;
+using Tango.MachineStudio.Common.Buid;
using Tango.MachineStudio.Common.Notifications;
using Tango.Settings;
using Tango.SharedUI;
@@ -67,7 +68,18 @@ namespace Tango.MachineStudio.UI.ViewModels
{
var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>();
_scanner = new ExternalBridgeScanner();
+
_scanner.SignalRConfiguration.Enabled = settings.EnableExternalBridgeSignalR;
+
+ var buildProvider = TangoIOC.Default.GetInstance<IBuildProvider>();
+
+ if (buildProvider.BuildType == MSBuildType.Lite)
+ {
+ _scanner.SignalRConfiguration.Enabled = false;
+ var authProvider = TangoIOC.Default.GetInstance<IAuthenticationProvider>();
+ _scanner.KnownMachines = new List<BL.Entities.Machine>() { authProvider.Machine };
+ }
+
if (App.StartupArgs.Contains("-webDebug"))
{
_scanner.SignalRConfiguration.Address = "http://localhost:1111/"; //settings.DeploymentSlot.ToAddress();
@@ -115,10 +127,12 @@ namespace Tango.MachineStudio.UI.ViewModels
try
{
+ var buildProvider = TangoIOC.Default.GetInstance<IBuildProvider>();
+
_scanner.AvailableMachines.Clear();
- _scanner.SignalRConfiguration.Enabled = !TangoIOC.Default.GetInstance<IAuthenticationProvider>().CurrentUser.PreventRemoteMachineAccess;
+ _scanner.SignalRConfiguration.Enabled = !TangoIOC.Default.GetInstance<IAuthenticationProvider>().CurrentUser.PreventRemoteMachineAccess && buildProvider.BuildType == MSBuildType.Default;
- if (SettingsManager.Default.GetOrCreate<MachineStudioSettings>().UseExternalBridgeEmulator)
+ if (SettingsManager.Default.GetOrCreate<MachineStudioSettings>().UseExternalBridgeEmulator && buildProvider.BuildType == MSBuildType.Default)
{
if (_emulator != null)
{
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
index 5ba726700..c4ee5a4b1 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
@@ -21,6 +21,7 @@ using Tango.Integration.ExternalBridge;
using Tango.Logging;
using Tango.MachineStudio.Common;
using Tango.MachineStudio.Common.Authentication;
+using Tango.MachineStudio.Common.Buid;
using Tango.MachineStudio.Common.Diagnostics;
using Tango.MachineStudio.Common.EventLogging;
using Tango.MachineStudio.Common.Messages;
@@ -61,6 +62,7 @@ namespace Tango.MachineStudio.UI.ViewModels
private IExternalBridgeClient _reconnectionMachine;
private MachineLoginViewVM _reconnectionMachineConfig;
private bool _lastUploadHardwareConfigLocal;
+ private IBuildProvider _buildProvider;
/// <summary>
/// Gets or sets the current loaded module.
@@ -293,7 +295,8 @@ namespace Tango.MachineStudio.UI.ViewModels
IDiagnosticsFrameProvider frameProvider,
ISpeechProvider speechProvider,
TeamFoundationServiceExtendedClient tfs,
- MachineStudioWebClient machineStudioWebClient) : base()
+ MachineStudioWebClient machineStudioWebClient,
+ IBuildProvider buildProvider) : base()
{
_machineStudioWebClient = machineStudioWebClient;
TFSClient = tfs;
@@ -305,6 +308,7 @@ namespace Tango.MachineStudio.UI.ViewModels
ApplicationManager = applicationManager;
DiagnosticsFrameProvider = frameProvider;
SpeechProvider = speechProvider;
+ _buildProvider = buildProvider;
_settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>();
@@ -378,6 +382,8 @@ namespace Tango.MachineStudio.UI.ViewModels
private void UpdateCheckThreadMethod()
{
+ if (_buildProvider.BuildType == MSBuildType.Lite) return; //Manual Update: TODO: Implement update through machine service
+
while (!DisableCheckForUpdates)
{
Thread.Sleep(TimeSpan.FromMinutes(0.2));
@@ -495,13 +501,20 @@ namespace Tango.MachineStudio.UI.ViewModels
}
else
{
- _notificationProvider.ShowModalDialog<MachineSerialViewVM>(async (vm) =>
+ if (_buildProvider.BuildType == MSBuildType.Lite)
+ {
+ await ConnectToMachineLocal(x.SelectedMachine, AuthenticationProvider.Machine, x.UploadHardwareConfiguration);
+ }
+ else
{
- if (vm.SelectedMachine != null)
+ _notificationProvider.ShowModalDialog<MachineSerialViewVM>(async (vm) =>
{
- await ConnectToMachineLocal(x.SelectedMachine, vm.SelectedMachine, x.UploadHardwareConfiguration);
- }
- });
+ if (vm.SelectedMachine != null)
+ {
+ await ConnectToMachineLocal(x.SelectedMachine, vm.SelectedMachine, x.UploadHardwareConfiguration);
+ }
+ });
+ }
}
base.InvalidateRelayCommands();
@@ -979,9 +992,21 @@ namespace Tango.MachineStudio.UI.ViewModels
}
}
- if (settings.LastMainModuleName != null)
+ if (_buildProvider.BuildType == MSBuildType.Default)
+ {
+ if (settings.LastMainModuleName != null)
+ {
+ var m = StudioModuleLoader.UserModules.SingleOrDefault(x => x.Name == settings.LastMainModuleName);
+
+ if (m != null)
+ {
+ StartModule(m);
+ }
+ }
+ }
+ else
{
- var m = StudioModuleLoader.UserModules.SingleOrDefault(x => x.Name == settings.LastMainModuleName);
+ var m = StudioModuleLoader.UserModules.SingleOrDefault(x => x.Name == "Research");
if (m != null)
{