diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2020-01-27 09:19:11 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2020-01-27 09:19:11 +0200 |
| commit | ddda6089bff56e80703c8d2dce297919edc58bf1 (patch) | |
| tree | 7702c5cf169124d522eacc7f1a9e0878373baedd /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI | |
| parent | 1d4d327571d4c0c9f4e17411551bd4dae1e2aed0 (diff) | |
| parent | bf2f3245339b9fd9148a2ad25b5ba3320e970cc1 (diff) | |
| download | Tango-ddda6089bff56e80703c8d2dce297919edc58bf1.tar.gz Tango-ddda6089bff56e80703c8d2dce297919edc58bf1.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
53 files changed, 957 insertions, 237 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs index 8309500b7..e51247337 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs @@ -23,18 +23,20 @@ using Tango.MachineStudio.UI.Views; using Tango.MachineStudio.Common; using Tango.Core; using Tango.BL; +using Tango.Integration.Operation; +using System.Net; namespace Tango.MachineStudio.UI { /// <summary> /// Interaction logic for App.xaml /// </summary> - public partial class App : Application + public partial class App : Application { private WpfGlobalExceptionTrapper exceptionTrapper; private LogManager LogManager = LogManager.Default; - public static String[] StartupArgs { get; set; } + public static String[] StartupArgs { get; set; } = Environment.GetCommandLineArgs().Skip(1).ToArray(); protected override void OnStartup(StartupEventArgs e) { @@ -61,7 +63,14 @@ namespace Tango.MachineStudio.UI #if DEBUG LogManager.RegisterLogger(new VSOutputLogger()); #endif - LogManager.RegisterLogger(new FileLogger()); + LogManager.RegisterLogger(new FileLogger() { EnableAutoLogRemoval = true, EnableMaxFileSizeLimit = true }); + + var operatorLogger = MachineOperator.EmbeddedLogManager.RegisteredLoggers.SingleOrDefault(x => x is FileLogger) as FileLogger; + if (operatorLogger != null) + { + operatorLogger.EnableAutoLogRemoval = true; + operatorLogger.EnableMaxFileSizeLimit = true; + } LogManager.Log("Application Started..."); @@ -89,7 +98,15 @@ namespace Tango.MachineStudio.UI exceptionTrapper.Initialize(this); exceptionTrapper.ApplicationCrashed += ExceptionTrapper_ApplicationCrashed; - //Apply Caching + ApplyEFCacheSettings(); + + WebRequest.DefaultWebProxy = null; + } + + private void ApplyEFCacheSettings() + { + var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); + if (settings.CachingMode != ObservablesContextInMemoryCachingMode.None) { LogManager.Log("EF Caching is enabled."); @@ -108,9 +125,7 @@ namespace Tango.MachineStudio.UI { LogManager.Log("EF Caching is disabled"); } - } - #region Global Exception Trapping @@ -132,6 +147,13 @@ namespace Tango.MachineStudio.UI } catch { } + if (e.Exception.ToString().Contains("A Task's exception(s) were not observed")) + { + e.TryRecover = true; + LogManager.Log("Task not observed exception. Ignoring..."); + return; + } + try { var eventLogger = TangoIOC.Default.GetInstance<IEventLogger>(); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs index 7fe1ae36a..26938b203 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs @@ -18,6 +18,7 @@ using Tango.Core.Helpers; using Tango.MachineStudio.Common.Web; using Tango.BL.Builders; using System.Data.Entity.Core; +using System.Windows.Threading; namespace Tango.MachineStudio.UI.Authentication { @@ -29,6 +30,7 @@ namespace Tango.MachineStudio.UI.Authentication public class DefaultAuthenticationProvider : ExtendedObject, IAuthenticationProvider { private MachineStudioWebClient _client; + private DispatcherTimer _refreshTokenTimer; private User _currentUser; /// <summary> @@ -57,6 +59,28 @@ namespace Tango.MachineStudio.UI.Authentication public DefaultAuthenticationProvider(MachineStudioWebClient machineStudioWebClient) { _client = machineStudioWebClient; + + _refreshTokenTimer = new DispatcherTimer(); + _refreshTokenTimer.Interval = TimeSpan.FromMinutes(30); + _refreshTokenTimer.Tick += _refreshTokenTimer_Tick; + _refreshTokenTimer.Stop(); + } + + private async void _refreshTokenTimer_Tick(object sender, EventArgs e) + { + if (ObservablesContext.GetActualDataSource().Type == DataSourceType.AccessToken) + { + try + { + LogManager.Log("Refreshing database access token..."); + var response = await _client.RefreshToken(new RefreshTokenRequest()); + ObservablesContext.UpdateAccessToken(response.AccessToken, response.Expiration); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error occurred while trying to refresh the database access token."); + } + } } /// <summary> @@ -66,11 +90,16 @@ namespace Tango.MachineStudio.UI.Authentication /// <param name="password">The password.</param> /// <returns></returns> /// <exception cref="AuthenticationException">Login failed for user " + email</exception> - public AuthenticationLoginResult Login(string email, string password, bool bypassVersionCheck = false) + public AuthenticationLoginResult Login(string email, string password, LoginMethod method, bool bypassVersionCheck = false, Action<String> logAction = null) { + _refreshTokenTimer.Stop(); + var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); - _client.Environment = settings.DeploymentSlot; + if (!App.StartupArgs.Contains("-webDebug")) + { + _client.Environment = settings.DeploymentSlot; + } var appVersion = AssemblyHelper.GetCurrentAssemblyVersion().ToString(); @@ -83,12 +112,15 @@ namespace Tango.MachineStudio.UI.Authentication try { + logAction?.Invoke("Logging in to machine service..."); + response = _client.Login(new LoginRequest() { Email = email, Password = password, Version = appVersion, + Method = method, }).Result; } @@ -115,9 +147,20 @@ namespace Tango.MachineStudio.UI.Authentication }; } + if (response.PasswordChangeRequired) + { + return new AuthenticationLoginResult() + { + Response = response + }; + } + try { - ObservablesStaticCollections.Instance.Initialize(); + ObservablesStaticCollections.Instance.Initialize((x) => + { + logAction.Invoke(x); + }); } catch (Exception ex) { @@ -126,6 +169,7 @@ namespace Tango.MachineStudio.UI.Authentication using (ObservablesContext db = ObservablesContext.CreateDefault()) { + logAction.Invoke("Loading user permissions..."); User user = new UserBuilder(db).Set(x => x.Email.ToLower() == email.ToLower()).WithRolesAndPermissions().WithOrganization().Build(); if (user == null) @@ -135,6 +179,10 @@ namespace Tango.MachineStudio.UI.Authentication CurrentUser = user; + _refreshTokenTimer.Start(); + + logAction.Invoke("Starting application..."); + return new AuthenticationLoginResult() { User = user, @@ -149,6 +197,7 @@ namespace Tango.MachineStudio.UI.Authentication public void Logout() { CurrentUser = null; + _refreshTokenTimer.Stop(); } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/Ready_Anim.gif b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/Ready_Anim.gif Binary files differnew file mode 100644 index 000000000..11cef3b10 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/Ready_Anim.gif diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/dyeing.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/dyeing.png Binary files differnew file mode 100644 index 000000000..fbace4fa5 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/dyeing.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/dyeing_Anim.gif b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/dyeing_Anim.gif Binary files differnew file mode 100644 index 000000000..058d9a34d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/dyeing_Anim.gif diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/error_Anim.gif b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/error_Anim.gif Binary files differnew file mode 100644 index 000000000..9bf0d84f3 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/error_Anim.gif diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/getting_ready_Anim.gif b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/getting_ready_Anim.gif Binary files differnew file mode 100644 index 000000000..79256816a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/getting_ready_Anim.gif diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/machine-off.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/machine-off.png Binary files differnew file mode 100644 index 000000000..6dc569e35 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/machine-off.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/machine_off_Anim.gif b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/machine_off_Anim.gif Binary files differnew file mode 100644 index 000000000..9ca81da39 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/machine_off_Anim.gif diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/ready-to-dye.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/ready-to-dye.png Binary files differnew file mode 100644 index 000000000..7edf624be --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/ready-to-dye.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/service_Anim.gif b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/service_Anim.gif Binary files differnew file mode 100644 index 000000000..f5962c36c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/service_Anim.gif diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/shutdown_icon_Anim.gif b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/shutdown_icon_Anim.gif Binary files differnew file mode 100644 index 000000000..d936476b6 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/shutdown_icon_Anim.gif diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/standby.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/standby.png Binary files differnew file mode 100644 index 000000000..6b46c22c0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/standby.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/standby_Anim.gif b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/standby_Anim.gif Binary files differnew file mode 100644 index 000000000..89491179d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/Statuses/standby_Anim.gif diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/active_directory.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/active_directory.png Binary files differnew file mode 100644 index 000000000..4cced33e0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/active_directory.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-emulator.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-emulator.png Binary files differindex cb159d4a6..254fc819a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-emulator.png +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-emulator.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-signalr.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-signalr.png Binary files differnew file mode 100644 index 000000000..bda45ffd2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-signalr.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-tcp.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-tcp.png Binary files differindex 192cbcaa7..04e47f539 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-tcp.png +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-tcp.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-usb.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-usb.png Binary files differindex 414bbab04..07814e7de 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-usb.png +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-usb.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/login.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/login.png Binary files differnew file mode 100644 index 000000000..9f7d0b9ba --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/login.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/login_white.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/login_white.png Binary files differnew file mode 100644 index 000000000..10a054147 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/login_white.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/machinestudio_login.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/machinestudio_login.png Binary files differnew file mode 100644 index 000000000..98f1b286a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/machinestudio_login.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml index a76749b05..054d7b9d8 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml @@ -8,7 +8,7 @@ xmlns:views="clr-namespace:Tango.MachineStudio.UI.Views" xmlns:sharedControls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" mc:Ignorable="d" - Title="Tango" Height="800" Width="1280" Foreground="{StaticResource MainWindow.Foreground}" + Title="Tango" Height="800" Width="1280" Foreground="{StaticResource MainWindow.Foreground}" FontFamily="{StaticResource flexo}" BorderThickness="1" BorderBrush="{StaticResource AccentColorBrush}" Background="{DynamicResource MainWindow.Background}" WindowTitleBrush="{StaticResource MainWindow.WindowTitleColorBrush}"> <Grid x:Name="main_grid"> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml index 41405f7fb..939adf5d5 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml @@ -7,7 +7,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Windows" mc:Ignorable="d" - Title="Machine Studio" MinHeight="220" SizeToContent="WidthAndHeight" MinWidth="600" AllowsTransparency="True" WindowStyle="None" WindowStartupLocation="CenterOwner" Background="Transparent" ShowInTaskbar="False"> + Title="Machine Studio" MinHeight="220" SizeToContent="WidthAndHeight" MinWidth="600" AllowsTransparency="True" WindowStyle="None" WindowStartupLocation="CenterOwner" Background="Transparent" ShowInTaskbar="False" FontFamily="{StaticResource flexo}" > <Grid> <Grid> <Border Background="{StaticResource Dialog.Background}" CornerRadius="10" Padding="10" Margin="20"> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml index 988e3c21f..888f49d3f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml @@ -8,7 +8,7 @@ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" mc:Ignorable="d" - Title="Machine Studio" MinHeight="220" MaxHeight="600" SizeToContent="Height" Width="570" Opacity="0" AllowsTransparency="True" WindowStyle="None" WindowStartupLocation="CenterOwner" Background="Transparent" ShowInTaskbar="False"> + Title="Machine Studio" MinHeight="220" MaxHeight="600" SizeToContent="Height" Width="570" Opacity="0" AllowsTransparency="True" WindowStyle="None" WindowStartupLocation="CenterOwner" Background="Transparent" ShowInTaskbar="False" FontFamily="{StaticResource flexo}" > <Window.Resources> <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></BooleanToVisibilityConverter> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/TextInputBoxWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/TextInputBoxWindow.xaml index a43fafb46..7d888d784 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/TextInputBoxWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/TextInputBoxWindow.xaml @@ -8,7 +8,7 @@ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" mc:Ignorable="d" - Title="Machine Studio" MinHeight="220" MaxHeight="600" SizeToContent="Height" Width="570" Opacity="0" AllowsTransparency="True" WindowStyle="None" WindowStartupLocation="CenterOwner" Background="Transparent" ShowInTaskbar="False"> + Title="Machine Studio" MinHeight="220" MaxHeight="600" SizeToContent="Height" Width="570" Opacity="0" AllowsTransparency="True" WindowStyle="None" WindowStartupLocation="CenterOwner" Background="Transparent" ShowInTaskbar="False" FontFamily="{StaticResource flexo}" > <Window.Resources> <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></BooleanToVisibilityConverter> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index 91792e0f3..7e47097ca 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("4.0.29.0")] +[assembly: AssemblyVersion("4.1.0.0")] [assembly: ComVisible(false)]
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index 0235f8cca..2c3c9ccb9 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -49,6 +49,11 @@ namespace Tango.MachineStudio.UI.StudioApplication public event EventHandler ApplicationReady; /// <summary> + /// Occurs when the connected machine session has been lost and an automatic reconnection with the last machine is required. + /// </summary> + public event EventHandler ReconnectionRequired; + + /// <summary> /// Initializes a new instance of the <see cref="DefaultStudioApplicationManager" /> class. /// </summary> /// <param name="navigationManager">The navigation manager.</param> @@ -126,6 +131,8 @@ namespace Tango.MachineStudio.UI.StudioApplication { if (e == Transport.TransportComponentState.Disconnected || e == Transport.TransportComponentState.Failed) { + bool reconnect = ConnectedMachine is IExternalBridgeSecureClient; + ConnectedMachine = null; if (e == Transport.TransportComponentState.Failed) @@ -134,12 +141,16 @@ namespace Tango.MachineStudio.UI.StudioApplication ConnectionLostViewVM vm = new ConnectionLostViewVM() { - Exception = failed_reason + Exception = failed_reason, + AutoReconnect = reconnect, }; InvokeUI(() => { - _notification.ShowModalDialog<ConnectionLostViewVM, ConnectionLostView>(vm, (x) => { }, () => { }); + _notification.ShowModalDialog<ConnectionLostViewVM, ConnectionLostView>(vm, (x) => + { + ReconnectionRequired?.Invoke(this, new EventArgs()); + }, () => { }); }); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs index 31b330c3f..bfd5b0557 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs @@ -185,6 +185,22 @@ namespace Tango.MachineStudio.UI.TFS return item; } + private string[] GetLogFiles(FileLogger logger) + { + string[] fileEntries = new string[1]; + fileEntries[0] = logger.LogFile; + string fileName = Path.GetFileNameWithoutExtension(logger.LogFile); + int indexPos = fileName.IndexOf(FileLogger.FILE_SET_EXTENSION); + if (indexPos > 0) + { + string extension = Path.GetExtension(logger.LogFile); + fileName = fileName.Substring(0, indexPos); + fileEntries = Directory.GetFiles(logger.Folder, $"{fileName}*{extension}").Where(x => Path.GetFileName(x).StartsWith(logger.Tag)).OrderBy(x => x.Length).ThenBy(x => x).ToArray(); + } + + return fileEntries; + } + public void FinalizeBug(WorkItem item) { IAuthenticationProvider auth = TangoIOC.Default.GetInstance<IAuthenticationProvider>(); @@ -192,30 +208,50 @@ namespace Tango.MachineStudio.UI.TFS FileLogger appFileLogger = LogManager.Default.RegisteredLoggers.FirstOrDefault(x => x.GetType() == typeof(FileLogger)) as FileLogger; FileLogger embeddedFileLogger = MachineOperator.EmbeddedLogManager.RegisteredLoggers.FirstOrDefault(x => x.GetType() == typeof(FileLogger)) as FileLogger; - + if (appFileLogger != null) { - var appLogFile = _tempFolder.CreateImaginaryFile(); - File.Copy(appFileLogger.LogFile, appLogFile.Path); - - item.Attachments.Add(new Attachment() + string[] logFiles = GetLogFiles(appFileLogger); + foreach( string file in logFiles) { - Description = "Application Log File", - FilePath = appLogFile.Path, - Name = Path.GetFileName(appFileLogger.LogFile), - }); + var appLogFile = _tempFolder.CreateImaginaryFile(); + File.Copy(file, appLogFile.Path); + item.Attachments.Add(new Attachment() + { + Description = "Application Log File", + FilePath = appLogFile.Path, + Name = Path.GetFileName(file), + }); + } } if (embeddedFileLogger != null && File.Exists(embeddedFileLogger.LogFile)) { - var embeddedLogFile = _tempFolder.CreateImaginaryFile(); - File.Copy(embeddedFileLogger.LogFile, embeddedLogFile.Path); + string[] logFiles = GetLogFiles(embeddedFileLogger); + foreach (string file in logFiles) + { + var embeddedLogFile = _tempFolder.CreateImaginaryFile(); + File.Copy(file, embeddedLogFile.Path); + item.Attachments.Add(new Attachment() + { + Description = "Embedded Log File", + FilePath = embeddedLogFile.Path, + Name = Path.GetFileName(file), + }); + } + } + //Add session log file.. + if (MachineOperator.EnableSessionLogFile) + { + var file = MachineOperator.SessionLogger.LogFile; + var sessionLogFile = _tempFolder.CreateImaginaryFile(); + File.Copy(file, sessionLogFile.Path); item.Attachments.Add(new Attachment() { - Description = "Embedded Log File", - FilePath = embeddedLogFile.Path, - Name = Path.GetFileName(embeddedFileLogger.LogFile), + Description = "Session Log File", + FilePath = sessionLogFile.Path, + Name = Path.GetFileName(file), }); } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index e172bbc91..a0632195d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -36,7 +36,7 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup> - <ApplicationIcon>machine.ico</ApplicationIcon> + <ApplicationIcon>machine_new_small.ico</ApplicationIcon> </PropertyGroup> <ItemGroup> <Reference Include="Dragablz, Version=0.0.3.197, Culture=neutral, processorArchitecture=MSIL"> @@ -351,6 +351,10 @@ <Link>Tango.ColorLib_v2.dll</Link> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> + <Content Include="..\..\Build\ColorLib\Debug\Tango.ColorLib_v3.dll"> + <Link>Tango.ColorLib_v3.dll</Link> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> <Content Include="..\..\tcc\benchmarks\benchmarks_rgb_lab.csv"> <Link>TCC\benchmarks_rgb_lab.csv</Link> <CopyToOutputDirectory>Always</CopyToOutputDirectory> @@ -359,6 +363,24 @@ <Link>TCC\template.bmp</Link> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> + <Resource Include="Images\login_white.png" /> + <Resource Include="Images\login.png" /> + <Resource Include="Images\active_directory.png" /> + <Resource Include="Images\machinestudio_login.png" /> + <Resource Include="Images\external-bridge-signalr.png" /> + <Resource Include="machine_new_small.ico" /> + <Resource Include="Images\Statuses\dyeing.png" /> + <Resource Include="Images\Statuses\dyeing_Anim.gif" /> + <Resource Include="Images\Statuses\error_Anim.gif" /> + <Resource Include="Images\Statuses\getting_ready_Anim.gif" /> + <Resource Include="Images\Statuses\machine-off.png" /> + <Resource Include="Images\Statuses\machine_off_Anim.gif" /> + <Resource Include="Images\Statuses\ready-to-dye.png" /> + <Resource Include="Images\Statuses\Ready_Anim.gif" /> + <Resource Include="Images\Statuses\service_Anim.gif" /> + <Resource Include="Images\Statuses\shutdown_icon_Anim.gif" /> + <Resource Include="Images\Statuses\standby.png" /> + <Resource Include="Images\Statuses\standby_Anim.gif" /> <None Include="packages.config" /> <None Include="Properties\Settings.settings"> <Generator>SettingsSingleFileGenerator</Generator> @@ -384,6 +406,10 @@ <Project>{bb2abb74-ba58-4812-83aa-ec8171f42df4}</Project> <Name>Tango.AutoComplete</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.AnimatedGif\Tango.AnimatedGif.csproj"> + <Project>{d129789c-3096-4d0b-8dd7-fe24a4df4b21}</Project> + <Name>Tango.AnimatedGif</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.BL\Tango.BL.csproj"> <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> <Name>Tango.BL</Name> @@ -428,6 +454,10 @@ <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> <Name>Tango.SharedUI</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.SQLExaminer\Tango.SQLExaminer.csproj"> + <Project>{e1e66ed9-597d-45fa-8048-de90a6930484}</Project> + <Name>Tango.SQLExaminer</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.TFS\Tango.TFS.csproj"> <Project>{998f8471-dc1b-41b6-9d96-354e1b4e7a32}</Project> <Name>Tango.TFS</Name> @@ -440,22 +470,18 @@ <Project>{5001990f-977b-48ff-b217-0236a5022ad8}</Project> <Name>Tango.Web</Name> </ProjectReference> - <ProjectReference Include="..\..\TCC\Tango.TCC.BL\Tango.TCC.BL.csproj"> - <Project>{f209fae8-73f9-441b-97f4-0844a0279390}</Project> - <Name>Tango.TCC.BL</Name> - </ProjectReference> <ProjectReference Include="..\Modules\MachineStudio.Dispensers\Tango.MachineStudio.Dispensers.csproj"> <Project>{f69da3a8-f823-461e-87cf-a9275abc0b15}</Project> <Name>Tango.MachineStudio.Dispensers</Name> </ProjectReference> + <ProjectReference Include="..\Modules\Tango.MachineStudio.ActionLogs\Tango.MachineStudio.ActionLogs.csproj"> + <Project>{447ecb9f-f730-47d6-8df8-d232bf4a0315}</Project> + <Name>Tango.MachineStudio.ActionLogs</Name> + </ProjectReference> <ProjectReference Include="..\Modules\Tango.MachineStudio.Catalogs\Tango.MachineStudio.Catalogs.csproj"> <Project>{7d0fce3c-9a37-439c-9f9f-b26cfd6a8a33}</Project> <Name>Tango.MachineStudio.Catalogs</Name> </ProjectReference> - <ProjectReference Include="..\Modules\Tango.MachineStudio.ColorCapture\Tango.MachineStudio.ColorCapture.csproj"> - <Project>{1b87ca53-50bd-4c48-a8c7-fbb9f1419aff}</Project> - <Name>Tango.MachineStudio.ColorCapture</Name> - </ProjectReference> <ProjectReference Include="..\Modules\Tango.MachineStudio.ColorLab\Tango.MachineStudio.ColorLab.csproj"> <Project>{4d183aca-552b-4135-ae81-7c5a8e5fc3b1}</Project> <Name>Tango.MachineStudio.ColorLab</Name> @@ -464,10 +490,6 @@ <Project>{fc337a7f-1214-41d8-9992-78092a3b961e}</Project> <Name>Tango.MachineStudio.DataCapture</Name> </ProjectReference> - <ProjectReference Include="..\Modules\Tango.MachineStudio.DB\Tango.MachineStudio.DB.csproj"> - <Project>{94f7acf8-55e1-4a02-b9bc-a818413fdbbf}</Project> - <Name>Tango.MachineStudio.DB</Name> - </ProjectReference> <ProjectReference Include="..\Modules\Tango.MachineStudio.Developer\Tango.MachineStudio.Developer.csproj"> <Project>{ce4a0d11-08a2-4cd6-9908-d6c62e80d805}</Project> <Name>Tango.MachineStudio.Developer</Name> @@ -488,6 +510,10 @@ <Project>{d0186ac0-0fcf-4d3b-9619-54812b6e524b}</Project> <Name>Tango.MachineStudio.RML</Name> </ProjectReference> + <ProjectReference Include="..\Modules\Tango.MachineStudio.Sites\Tango.MachineStudio.Sites.csproj"> + <Project>{18a27902-9881-4556-8163-f6df2236a14d}</Project> + <Name>Tango.MachineStudio.Sites</Name> + </ProjectReference> <ProjectReference Include="..\Modules\Tango.MachineStudio.Statistics\Tango.MachineStudio.Statistics.csproj"> <Project>{8a65ad6a-a9b4-48c0-9301-4b7434b712f8}</Project> <Name>Tango.MachineStudio.Statistics</Name> @@ -638,7 +664,8 @@ copy /Y "$(SolutionDir)Referenced Assemblies\vcruntime140d.dll" "$(TargetDir)" copy /Y "$(SolutionDir)Referenced Assemblies\Microsoft.WITDataStore32.dll" "$(TargetDir)" if $(ConfigurationName) == Release del *.xml -if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)ProtoCompilers\"</PostBuildEvent> +if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)ProtoCompilers\" +if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)Roslyn\"</PostBuildEvent> </PropertyGroup> <Import Project="..\..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets')" /> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs index 3fffd69fd..9539037f1 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs @@ -1,5 +1,7 @@ using System; +using System.Linq; using System.Windows; +using Tango.BL.ActionLogs; using Tango.Core.DI; using Tango.Integration.ExternalBridge; using Tango.Logging; @@ -69,9 +71,19 @@ namespace Tango.MachineStudio.UI TangoIOC.Default.Unregister<IDispatcherProvider>(); TangoIOC.Default.Unregister<IFirmwareUpgrader>(); TangoIOC.Default.Unregister<MachineStudioWebClient>(); + TangoIOC.Default.Unregister<IActionLogManager>(); - TangoIOC.Default.Register<MachineStudioWebClient, MachineStudioWebClient>(new MachineStudioWebClient()); + + if (App.StartupArgs.Contains("-webDebug")) + { + TangoIOC.Default.Register<MachineStudioWebClient, MachineStudioWebClient>(new MachineStudioWebClient("http://localhost:1111", null)); + } + else + { + TangoIOC.Default.Register<MachineStudioWebClient, MachineStudioWebClient>(new MachineStudioWebClient()); + } + TangoIOC.Default.Register<IDispatcherProvider, DefaultDispatcherProvider>(new DefaultDispatcherProvider(Application.Current.Dispatcher)); TangoIOC.Default.Register<INotificationProvider, DefaultNotificationProvider>(); TangoIOC.Default.Register<IAuthenticationProvider, DefaultAuthenticationProvider>(); @@ -83,8 +95,9 @@ namespace Tango.MachineStudio.UI TangoIOC.Default.Register<IEventLogger, DefaultEventLogger>(); TangoIOC.Default.Register<ISpeechProvider, DefaultSpeechProvider>(); TangoIOC.Default.Register<IFirmwareUpgrader, DefaultFirmwareUpgrader>(); + TangoIOC.Default.Register<IActionLogManager, DefaultActionLogManager>(new DefaultActionLogManager() { IsAsync = true }); TangoIOC.Default.Register<TeamFoundationServiceExtendedClient>(new TeamFoundationServiceExtendedClient("https://twinetfs.visualstudio.com", String.Empty, "szzfokrceo4rhd4eqi5qpmxn3pa5iwl3q7tlqd36l2m7smz2ynoa")); - + TangoIOC.Default.Register<MainViewVM>(); TangoIOC.Default.Register<LoadingViewVM>(); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs index 16f6938a0..40479895d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs @@ -95,11 +95,11 @@ namespace Tango.MachineStudio.UI.ViewModels using (ObservablesContext db = ObservablesContext.CreateDefault()) { - var jobs = await db.Jobs.Include(x => x.JobRuns).Where(x => x.MachineGuid == ApplicationManager.Machine.Guid).ToListAsync(); + var jobRuns = await db.JobRuns.Where(x => x.MachineGuid == ApplicationManager.Machine.Guid).ToListAsync(); - TotalMachineWorkTime = TimeSpan.FromHours(jobs.SelectMany(x => x.JobRuns).Select(x => x.EndDate - x.StartDate).Sum(x => x.TotalHours)).ToString(@"hh\:mm\:ss"); + TotalMachineWorkTime = TimeSpan.FromHours(jobRuns.Select(x => x.EndDate - x.StartDate).Sum(x => x.TotalHours)).ToString(@"hh\:mm\:ss"); - int meters = (int)jobs.SelectMany(x => x.JobRuns).Select(x => x.EndPosition).Sum(); + int meters = (int)jobRuns.Select(x => x.EndPosition).Sum(); TotalMachineMeters = $"{meters.ToString("N0")} meters"; } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectionLostViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectionLostViewVM.cs index f1f4f69c0..e96f0ab62 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectionLostViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectionLostViewVM.cs @@ -3,12 +3,76 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Timers; +using System.Windows.Threading; using Tango.SharedUI; namespace Tango.MachineStudio.UI.ViewModels { public class ConnectionLostViewVM : DialogViewVM { + private Timer _reconnectTimer; + public String Exception { get; set; } + + private int _reconnectinSeconds; + public int ReconnectinSeconds + { + get { return _reconnectinSeconds; } + set { _reconnectinSeconds = value; RaisePropertyChangedAuto(); } + } + + private bool _autoReconnect; + public bool AutoReconnect + { + get { return _autoReconnect; } + set { _autoReconnect = value; RaisePropertyChangedAuto(); } + } + + + public ConnectionLostViewVM() : base() + { + ReconnectinSeconds = 10; + _reconnectTimer = new Timer(); + _reconnectTimer.Interval = TimeSpan.FromSeconds(1).TotalMilliseconds; + _reconnectTimer.Elapsed += _reconnectTimer_Elapsed; + } + + private void _reconnectTimer_Elapsed(object sender, ElapsedEventArgs e) + { + ReconnectinSeconds--; + + if (ReconnectinSeconds == -1) + { + _reconnectTimer.Stop(); + + InvokeUI(() => + { + Accept(); + }); + } + } + + public override void OnShow() + { + base.OnShow(); + + if (AutoReconnect) + { + _reconnectTimer.Start(); + } + } + + protected override void Accept() + { + _reconnectTimer.Stop(); + base.Accept(); + } + + protected override void Cancel() + { + base.Cancel(); + _reconnectTimer.Stop(); + } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/FirmwareUpgradeViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/FirmwareUpgradeViewVM.cs index e45c29f73..365c1db49 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/FirmwareUpgradeViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/FirmwareUpgradeViewVM.cs @@ -207,6 +207,11 @@ namespace Tango.MachineStudio.UI.ViewModels } } + protected override bool CanOK() + { + return base.CanOK() && CanClose; + } + private async void AbortUpgrade() { CanClose = true; 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 cf34764d9..c00caf72a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs @@ -22,6 +22,9 @@ using Tango.MachineStudio.UI.Messages; using Tango.Settings; using Tango.SharedUI; using Tango.Web; +using SimpleValidator.Extensions; +using Tango.BL.Entities; +using System.Data.Entity; namespace Tango.MachineStudio.UI.ViewModels { @@ -38,6 +41,7 @@ namespace Tango.MachineStudio.UI.ViewModels private Rfc2898Cryptographer cryptographer; private MachineStudioSettings _settings; private MachineStudioWebClient _machineStudioWebClient; + private TaskCompletionSource<object> _updatePasswordCompletionSource; private String _email; /// <summary> @@ -82,6 +86,14 @@ namespace Tango.MachineStudio.UI.ViewModels set { _isLogging = value; RaisePropertyChangedAuto(); } } + private bool _showLogginDetails; + public bool ShowLoggingDetails + { + get { return _showLogginDetails; } + set { _showLogginDetails = value; RaisePropertyChangedAuto(); } + } + + private bool _rememberMe; /// <summary> /// Gets or sets a value indicating whether to remember the last user email and password. @@ -102,6 +114,47 @@ namespace Tango.MachineStudio.UI.ViewModels set { _enableSlotSelection = value; RaisePropertyChangedAuto(); } } + private bool _isActiveDirectory; + public bool IsActiveDirectory + { + get { return _isActiveDirectory; } + set { _isActiveDirectory = value; RaisePropertyChangedAuto(); if (value) IsStandardUser = false; } + } + + private bool _isStandardUser; + public bool IsStandardUser + { + get { return _isStandardUser; } + set { _isStandardUser = value; RaisePropertyChangedAuto(); if (value) IsActiveDirectory = false; } + } + + private String _progressLog; + public String ProgressLog + { + get { return _progressLog; } + set { _progressLog = value; RaisePropertyChangedAuto(); } + } + + private bool _isChangingPassword; + public bool IsChangingPassword + { + get { return _isChangingPassword; } + set { _isChangingPassword = value; RaisePropertyChangedAuto(); } + } + + private String _newPassword1; + public String NewPassword1 + { + get { return _newPassword1; } + set { _newPassword1 = value; RaisePropertyChangedAuto(); } + } + + private String _newPassword2; + public String NewPassword2 + { + get { return _newPassword2; } + set { _newPassword2 = value; RaisePropertyChangedAuto(); } + } /// <summary> /// Gets or sets the login command. @@ -109,6 +162,11 @@ namespace Tango.MachineStudio.UI.ViewModels public RelayCommand LoginCommand { get; set; } /// <summary> + /// Gets or sets the update password command. + /// </summary> + public RelayCommand UpdatePasswordCommand { get; set; } + + /// <summary> /// Initializes a new instance of the <see cref="LoginViewVM"/> class. /// </summary> /// <param name="authenticationProvider">The authentication provider.</param> @@ -117,6 +175,7 @@ namespace Tango.MachineStudio.UI.ViewModels public LoginViewVM(MachineStudioWebClient machineStudioWebClient, IAuthenticationProvider authenticationProvider, INavigationManager navigationManager, INotificationProvider notificationProvider, IEventLogger eventLogger) { EnableSlotSelection = true; + ShowLoggingDetails = true; _machineStudioWebClient = machineStudioWebClient; _settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); @@ -126,12 +185,22 @@ namespace Tango.MachineStudio.UI.ViewModels _authenticationProvider = authenticationProvider; _eventLogger = eventLogger; LoginCommand = new RelayCommand(Login, () => !IsLogging); + UpdatePasswordCommand = new RelayCommand(UpdatePassword, () => IsChangingPassword); cryptographer = new Rfc2898Cryptographer(); Email = _settings.LastLoginEmail; DeploymentSlot = _settings.DeploymentSlot; RememberMe = _settings.RememberMe; + if (_settings.LastLoginMethod == LoginMethod.ActiveDirectory) + { + IsActiveDirectory = true; + } + else + { + IsStandardUser = true; + } + try { Password = cryptographer.Decrypt(_settings.LastLoginPassword); @@ -152,13 +221,22 @@ namespace Tango.MachineStudio.UI.ViewModels try { IsLogging = true; + ShowLoggingDetails = false; + NewPassword1 = String.Empty; + NewPassword2 = String.Empty; + InvalidateRelayCommands(); + LoginMethod loginMethod = IsActiveDirectory ? LoginMethod.ActiveDirectory : LoginMethod.StandardUser; + await Task.Factory.StartNew(() => { _settings.DeploymentSlot = DeploymentSlot; - LoginResponse result = _authenticationProvider.Login(Email, Password, _settings.ByPassEnvironmentVersionCheck).Response; + LoginResponse result = _authenticationProvider.Login(Email, Password, loginMethod, _settings.ByPassEnvironmentVersionCheck, (progress) => + { + ProgressLog = progress; + }).Response; if (result.VersionChangeRequired && !_settings.ByPassEnvironmentVersionCheck) { @@ -177,31 +255,115 @@ namespace Tango.MachineStudio.UI.ViewModels return; } + if (result.PasswordChangeRequired) + { + StartUpdatePassword().Task.GetAwaiter().GetResult(); + Password = NewPassword1; + Login(); + return; + } + _eventLogger.Log(EventTypes.APPLICATION_STARTED, "Application Started!"); _navigationManager.NavigateTo(NavigationView.MainView); _settings.LastLoginEmail = Email; _settings.RememberMe = RememberMe; + _settings.LastLoginMethod = loginMethod; _settings.LastLoginPassword = RememberMe ? cryptographer.Encrypt(Password) : null; _settings.Save(); _eventLogger.Log("User logged in."); EnableSlotSelection = false; + + IsLogging = false; + ShowLoggingDetails = true; + IsChangingPassword = false; + InvalidateRelayCommands(); }); } catch (Exception ex) { + IsLogging = false; + ShowLoggingDetails = true; + IsChangingPassword = false; + InvalidateRelayCommands(); LogManager.Log(ex, "Login Error."); _notificationProvider.ShowError($"An error occurred while trying to perform the log-in operation.\n{ex.FlattenMessage()}"); } - finally + } + } + + private TaskCompletionSource<object> StartUpdatePassword() + { + _updatePasswordCompletionSource = new TaskCompletionSource<object>(); + + IsChangingPassword = true; + ShowLoggingDetails = false; + IsLogging = false; + InvalidateRelayCommands(); + + return _updatePasswordCompletionSource; + } + + private async void UpdatePassword() + { + await Task.Factory.StartNew(() => + { + try + { + if (!Validate()) + { + return; + } + + ProgressLog = "Updating your password..."; + IsChangingPassword = false; + IsLogging = true; + InvalidateRelayCommands(); + + using (var db = ObservablesContext.CreateDefault()) + { + var user = db.Users.SingleOrDefault(x => x.Email == Email); + user.PasswordChangeRequired = false; + user.Password = User.GetPasswordHash(NewPassword1); + db.SaveChanges(); + } + + _updatePasswordCompletionSource.SetResult(true); + } + catch (Exception ex) { IsLogging = false; + IsChangingPassword = false; + ShowLoggingDetails = true; InvalidateRelayCommands(); + _updatePasswordCompletionSource.SetException(ex); + } + finally + { + InvalidateRelayCommands(); + } + }); + } + + protected override void OnValidating() + { + if (IsChangingPassword) + { + if (!NewPassword1.IsBetweenLength(6, 8)) + { + InsertError(nameof(NewPassword1), "Password must be 6 to 8 characters long"); + } + + if (NewPassword1 != NewPassword2) + { + InsertError(nameof(NewPassword2), "Passwords do not match"); } } + + base.OnValidating(); } } } 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 d1f3cc69e..5e44bf43d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.Core.Commands; +using Tango.Core.DI; using Tango.Emulations.ExternalBridge; using Tango.Integration.ExternalBridge; using Tango.MachineStudio.Common; @@ -52,7 +53,18 @@ namespace Tango.MachineStudio.UI.ViewModels { if (_scanner == null) { + var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); _scanner = new ExternalBridgeScanner(); + _scanner.SignalRConfiguration.Enabled = settings.EnableExternalBridgeSignalR; + if (App.StartupArgs.Contains("-webDebug")) + { + _scanner.SignalRConfiguration.Address = "http://localhost:1111/"; //settings.DeploymentSlot.ToAddress(); + } + else + { + _scanner.SignalRConfiguration.Address = settings.DeploymentSlot.ToAddress(); + } + _scanner.SignalRConfiguration.Hub = settings.ExternalBridgeSignalRHub; } EnableDiagnostics = true; @@ -108,6 +120,8 @@ namespace Tango.MachineStudio.UI.ViewModels catch (Exception ex) { LogManager.Log(ex, "Error starting external bridge scanner."); + Cancel(); + TangoIOC.Default.GetInstance<INotificationProvider>().ShowError($"There is a problem with machine scanning.\n{ex.FlattenMessage()}"); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index b22d65192..2a00386dc 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -58,6 +58,8 @@ namespace Tango.MachineStudio.UI.ViewModels private IEventLogger _eventLogger; private MachineStudioSettings _settings; private MachineStudioWebClient _machineStudioWebClient; + private IExternalBridgeSecureClient _reconnectionMachine; + private MachineLoginViewVM _reconnectionMachineConfig; /// <summary> /// Gets or sets the current loaded module. @@ -344,6 +346,13 @@ namespace Tango.MachineStudio.UI.ViewModels AboutCommand = new RelayCommand(ShowAboutDialog); ChangeAppThemeCommand = new RelayCommand<MachineStudioTheme>(ChangeTheme); + + ApplicationManager.ReconnectionRequired += ApplicationManager_ReconnectionRequired; + } + + private void ApplicationManager_ReconnectionRequired(object sender, EventArgs e) + { + ConnectToMachineSecure(_reconnectionMachine, _reconnectionMachineConfig); } private void MachineEventsStateProvider_EventsResolved(object sender, IEnumerable<MachinesEvent> e) @@ -455,70 +464,23 @@ namespace Tango.MachineStudio.UI.ViewModels x.SelectedMachine.EnableEventsNotification = x.EnableDiagnostics; x.SelectedMachine.UseKeepAlive = x.EnableKeepAlive; x.SelectedMachine.JobUnitsMethod = _settings.JobUnitsMethod; + x.SelectedMachine.JobRunsLogger.JobSource = BL.Enumerations.JobSource.Remote; if (x.SelectedMachine is ExternalBridgeTcpClient) { x.SelectedMachine.As<ExternalBridgeTcpClient>().EnableApplicationLogs = x.EnableApplicationLogs; + x.SelectedMachine.RequestTimeout = _settings.ExternalBridgeRequestTimeout; + x.SelectedMachine.ContinuousRequestTimeout = _settings.ExternalBridgeContinuousRequestTimeout; } - if (x.SelectedMachine.RequiresAuthentication) + if (x.SelectedMachine.Adapter is TcpTransportAdapter) { - //Check machine exist on my database first - if (x.SelectedMachine.Machine == null) - { - _notificationProvider.ShowError($"The specified machine '{x.SelectedMachine.SerialNumber}' could not be found on the database. Aborting connection."); - return; - } - - _notificationProvider.ShowModalDialog<MachineLoginViewVM>(async (login) => - { - using (NotificationProvider.PushTaskItem("Connecting to machine " + x.SelectedMachine.ToString() + "...")) - { - try - { - await x.SelectedMachine.As<IExternalBridgeSecureClient>().Connect(new PMR.Integration.ExternalBridgeLoginRequest() - { - AppID = "Machine Studio", - HostName = Environment.MachineName, - Password = login.Password, - UserGuid = AuthenticationProvider.CurrentUser.Guid, - Intent = login.Intent, - }); - - ApplicationManager.SetConnectedMachine(x.SelectedMachine); - (x.SelectedMachine as IExternalBridgeSecureClient).SessionClosed += (_, __) => - { - InvokeUI(() => - { - _notificationProvider.ShowError("The remote machine has closed the current session. Machine disconnected."); - ApplicationManager.SetConnectedMachine(null); - }); - }; - PostMessage(new MachineConnectionChangedMessage() { Machine = x.SelectedMachine }); - _eventLogger.Log(String.Format("Successfully connected to machine {0} via TCP", x.SelectedMachine.SerialNumber)); - - //if (x.UploadHardwareConfiguration) - //{ - // UploadHardwareConfiguration(false); - //} - - } - catch (ResponseErrorException ex) - { - LogManager.Log(ex); - _eventLogger.Log(ex, "Error connecting to machine " + x.SelectedMachine.SerialNumber); - _notificationProvider.ShowError("Could not connect to the selected machine." + Environment.NewLine + ex.Container.ErrorMessage); - } - catch (Exception ex) - { - LogManager.Log(ex); - _eventLogger.Log(ex, "Error connecting to machine " + x.SelectedMachine.SerialNumber); - _notificationProvider.ShowError("Could not connect to the selected machine." + Environment.NewLine + ex.Message); - } + (x.SelectedMachine.Adapter as TcpTransportAdapter).WriteMode = _settings.TcpTransportAdapterWriteMode; + } - InvalidateRelayCommands(); - } - }); + if (x.SelectedMachine.RequiresAuthentication) + { + ConnectToMachineSecure(x.SelectedMachine as IExternalBridgeSecureClient); } else { @@ -631,6 +593,77 @@ namespace Tango.MachineStudio.UI.ViewModels InvalidateRelayCommands(); } + private async void ConnectToMachineSecure(IExternalBridgeSecureClient machine, MachineLoginViewVM config) + { + using (NotificationProvider.PushTaskItem("Connecting to machine " + machine.ToString() + "...")) + { + try + { + await machine.Connect(new PMR.Integration.ExternalBridgeLoginRequest() + { + AppID = "Machine Studio", + HostName = Environment.MachineName, + Password = config.Password, + UserGuid = AuthenticationProvider.CurrentUser.Guid, + Intent = config.Intent, + }); + + _reconnectionMachine = machine; + _reconnectionMachineConfig = config; + + ApplicationManager.SetConnectedMachine(machine); + machine.SessionClosed -= Machine_SessionClosed; + machine.SessionClosed += Machine_SessionClosed; + PostMessage(new MachineConnectionChangedMessage() { Machine = machine }); + _eventLogger.Log(String.Format("Successfully connected to machine {0} via TCP", machine.SerialNumber)); + + //if (x.UploadHardwareConfiguration) + //{ + // UploadHardwareConfiguration(false); + //} + + } + catch (ResponseErrorException ex) + { + LogManager.Log(ex); + _eventLogger.Log(ex, "Error connecting to machine " + machine.SerialNumber); + _notificationProvider.ShowError("Could not connect to the selected machine." + Environment.NewLine + ex.Container.ErrorMessage); + } + catch (Exception ex) + { + LogManager.Log(ex); + _eventLogger.Log(ex, "Error connecting to machine " + machine.SerialNumber); + _notificationProvider.ShowError("Could not connect to the selected machine." + Environment.NewLine + ex.Message); + } + + InvalidateRelayCommands(); + } + } + + private void ConnectToMachineSecure(IExternalBridgeSecureClient machine) + { + //Check machine exist on my database first + if (machine.Machine == null) + { + _notificationProvider.ShowError($"The specified machine '{machine.SerialNumber}' could not be found on the database. Aborting connection."); + return; + } + + _notificationProvider.ShowModalDialog<MachineLoginViewVM>((login) => + { + ConnectToMachineSecure(machine, login); + }); + } + + private void Machine_SessionClosed(object sender, EventArgs e) + { + InvokeUI(() => + { + _notificationProvider.ShowError("The remote machine has closed the current session. Machine disconnected."); + ApplicationManager.SetConnectedMachine(null); + }); + } + private async void UploadHardwareConfiguration(bool showSuccessMessage = true) { try @@ -666,7 +699,7 @@ namespace Tango.MachineStudio.UI.ViewModels /// Starts the specified module. /// </summary> /// <param name="module">The module.</param> - internal void StartModule(IStudioModule module) + internal async void StartModule(IStudioModule module) { IsMenuOpened = false; @@ -691,10 +724,9 @@ namespace Tango.MachineStudio.UI.ViewModels m.IsLoaded = false; } - CurrentModule = module; - if (module != null) { + CurrentModule = module; CurrentModule.IsLoaded = true; IsModuleLoaded = true; @@ -705,7 +737,10 @@ namespace Tango.MachineStudio.UI.ViewModels { IsModuleLoaded = false; LogManager.Log(String.Format("Navigating to Home...")); - (MainView.Self as MainView).NavigationControl.NavigateTo("Home"); + (MainView.Self as MainView).NavigationControl.NavigateTo("Home", () => + { + CurrentModule = module; + }); } } @@ -713,7 +748,7 @@ namespace Tango.MachineStudio.UI.ViewModels /// Opens the module in a new window. /// </summary> /// <param name="module">The module.</param> - private void OpenModuleInWindow(IStudioModule module, Rect? bounds = null, WindowState? state = null) + private async void OpenModuleInWindow(IStudioModule module, Rect? bounds = null, WindowState? state = null) { if (module == null) return; @@ -723,6 +758,8 @@ namespace Tango.MachineStudio.UI.ViewModels StartModule(null); + await Task.Delay(1000); + LogManager.Log(String.Format("Starting module '{0}' in new window...", module.Name)); if (!(MainView.Self as MainView).NavigationControl.Elements.ToList().Exists(x => x.GetType() == module.MainViewType)) diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs index 4a94322fb..160041b5f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs @@ -173,12 +173,13 @@ namespace Tango.MachineStudio.UI.ViewModels DownloadLatestVersionResponse response = await _machineStudioWebClient.DownloadLatestVersion(new DownloadLatestVersionRequest() { - + }); _updateInfo = new CheckForUpdatesResponse(); _updateInfo.BlobAddress = response.BlobAddress; _updateInfo.Version = response.Version; + _updateInfo.CdnAddress = response.CdnAddress; LatestVersion = _updateInfo.Version; StartUpdate(); @@ -270,9 +271,9 @@ namespace Tango.MachineStudio.UI.ViewModels { logManager.Log("Creating temporary file " + tempFile); - using (StorageBlobDownloader downloader = new StorageBlobDownloader(_updateInfo.BlobAddress, tempFile.Path)) + using (AutoFileDownloader downloader = new AutoFileDownloader(_updateInfo.BlobAddress, _updateInfo.CdnAddress, tempFile.Path)) { - downloader.Progress += (x, e) => + downloader.Progress += (x, e) => { InvokeUINow(() => { @@ -326,40 +327,40 @@ namespace Tango.MachineStudio.UI.ViewModels } } - try - { - LogManager.Log("Backing up current version..."); - CurrentUpdateFile = "Backing up current version..."; + //try + //{ + // LogManager.Log("Backing up current version..."); + // CurrentUpdateFile = "Backing up current version..."; - String rollbackFolder = GetRollbackFolder(); - Directory.CreateDirectory(rollbackFolder); + // String rollbackFolder = GetRollbackFolder(); + // Directory.CreateDirectory(rollbackFolder); - String backFile = GetRollbackFile(); + // String backFile = GetRollbackFile(); - if (File.Exists(backFile)) - { - File.Delete(backFile); - } + // if (File.Exists(backFile)) + // { + // File.Delete(backFile); + // } - using (ZipFile backZip = new ZipFile(backFile)) - { - int currentEntry = 0; + // using (ZipFile backZip = new ZipFile(backFile)) + // { + // int currentEntry = 0; - backZip.SaveProgress += (_, e) => - { - UpdateProgress = ((double)(currentEntry++) / (double)backZip.Entries.Count) * 100d; - }; + // backZip.SaveProgress += (_, e) => + // { + // UpdateProgress = ((double)(currentEntry++) / (double)backZip.Entries.Count) * 100d; + // }; - backZip.Password = "Aa123456"; - backZip.AddDirectory(_appPath); - backZip.Save(); - } - } - catch (Exception ex) - { - LogManager.Log(ex, "Could not construct rollback."); - _notification.ShowWarning("Update center has failed to construct a rollback point for the current version. Version rollback will not be available."); - } + // backZip.Password = "Aa123456"; + // backZip.AddDirectory(_appPath); + // backZip.Save(); + // } + //} + //catch (Exception ex) + //{ + // LogManager.Log(ex, "Could not construct rollback."); + // _notification.ShowWarning("Update center has failed to construct a rollback point for the current version. Version rollback will not be available."); + //} TangoIOC.Default.GetInstance<MainViewVM>().DisableCheckForUpdates = true; Status = UpdateStatus.UpdateCompleted; @@ -385,8 +386,8 @@ namespace Tango.MachineStudio.UI.ViewModels { try { - LogManager.Log("Clearing EF model store..."); - ObservablesContext.ClearModelStore(); + //LogManager.Log("Clearing EF model store..."); + //ObservablesContext.ClearModelStore(); Process p = new Process(); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml index f7e90d4f5..22c1a5c00 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml @@ -9,6 +9,7 @@ xmlns:pmrPrinting="clr-namespace:Tango.PMR.Printing;assembly=Tango.PMR" xmlns:operation="clr-namespace:Tango.Integration.Operation;assembly=Tango.Integration" xmlns:bl="clr-namespace:Tango.BL;assembly=Tango.BL" + xmlns:adapters="clr-namespace:Tango.Transport.Adapters;assembly=Tango.Transport" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" Width="600" Height="700" Background="{StaticResource Dialog.Background}" d:DataContext="{d:DesignInstance Type=vm:AboutViewVM, IsDesignTimeCreatable=False}" DataContext="{Binding AboutViewVM, Source={StaticResource Locator}}" Foreground="{StaticResource MainWindow.Foreground}"> @@ -28,7 +29,7 @@ <Grid> <StackPanel Orientation="Horizontal" Margin="10"> - <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant"></Image> + <Image Source="{StaticResource MachineSmall}" Width="60" RenderOptions.BitmapScalingMode="Fant"></Image> <TextBlock Text="About" VerticalAlignment="Center" Margin="10 0 0 0" FontSize="20"></TextBlock> </StackPanel> </Grid> @@ -75,6 +76,9 @@ <TextBlock FontWeight="SemiBold">Job Units Duplication Method:</TextBlock> <ComboBox HorizontalAlignment="Left" Width="150" DockPanel.Dock="Left" ItemsSource="{Binding Source={x:Type operation:JobUnitsMethods},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding MachineStudioSettings.JobUnitsMethod}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox> + <TextBlock FontWeight="SemiBold">External Bridge TCP Write Mode:</TextBlock> + <ComboBox HorizontalAlignment="Left" Width="150" DockPanel.Dock="Left" ItemsSource="{Binding Source={x:Type adapters:TcpTransportAdapterWriteMode},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding MachineStudioSettings.TcpTransportAdapterWriteMode}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox> + </controls:TableGrid> <DockPanel Margin="0 0 0 0"> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml index e69ac516e..e58885efc 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml @@ -32,6 +32,10 @@ <StackPanel Orientation="Horizontal" Margin="10"> <ContentControl Content="{Binding ApplicationManager.ConnectedMachine}"> <ContentControl.Resources> + <DataTemplate DataType="{x:Type integration:ExternalBridgeSignalRClient}"> + <Image Source="/Images/external-bridge-signalr.png" Width="48" Height="48" RenderOptions.BitmapScalingMode="Fant"></Image> + </DataTemplate> + <DataTemplate DataType="{x:Type integration:ExternalBridgeTcpClient}"> <Image Source="/Images/external-bridge-tcp.png" Width="48" Height="48" RenderOptions.BitmapScalingMode="Fant"></Image> </DataTemplate> @@ -65,6 +69,50 @@ <Grid d:DataContext="{d:DesignInstance Type=integ:MachineOperator, IsDesignTimeCreatable=False}"> <ContentControl Content="{Binding ApplicationManager.ConnectedMachine}"> <ContentControl.Resources> + + <DataTemplate DataType="{x:Type integration:ExternalBridgeSignalRClient}"> + <controls:TableGrid RowHeight="22"> + <TextBlock FontWeight="SemiBold" Text="Serial Number:" /> + <TextBlock Text="{Binding SerialNumber}" /> + <TextBlock FontWeight="SemiBold" Text="Name:" /> + <TextBlock Text="{Binding Machine.Name}" /> + <TextBlock FontWeight="SemiBold" Text="Organization:" /> + <TextBlock Text="{Binding Machine.Organization.Name}" /> + <TextBlock FontWeight="SemiBold" Text="Total Dye Time:" /> + <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.TotalMachineWorkTime}" /> + <TextBlock FontWeight="SemiBold" Text="Total Dye Meters:" /> + <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.TotalMachineMeters}" /> + <TextBlock FontWeight="SemiBold" Text="Embedded Software Version:" /> + <TextBlock Text="{Binding DeviceInformation.Version}" /> + <TextBlock FontWeight="SemiBold" Text="Session ID:" /> + <TextBlock Text="{Binding Adapter.SessionID}" /> + <TextBlock FontWeight="SemiBold" Text="Total Bytes Sent:" /> + <TextBlock Text="{Binding Adapter.TotalBytesSent,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}" /> + <TextBlock FontWeight="SemiBold" Text="Total Bytes Received:" /> + <TextBlock Text="{Binding Adapter.TotalBytesReceived,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}" /> + <TextBlock FontWeight="SemiBold" Text="Transfer Rate:" /> + <TextBlock> + <Run Text="{Binding Adapter.TransferRate,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}"></Run> + <Run Text="/ sec"></Run> + </TextBlock> + <TextBlock FontWeight="SemiBold" Text="Diagnostics Frame Rate:" /> + <TextBlock> + <Run Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.DiagnosticsFrameProvider.FrameRate,Mode=OneWay,IsAsync=True}"></Run> + <Run Text="/ sec"></Run> + </TextBlock> + <TextBlock FontWeight="SemiBold" Text="Enable Diagnostics:" /> + <ToggleButton IsChecked="{Binding EnableDiagnostics}" HorizontalAlignment="Left"></ToggleButton> + <TextBlock FontWeight="SemiBold" Text="Enable Embedded Debug Logs:" /> + <ToggleButton IsChecked="{Binding EnableEmbeddedDebugging}" HorizontalAlignment="Left"></ToggleButton> + <TextBlock FontWeight="SemiBold" Text="Enable KeepAlive:" /> + <ToggleButton IsChecked="{Binding UseKeepAlive}" HorizontalAlignment="Left"></ToggleButton> + <TextBlock FontWeight="SemiBold" Text="Enable Events:" /> + <ToggleButton IsChecked="{Binding EnableEventsNotification}" HorizontalAlignment="Left"></ToggleButton> + <TextBlock FontWeight="SemiBold" Text="Enable Application Logs:" /> + <ToggleButton IsChecked="{Binding EnableApplicationLogs}" HorizontalAlignment="Left"></ToggleButton> + </controls:TableGrid> + </DataTemplate> + <DataTemplate DataType="{x:Type integration:ExternalBridgeTcpClient}"> <controls:TableGrid RowHeight="22"> <TextBlock FontWeight="SemiBold" Text="Serial Number:" /> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectionLostView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectionLostView.xaml index b2fa2b3e3..ba5624592 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectionLostView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectionLostView.xaml @@ -7,7 +7,7 @@ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" - Width="559" Height="266" Background="{StaticResource Dialog.Background}" d:DataContext="{d:DesignInstance Type=vm:ConnectionLostViewVM, IsDesignTimeCreatable=False}" Foreground="{StaticResource MainWindow.Foreground}"> + Width="559" Height="350" Background="{StaticResource Dialog.Background}" d:DataContext="{d:DesignInstance Type=vm:ConnectionLostViewVM, IsDesignTimeCreatable=False}" Foreground="{StaticResource MainWindow.Foreground}"> <Grid> <Grid> <Grid.RowDefinitions> @@ -18,7 +18,7 @@ <Grid> <StackPanel Orientation="Horizontal" Margin="10"> <Grid> - <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant"></Image> + <Image Source="{StaticResource MachineSmall}" Width="60" RenderOptions.BitmapScalingMode="Fant"></Image> <Ellipse Fill="#FF2626" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="30" Height="30" Margin="0 0 -5 -5"> </Ellipse> @@ -50,7 +50,12 @@ </Grid> <Grid Grid.Row="1"> - <Button HorizontalAlignment="Right" Width="140" Command="{Binding OKCommand}">CLOSE</Button> + <TextBlock Visibility="{Binding AutoReconnect,Converter={StaticResource BoolToVisConverter}}" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="{StaticResource GrayBrush}"> + <Run>Reconnecting in</Run> + <Run Text="{Binding ReconnectinSeconds}" Foreground="{StaticResource RedBrush300}"></Run> + <Run>seconds...</Run> + </TextBlock> + <Button HorizontalAlignment="Right" Width="140" Command="{Binding CloseCommand}">CLOSE</Button> </Grid> </Grid> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml index df1c1b831..14fcc3a37 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml @@ -16,7 +16,7 @@ <Grid> <Grid HorizontalAlignment="Center" VerticalAlignment="Center"> <StackPanel> - <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant" Width="100"></Image> + <Image Source="{StaticResource MachineBig}" RenderOptions.BitmapScalingMode="Fant" Width="130"></Image> <StackPanel Orientation="Horizontal"> <TextBlock FontSize="70" Foreground="{StaticResource AccentColorBrush}">Machine Studio</TextBlock> </StackPanel> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml index ec6091988..9a3b3405e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml @@ -42,38 +42,102 @@ </Grid.Style> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="40"> - <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant" Width="100"></Image> + <Image Source="{StaticResource MachineBig}" RenderOptions.BitmapScalingMode="Fant" Width="100"></Image> <TextBlock Margin="20 0 0 0" VerticalAlignment="Center" FontSize="70" Foreground="{StaticResource AccentColorBrush}">Machine Studio</TextBlock> </StackPanel> - <DockPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="320" Margin="0 120 0 0" Height="510"> - <Button DockPanel.Dock="Bottom" AutomationProperties.AutomationId="{x:Static automation:UI.LoginButton}" Margin="25 20 0 0" Height="50" Command="{Binding LoginCommand}" Content="LOGIN"></Button> + <Grid> + <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Margin="-600 110 0 0" Visibility="{Binding ShowLoggingDetails,Converter={StaticResource BooleanToVisibilityConverter}}"> + <RadioButton ToolTip="Login using your an active directory account" IsChecked="{Binding IsActiveDirectory}" FontSize="16" VerticalContentAlignment="Center" Padding="10 0 0 0"> + <Image Source="/Images/active_directory.png" Stretch="Uniform" Height="80" RenderOptions.BitmapScalingMode="Fant" /> + </RadioButton> + <RadioButton ToolTip="Login using a standard Machine Studio account" IsChecked="{Binding IsStandardUser}" FontSize="16" Margin="0 20 0 0" VerticalContentAlignment="Center" Padding="10 0 0 0"> + <Image Source="/Images/machinestudio_login.png" Stretch="Uniform" Height="55" RenderOptions.BitmapScalingMode="Fant" /> + </RadioButton> + </StackPanel> + <DockPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="320" Margin="0 120 0 0" Height="510"> - <Grid> - <StackPanel Visibility="{Binding IsLogging,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> - <TextBlock HorizontalAlignment="Center" FontSize="24">Login to your account</TextBlock> - <Image Source="/Images/account.png" RenderOptions.BitmapScalingMode="Fant" Width="100" Margin="0 20 0 0"></Image> - <DockPanel Margin="0 20 0 0"> - <materialDesign:PackIcon Margin="0 0 0 0" Width="20" Height="20" VerticalAlignment="Top" Foreground="{Binding ElementName=txtEmail, Path=BorderBrush}" Kind="EmailOutline" /> - <TextBox x:Name="txtEmail" IsTabStop="True" Margin="5 0 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Email" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="20" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Text="{Binding Email,UpdateSourceTrigger=PropertyChanged,ValidatesOnNotifyDataErrors=True}" AutomationProperties.IsRequiredForForm="True" /> - </DockPanel> - <DockPanel Margin="0 20 0 0"> - <materialDesign:PackIcon Margin="0 0 0 0" Width="20" Height="20" VerticalAlignment="Top" Foreground="{Binding ElementName=txtPass, Path=BorderBrush}" Kind="Key" /> - <PasswordBox x:Name="txtPass" helpers:PasswordHelper.Attach="True" helpers:PasswordHelper.Password="{Binding Password,Mode=TwoWay}" Margin="5 0 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Password" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="20" Style="{StaticResource MaterialDesignFloatingHintPasswordBox}" AutomationProperties.IsRequiredForForm="True" /> - </DockPanel> - <DockPanel Margin="0 40 0 0" IsEnabled="{Binding EnableSlotSelection}"> - <materialDesign:PackIcon Margin="0 0 0 0" Width="20" Height="20" VerticalAlignment="Top" Foreground="{Binding ElementName=combo, Path=BorderBrush}" Kind="Settings" /> - <ComboBox x:Name="combo" ItemsSource="{Binding Source={x:Type web:DeploymentSlot},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding DeploymentSlot}" SelectedValuePath="Value" DisplayMemberPath="DisplayName" Margin="5 0 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Environment" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="20" /> - </DockPanel> - <TextBlock Visibility="{Binding EnableSlotSelection,Converter={StaticResource BooleanToVisibilityInverseConverter}}" Margin="25 0 0 0" FontSize="10" Foreground="Gray">Environment selection requires restarting the application</TextBlock> - <CheckBox Margin="25 20 0 0" IsChecked="{Binding RememberMe}">Remember me</CheckBox> - </StackPanel> + <Grid DockPanel.Dock="Bottom" Margin="25 20 0 0" > + <Button AutomationProperties.AutomationId="{x:Static automation:UI.LoginButton}" Height="50" Command="{Binding LoginCommand}" Content="LOGIN"> + <Button.Style> + <Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}"> + <Setter Property="Visibility" Value="Visible"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsChangingPassword}" Value="True"> + <Setter Property="Visibility" Value="Hidden"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Button.Style> + </Button> - <StackPanel Visibility="{Binding IsLogging,Converter={StaticResource BooleanToVisibilityConverter}}" VerticalAlignment="Center"> - <mahapps:ProgressRing Width="80" Height="80" IsActive="{Binding IsLogging}"></mahapps:ProgressRing> - <TextBlock HorizontalAlignment="Center" Margin="0 30 0 0" FontSize="18" FontStyle="Italic">Logging you in...</TextBlock> - </StackPanel> - </Grid> - </DockPanel> + <Button AutomationProperties.AutomationId="{x:Static automation:UI.LoginButton}" Height="50" Command="{Binding UpdatePasswordCommand}" Content="CHANGE PASSWORD"> + <Button.Style> + <Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}"> + <Setter Property="Visibility" Value="Hidden"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsChangingPassword}" Value="True"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Button.Style> + </Button> + </Grid> + + <Grid> + <StackPanel Visibility="{Binding ShowLoggingDetails,Converter={StaticResource BooleanToVisibilityConverter}}"> + <TextBlock HorizontalAlignment="Center" FontSize="24">Login to your account</TextBlock> + <Image Source="/Images/login.png" RenderOptions.BitmapScalingMode="Fant" Width="100" Margin="0 20 0 0"></Image> + <DockPanel Margin="0 20 0 0"> + <materialDesign:PackIcon Margin="0 0 0 0" Width="20" Height="20" VerticalAlignment="Top" Foreground="{Binding ElementName=txtEmail, Path=BorderBrush}" Kind="EmailOutline" /> + <TextBox x:Name="txtEmail" IsTabStop="True" Margin="5 0 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="20" Text="{Binding Email,UpdateSourceTrigger=PropertyChanged,ValidatesOnNotifyDataErrors=True}" AutomationProperties.IsRequiredForForm="True"> + <TextBox.Style> + <Style TargetType="TextBox" BasedOn="{StaticResource MaterialDesignFloatingHintTextBox}"> + <Setter Property="materialDesign:HintAssist.Hint" Value="Active Directory Email"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsStandardUser}" Value="True"> + <Setter Property="materialDesign:HintAssist.Hint" Value="Machine Studio Email"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBox.Style> + </TextBox> + </DockPanel> + <DockPanel Margin="0 20 0 0"> + <materialDesign:PackIcon Margin="0 0 0 0" Width="20" Height="20" VerticalAlignment="Top" Foreground="{Binding ElementName=txtPass, Path=BorderBrush}" Kind="Key" /> + <PasswordBox x:Name="txtPass" helpers:PasswordHelper.Attach="True" helpers:PasswordHelper.Password="{Binding Password,Mode=TwoWay}" Margin="5 0 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Password" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="20" Style="{StaticResource MaterialDesignFloatingHintPasswordBox}" AutomationProperties.IsRequiredForForm="True" /> + </DockPanel> + <DockPanel Margin="0 40 0 0" IsEnabled="{Binding EnableSlotSelection}"> + <materialDesign:PackIcon Margin="0 0 0 0" Width="20" Height="20" VerticalAlignment="Top" Foreground="{Binding ElementName=combo, Path=BorderBrush}" Kind="Settings" /> + <ComboBox x:Name="combo" ItemsSource="{Binding Source={x:Type web:DeploymentSlot},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding DeploymentSlot}" SelectedValuePath="Value" DisplayMemberPath="DisplayName" Margin="5 0 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Environment" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="20" /> + </DockPanel> + <TextBlock Visibility="{Binding EnableSlotSelection,Converter={StaticResource BooleanToVisibilityInverseConverter}}" Margin="25 0 0 0" FontSize="10" Foreground="Gray">Environment selection requires restarting the application</TextBlock> + <CheckBox Margin="25 20 0 0" IsChecked="{Binding RememberMe}">Remember me</CheckBox> + </StackPanel> + + <StackPanel Visibility="{Binding IsLogging,Converter={StaticResource BooleanToVisibilityConverter}}" VerticalAlignment="Center"> + <Grid> + <ProgressBar Width="300" Height="300" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="{Binding IsLogging}" Style="{StaticResource MaterialDesignCircularProgressBar}" Value="0" /> + <Image Source="{StaticResource MachineBig}" Width="200" RenderOptions.BitmapScalingMode="Fant"></Image> + </Grid> + <TextBlock HorizontalAlignment="Center" Margin="0 30 0 0" FontSize="16" FontStyle="Italic" Foreground="{StaticResource GrayBrush200}" Text="{Binding ProgressLog}"></TextBlock> + </StackPanel> + + <StackPanel Visibility="{Binding IsChangingPassword,Converter={StaticResource BooleanToVisibilityConverter}}"> + <TextBlock HorizontalAlignment="Center" FontSize="24">Password change required</TextBlock> + <Image Source="/Images/login.png" RenderOptions.BitmapScalingMode="Fant" Width="100" Margin="0 20 0 0"></Image> + <DockPanel Margin="0 40 0 0"> + <materialDesign:PackIcon Margin="0 0 0 0" Width="20" Height="20" VerticalAlignment="Top" Foreground="{Binding ElementName=txtNewPass1, Path=BorderBrush}" Kind="Key" /> + <PasswordBox x:Name="txtNewPass1" helpers:PasswordHelper.Attach="True" helpers:PasswordHelper.Password="{Binding NewPassword1,Mode=TwoWay,UpdateSourceTrigger=LostFocus,NotifyOnValidationError=True,ValidatesOnDataErrors=True,ValidatesOnNotifyDataErrors=True}" Margin="5 0 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="New Password" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="20" Style="{StaticResource MaterialDesignFloatingHintPasswordBox}" AutomationProperties.IsRequiredForForm="True" /> + </DockPanel> + <DockPanel Margin="0 40 0 0"> + <materialDesign:PackIcon Margin="0 0 0 0" Width="20" Height="20" VerticalAlignment="Top" Foreground="{Binding ElementName=txtNewPass2, Path=BorderBrush}" Kind="Key" /> + <PasswordBox x:Name="txtNewPass2" helpers:PasswordHelper.Attach="True" helpers:PasswordHelper.Password="{Binding NewPassword2,Mode=TwoWay,UpdateSourceTrigger=LostFocus,NotifyOnValidationError=True,ValidatesOnDataErrors=True,ValidatesOnNotifyDataErrors=True}" Margin="5 0 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Confirm Password" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="20" Style="{StaticResource MaterialDesignFloatingHintPasswordBox}" AutomationProperties.IsRequiredForForm="True" /> + </DockPanel> + </StackPanel> + </Grid> + </DockPanel> + </Grid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml index 69ce4c855..4486467a2 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml @@ -10,7 +10,7 @@ xmlns:emulations="clr-namespace:Tango.Emulations.ExternalBridge;assembly=Tango.Emulations" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300" Width="630" Height="400" Background="{StaticResource Dialog.Background}" DataContext="{Binding MachineConnectionViewVM, Source={StaticResource Locator}}" Foreground="{StaticResource MainWindow.Foreground}"> + d:DesignHeight="300" d:DesignWidth="400" Width="700" Height="500" Background="{StaticResource Dialog.Background}" DataContext="{Binding MachineConnectionViewVM, Source={StaticResource Locator}}" Foreground="{StaticResource MainWindow.Foreground}"> <UserControl.Resources> <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></converters:BooleanToVisibilityConverter> @@ -27,7 +27,7 @@ <Grid> <StackPanel Orientation="Horizontal" Margin="10"> - <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant"></Image> + <Image Source="{StaticResource MachineSmall}" Width="60" RenderOptions.BitmapScalingMode="Fant"></Image> <TextBlock Text="Machine Connection" VerticalAlignment="Center" Margin="10 0 0 0" FontSize="20"></TextBlock> </StackPanel> </Grid> @@ -55,10 +55,28 @@ <Grid Grid.Row="1"> <ListBox ItemsSource="{Binding Scanner.AvailableMachines}" SelectedItem="{Binding SelectedMachine}" Margin="0 0 0 7" BorderThickness="1" BorderBrush="{StaticResource BorderBrushGainsboro}" HorizontalContentAlignment="Stretch"> <ListBox.Resources> + <DataTemplate DataType="{x:Type integration:ExternalBridgeSignalRClient}"> + <DockPanel> + <StackPanel Orientation="Horizontal"> + <Image Source="/Images/external-bridge-signalr.png" Height="45" RenderOptions.BitmapScalingMode="Fant"></Image> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="11"> + <Run FontWeight="Bold">S/N:</Run> <Run Text="{Binding SerialNumber,Mode=OneWay}"></Run> + </TextBlock> + <TextBlock FontSize="11"> + <Run FontWeight="Bold">Hub:</Run> <Run Text="{Binding IPAddress,Mode=OneWay}"></Run> + </TextBlock> + <TextBlock FontSize="11"> + <Run FontWeight="Bold">Organization:</Run> <Run Text="{Binding Machine.Organization.Name,Mode=OneWay}"></Run> + </TextBlock> + </StackPanel> + </StackPanel> + </DockPanel> + </DataTemplate> <DataTemplate DataType="{x:Type integration:ExternalBridgeTcpClient}"> <DockPanel> <StackPanel Orientation="Horizontal"> - <Image Source="/Images/external-bridge-tcp.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="Fant"></Image> + <Image Source="/Images/external-bridge-tcp.png" Height="45" RenderOptions.BitmapScalingMode="Fant"></Image> <StackPanel Margin="10 0 0 0"> <TextBlock FontSize="11"> <Run FontWeight="Bold">S/N:</Run> <Run Text="{Binding SerialNumber,Mode=OneWay}"></Run> @@ -76,7 +94,7 @@ <DataTemplate DataType="{x:Type integration:ExternalBridgeUsbClient}"> <DockPanel> <StackPanel Orientation="Horizontal"> - <Image Source="/Images/external-bridge-usb.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="Fant"></Image> + <Image Source="/Images/external-bridge-usb.png" Height="45" RenderOptions.BitmapScalingMode="Fant"></Image> <StackPanel Margin="10 0 0 0"> <TextBlock FontSize="11"> <Run FontWeight="Bold">Port:</Run> <Run Text="{Binding ComPort,Mode=OneWay}"></Run> @@ -91,7 +109,7 @@ <DataTemplate DataType="{x:Type emulations:EmulatorExternalBridge}"> <DockPanel> <StackPanel Orientation="Horizontal"> - <Image Source="/Images/external-bridge-emulator.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="Fant"></Image> + <Image Source="/Images/external-bridge-emulator.png" Height="45" RenderOptions.BitmapScalingMode="Fant"></Image> <StackPanel Margin="10 0 0 0"> <TextBlock FontSize="11"> <Run Text="External Bridge Emulator"></Run> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineLoginView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineLoginView.xaml index 7d0b2e25c..5be9ba089 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineLoginView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineLoginView.xaml @@ -29,7 +29,7 @@ <StackPanel> <StackPanel Orientation="Horizontal" VerticalAlignment="Top"> <Grid> - <Image Source="../Images/machine-trans.png" Width="42" RenderOptions.BitmapScalingMode="Fant"></Image> + <Image Source="{StaticResource MachineSmall}" Width="60" RenderOptions.BitmapScalingMode="Fant"></Image> <materialDesign:PackIcon Kind="Lock" VerticalAlignment="Bottom" Width="24" Height="24" HorizontalAlignment="Right" Foreground="{StaticResource AccentColorBrush}" /> </Grid> <TextBlock Padding="0 10 0 0" TextWrapping="Wrap" Margin="10 0 0 0" VerticalAlignment="Top" FontSize="18" Text="Machine Login" Width="400"></TextBlock> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineSerialView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineSerialView.xaml index eea90c7b9..2393ab6e7 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineSerialView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineSerialView.xaml @@ -23,7 +23,7 @@ <Grid> <StackPanel Orientation="Horizontal" Margin="10"> - <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant"></Image> + <Image Source="{StaticResource MachineSmall}" Width="60" RenderOptions.BitmapScalingMode="Fant"></Image> <TextBlock Text="Virtual Machine" VerticalAlignment="Center" Margin="10 0 0 0" FontSize="20"></TextBlock> </StackPanel> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml index 5513b65ac..15f2a30e0 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -11,6 +11,8 @@ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:common="clr-namespace:Tango.MachineStudio.Common;assembly=Tango.MachineStudio.Common" xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" + xmlns:operations="clr-namespace:Tango.Integration.Operation;assembly=Tango.Integration" + xmlns:gif="clr-namespace:Tango.AnimatedGif;assembly=Tango.AnimatedGif" xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" @@ -26,6 +28,7 @@ <converters:StringToWordsConverter x:Key="StringToWordsConverter" /> <commonConverters:PermissionToVisibilityConverter x:Key="PermissionToVisibilityConverter" /> <converters:VersionToShortVersionConverter x:Key="VersionToShortVersionConverter" /> + <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" /> </UserControl.Resources> <Grid> @@ -47,48 +50,19 @@ <DockPanel LastChildFill="False" TextElement.Foreground="{StaticResource MainWindow.Foreground}" > <StackPanel MinWidth="300" DockPanel.Dock="Top"> <Grid> + <Button Foreground="{StaticResource BlackBrush}" Style="{StaticResource MaterialDesignFlatButton}" Command="{Binding HomeCommand}" HorizontalAlignment="Left" HorizontalContentAlignment="Left" Margin="5 10 0 0" Width="200" Height="40" Padding="5 8 8 8"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon VerticalAlignment="Center" Kind="Home" Width="32" Height="32"></materialDesign:PackIcon> + <TextBlock FontSize="16" VerticalAlignment="Center" Margin="10 0 0 0">Home</TextBlock> + </StackPanel> + </Button> + <ToggleButton Style="{StaticResource MaterialDesignHamburgerToggleButton}" HorizontalAlignment="Right" Margin="16" IsChecked="{Binding Source={x:Reference MenuToggleButton}, Path=IsChecked, Mode=TwoWay}" /> - - <StackPanel Margin="5 0 0 0" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center"> - <Image Source="/Images/account.png" RenderOptions.BitmapScalingMode="Fant" VerticalAlignment="Center" Width="50" Height="50"></Image> - <StackPanel Margin="0 5 0 0"> - <TextBlock FontSize="16" TextTrimming="CharacterEllipsis" MaxWidth="170" FontStyle="Italic" FontWeight="Bold" Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding AuthenticationProvider.CurrentUser.Contact.FullName}"></TextBlock> - <TextBlock FontSize="12" TextTrimming="CharacterEllipsis" MaxWidth="170" FontStyle="Italic" Margin="10 5 0 0" VerticalAlignment="Center"> - <Run Text="{Binding AuthenticationProvider.CurrentUser.Organization.Name}"></Run> - , - <Run Text="{Binding AuthenticationProvider.CurrentUser.Roles[0].Name}"> - <Run.ToolTip> - <ItemsControl ItemsSource="{Binding AuthenticationProvider.CurrentUser.Roles}"> - <ItemsControl.ItemTemplate> - <DataTemplate> - <StackPanel Orientation="Horizontal" Margin="2"> - <materialDesign:PackIcon Kind="AccountKey" Width="16" Height="16" /> - <TextBlock Margin="5 0 0 0" Text="{Binding Name}"></TextBlock> - </StackPanel> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - </Run.ToolTip> - </Run> - <Run>...</Run> - </TextBlock> - </StackPanel> - </StackPanel> </Grid> <StackPanel Margin="0 16 0 0"> - <ListBoxItem> - <i:Interaction.Triggers> - <i:EventTrigger EventName="PreviewMouseUp"> - <i:InvokeCommandAction Command="{Binding HomeCommand}"></i:InvokeCommandAction> - </i:EventTrigger> - </i:Interaction.Triggers> - <StackPanel Orientation="Horizontal"> - <materialDesign:PackIcon VerticalAlignment="Center" Kind="Home" Width="32" Height="32"></materialDesign:PackIcon> - <TextBlock FontSize="16" VerticalAlignment="Center" Margin="10 0 0 0">Home</TextBlock> - </StackPanel> - </ListBoxItem> + </StackPanel> <StackPanel Margin="10 10 0 0"> <TextBlock Foreground="{StaticResource borderBrush}" FontSize="16" FontWeight="Bold" FontStyle="Italic">MODULES</TextBlock> @@ -96,7 +70,7 @@ </StackPanel> <ListBox ItemsSource="{Binding StudioModuleLoader.UserModules}" HorizontalContentAlignment="Stretch" FontSize="14"> <ListBox.ItemContainerStyle> - <Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}"> + <Style TargetType="ListBoxItem" BasedOn="{StaticResource MaterialDesignListBoxItem}"> <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter> <Setter Property="VerticalContentAlignment" Value="Stretch"></Setter> <Setter Property="Visibility" Value="{Binding InNewWindow,Converter={StaticResource BooleanToVisibilityInverseConverter}}"></Setter> @@ -145,8 +119,36 @@ <materialDesign:ColorZone Padding="16" materialDesign:ShadowAssist.ShadowDepth="Depth2" Mode="PrimaryMid" DockPanel.Dock="Top" Background="{StaticResource MainWindow.Header}"> <DockPanel> - <ToggleButton Style="{StaticResource MaterialDesignHamburgerToggleButton}" IsChecked="{Binding IsMenuOpened}" + <StackPanel Orientation="Horizontal"> + <ToggleButton VerticalAlignment="Center" Style="{StaticResource MaterialDesignHamburgerToggleButton}" IsChecked="{Binding IsMenuOpened}" x:Name="MenuToggleButton"/> + + <StackPanel Margin="10 0 0 0" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center"> + <Image Source="/Images/login_white.png" RenderOptions.BitmapScalingMode="Fant" VerticalAlignment="Center" Width="50" Height="50"></Image> + <StackPanel Margin="0 5 0 0"> + <TextBlock FontSize="16" TextTrimming="CharacterEllipsis" MaxWidth="170" FontStyle="Italic" FontWeight="Bold" Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding AuthenticationProvider.CurrentUser.Contact.FullName}"></TextBlock> + <TextBlock FontSize="12" TextTrimming="CharacterEllipsis" MaxWidth="170" FontStyle="Italic" Margin="10 5 0 0" VerticalAlignment="Center"> + <Run Text="{Binding AuthenticationProvider.CurrentUser.Organization.Name}"></Run> + , + <Run Text="{Binding AuthenticationProvider.CurrentUser.Roles[0].Name}"> + <Run.ToolTip> + <ItemsControl ItemsSource="{Binding AuthenticationProvider.CurrentUser.Roles}"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal" Margin="2"> + <materialDesign:PackIcon Kind="AccountKey" Width="16" Height="16" /> + <TextBlock Margin="5 0 0 0" Text="{Binding Name}"></TextBlock> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </Run.ToolTip> + </Run> + <Run>...</Run> + </TextBlock> + </StackPanel> + </StackPanel> + </StackPanel> <materialDesign:PopupBox DockPanel.Dock="Right" PlacementMode="BottomAndAlignRightEdges" StaysOpen="False" > <StackPanel> <Button Command="{Binding ConnectCommand}"> @@ -228,10 +230,71 @@ </StackPanel> </materialDesign:PopupBox> <Grid> - <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Height="60" HorizontalAlignment="Center"> - <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant"></Image> - <TextBlock Text="Machine Studio" VerticalAlignment="Center" Margin="20 0 0 0" FontSize="36"/> - </StackPanel> + + <Grid> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Height="60" HorizontalAlignment="Center"> + <StackPanel.Style> + <Style TargetType="StackPanel"> + <Style.Triggers> + <DataTrigger Binding="{Binding IsModuleLoaded}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" To="0" Duration="00:00:0.5" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="00:00:0.5" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </StackPanel.Style> + <Image Source="{StaticResource MachineSmall}" RenderOptions.BitmapScalingMode="Fant"></Image> + <TextBlock VerticalAlignment="Center" Margin="20 0 0 0" FontSize="36" Text="Machine Studio"> + </TextBlock> + </StackPanel> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Height="60" HorizontalAlignment="Center"> + <StackPanel.Style> + <Style TargetType="StackPanel"> + <Setter Property="Opacity" Value="0"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsModuleLoaded}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="00:00:0.5" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" To="0" Duration="00:00:0.5" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </StackPanel.Style> + <Grid> + <Ellipse Height="50" Width="50" VerticalAlignment="Center" StrokeThickness="1" Stroke="White"> + <Ellipse.Fill> + <ImageBrush ImageSource="{Binding CurrentModule.Image}" RenderOptions.BitmapScalingMode="Fant" /> + </Ellipse.Fill> + </Ellipse> + <Image Source="{StaticResource MachineSmall}" RenderOptions.BitmapScalingMode="Fant" Width="25" Margin="-40 0 0 -30" ></Image> + </Grid> + <TextBlock VerticalAlignment="Center" Margin="20 0 0 0" FontSize="36" Text="{Binding CurrentModule.Name}"> + </TextBlock> + </StackPanel> + </Grid> <Grid HorizontalAlignment="Right"> <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> @@ -274,6 +337,66 @@ </StackPanel> </Button> + <Grid Height="Auto" Width="Auto" VerticalAlignment="Center" Margin="5 0 20 0" ToolTip="{Binding ApplicationManager.ConnectedMachine.Status,Converter={StaticResource EnumToDescriptionConverter}}"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Visibility" Value="Visible"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ApplicationManager.ConnectedMachine}" Value="{x:Null}"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + <Ellipse Width="40" Height="40"> + <Ellipse.Fill> + <RadialGradientBrush> + <GradientStop Offset="0" Color="White" /> + <GradientStop Offset="1" Color="#6BFFFFFF" /> + </RadialGradientBrush> + </Ellipse.Fill> + </Ellipse> + + <Image x:Name="Image_MachineStatus" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Width="23" Height="23" VerticalAlignment="Center" + gif:ImageBehavior.EnableAnimation="True" + gif:ImageBehavior.SpeedRatio="1"> + <Image.Style> + <Style TargetType="Image"> + <Setter Property="gif:ImageBehavior.AnimatedSource" Value="{x:Null}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ApplicationManager.ConnectedMachine.Status}" Value="{x:Static operations:MachineStatuses.Disconnected}"> + <Setter Property="gif:ImageBehavior.AnimatedSource" Value="/Images/Statuses/machine_off_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding ApplicationManager.ConnectedMachine.Status}" Value="{x:Static operations:MachineStatuses.PowerUp}"> + <Setter Property="gif:ImageBehavior.AnimatedSource" Value="/Images/Statuses/getting_ready_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding ApplicationManager.ConnectedMachine.Status}" Value="{x:Static operations:MachineStatuses.Standby}"> + <Setter Property="gif:ImageBehavior.AnimatedSource" Value="/Images/Statuses/standby_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding ApplicationManager.ConnectedMachine.Status}" Value="{x:Static operations:MachineStatuses.ReadyToDye}"> + <Setter Property="gif:ImageBehavior.AnimatedSource" Value="/Images/Statuses/Ready_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding ApplicationManager.ConnectedMachine.Status}" Value="{x:Static operations:MachineStatuses.GettingReady}"> + <Setter Property="gif:ImageBehavior.AnimatedSource" Value="/Images/Statuses/getting_ready_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding ApplicationManager.ConnectedMachine.Status}" Value="{x:Static operations:MachineStatuses.Printing}"> + <Setter Property="gif:ImageBehavior.AnimatedSource" Value="/Images/Statuses/dyeing_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding ApplicationManager.ConnectedMachine.Status}" Value="{x:Static operations:MachineStatuses.ShuttingDown}"> + <Setter Property="gif:ImageBehavior.AnimatedSource" Value="/Images/Statuses/shutdown_icon_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding ApplicationManager.ConnectedMachine.Status}" Value="{x:Static operations:MachineStatuses.Error}"> + <Setter Property="gif:ImageBehavior.AnimatedSource" Value="/Images/Statuses/error_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding ApplicationManager.ConnectedMachine.Status}" Value="{x:Static operations:MachineStatuses.Service}"> + <Setter Property="gif:ImageBehavior.AnimatedSource" Value="/Images/Statuses/service_Anim.gif"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Image.Style> + </Image> + </Grid> + <ToggleButton Visibility="{Binding ApplicationManager.ConnectedMachine.MachineEventsStateProvider.HasEvents,Converter={StaticResource BooleanToVisibilityConverter},FallbackValue=Collapsed,TargetNullValue=Collapsed,Mode=OneWay}" IsChecked="{Binding IsMachineErrorsOpened}" Style="{StaticResource emptyToggleButton}" Margin="0 0 10 0" Cursor="Hand"> <ToggleButton.ToolTip> <TextBlock> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ShutdownView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ShutdownView.xaml index cc1060b2a..6bda3fe2d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ShutdownView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ShutdownView.xaml @@ -10,7 +10,7 @@ <Grid> <Grid HorizontalAlignment="Center" VerticalAlignment="Center"> <StackPanel> - <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant" Width="100"></Image> + <Image Source="{StaticResource MachineSmall}" RenderOptions.BitmapScalingMode="Fant" Width="130"></Image> <StackPanel Orientation="Horizontal"> <TextBlock FontSize="70" Foreground="Gray">Machine Studio</TextBlock> </StackPanel> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/UpdateView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/UpdateView.xaml index a35928e12..924db7f8b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/UpdateView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/UpdateView.xaml @@ -109,12 +109,12 @@ </StackPanel> </Button> - <Button Visibility="{Binding IsRollbackAvailable,Converter={StaticResource BoolToVisConverter}}" MinWidth="140" Height="40" Style="{StaticResource MaterialDesignFlatButton}" ToolTip="Restore Machine Studio to the previous version." Margin="0 40 0 0" Command="{Binding RollbackCommand}" Foreground="{StaticResource RedBrush100}"> + <!--<Button Visibility="{Binding IsRollbackAvailable,Converter={StaticResource BoolToVisConverter}}" MinWidth="140" Height="40" Style="{StaticResource MaterialDesignFlatButton}" ToolTip="Restore Machine Studio to the previous version." Margin="0 40 0 0" Command="{Binding RollbackCommand}" Foreground="{StaticResource RedBrush100}"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon Kind="BackupRestore" Width="24" Height="24" /> <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Restore previous version</TextBlock> </StackPanel> - </Button> + </Button>--> </StackPanel> </Grid> </Setter.Value> @@ -185,12 +185,12 @@ <TextBlock VerticalAlignment="Center" Margin="0 20 0 0">Your version of Machine Studio is up to date!</TextBlock> </StackPanel> - <Button Visibility="{Binding IsRollbackAvailable,Converter={StaticResource BoolToVisConverter}}" MinWidth="140" Height="40" Style="{StaticResource MaterialDesignFlatButton}" ToolTip="Restore Machine Studio to the previous version." Margin="0 40 0 0" Command="{Binding RollbackCommand}" Foreground="{StaticResource RedBrush100}"> + <!--<Button Visibility="{Binding IsRollbackAvailable,Converter={StaticResource BoolToVisConverter}}" MinWidth="140" Height="40" Style="{StaticResource MaterialDesignFlatButton}" ToolTip="Restore Machine Studio to the previous version." Margin="0 40 0 0" Command="{Binding RollbackCommand}" Foreground="{StaticResource RedBrush100}"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon Kind="BackupRestore" Width="24" Height="24" /> <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Restore previous version</TextBlock> </StackPanel> - </Button> + </Button>--> </StackPanel> </Grid> </Setter.Value> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ExceptionWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ExceptionWindow.xaml index 25fe4af5d..6b80fad43 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ExceptionWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ExceptionWindow.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Windows" mc:Ignorable="d" - WindowStyle="None" ResizeMode="NoResize" Topmost="True" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Width="800" Height="600" Background="Transparent" d:DataContext="{d:DesignInstance Type=local:ExceptionWindow, IsDesignTimeCreatable=False}"> + WindowStyle="None" ResizeMode="NoResize" Topmost="True" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Width="800" Height="600" Background="Transparent" d:DataContext="{d:DesignInstance Type=local:ExceptionWindow, IsDesignTimeCreatable=False}" FontFamily="{StaticResource flexo}" > <Grid> <Border BorderThickness="1" BorderBrush="DodgerBlue" Background="{StaticResource Dialog.Background}" Margin="10" CornerRadius="10"> <Border.Effect> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ModuleWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ModuleWindow.xaml index 47b36070a..5db0277cc 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ModuleWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ModuleWindow.xaml @@ -10,7 +10,7 @@ xmlns:views="clr-namespace:Tango.MachineStudio.UI.Views" xmlns:sharedControls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" mc:Ignorable="d" - Title="{Binding RelativeSource={RelativeSource Self},Path=ModuleContext.Module.Name}" Height="800" Width="1280" WindowStartupLocation="CenterOwner" WindowState="Maximized" Foreground="#494949" BorderThickness="1" BorderBrush="{StaticResource AccentColorBrush}"> + Title="Machine Studio" Height="800" Width="1280" WindowStartupLocation="CenterOwner" WindowState="Maximized" Foreground="#494949" BorderThickness="1" BorderBrush="{StaticResource AccentColorBrush}" FontFamily="{StaticResource flexo}"> <Window.Resources> <converters:StringEllipsisConverter x:Key="StringEllipsisConverter" /> @@ -29,8 +29,16 @@ <DockPanel> <Grid> <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Height="60" HorizontalAlignment="Center"> - <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant"></Image> - <TextBlock Text="Machine Studio" VerticalAlignment="Center" Margin="20 0 0 0" FontSize="36"/> + <Grid> + <Ellipse Height="50" Width="50" VerticalAlignment="Center" StrokeThickness="1" Stroke="White"> + <Ellipse.Fill> + <ImageBrush ImageSource="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=ModuleContext.Module.Image}" RenderOptions.BitmapScalingMode="Fant" /> + </Ellipse.Fill> + </Ellipse> + <Image Source="{StaticResource MachineSmall}" RenderOptions.BitmapScalingMode="Fant" Width="25" Margin="-40 0 0 -30" ></Image> + </Grid> + <TextBlock VerticalAlignment="Center" Margin="20 0 0 0" FontSize="36" Text="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=ModuleContext.Module.Name}"> + </TextBlock> </StackPanel> </Grid> </DockPanel> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ModuleWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ModuleWindow.xaml.cs index 7ca062645..cfea78964 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ModuleWindow.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ModuleWindow.xaml.cs @@ -12,6 +12,8 @@ using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; +using Tango.Core.DI; +using Tango.MachineStudio.Common.StudioApplication; using Tango.MachineStudio.UI.ViewModels; namespace Tango.MachineStudio.UI.Windows @@ -32,6 +34,13 @@ namespace Tango.MachineStudio.UI.Windows public ModuleWindow() { InitializeComponent(); + + ContentRendered += ModuleWindow_ContentRendered; + } + + private void ModuleWindow_ContentRendered(object sender, EventArgs e) + { + Title = "MACHINE STUDIO " + TangoIOC.Default.GetInstance<IStudioApplicationManager>().Version.ToString(3); } public ModuleWindow(MainViewVM mainViewVM, ModuleWindowVM moduleVM, FrameworkElement view) : this() diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/machine_new_small.ico b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/machine_new_small.ico Binary files differnew file mode 100644 index 000000000..dd159c221 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/machine_new_small.ico |
