diff options
| author | Mirta <mirta@twine-s.com> | 2020-12-30 16:39:52 +0200 |
|---|---|---|
| committer | Mirta <mirta@twine-s.com> | 2020-12-30 16:39:52 +0200 |
| commit | 00a491d93733d4625ad329b2ba8237f445364b3f (patch) | |
| tree | 4b24c6fa78d7648f4bb7cefafa464bb0b063fec4 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI | |
| parent | 124ad4150f80c6846fdee41dbbda9848c105f6e5 (diff) | |
| download | Tango-00a491d9.tar.gz Tango-00a491d9.zip | |
merge
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
47 files changed, 292 insertions, 999 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config index d70e2180b..59f92d6b9 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config @@ -152,10 +152,6 @@ <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="Z.EntityFramework.Extensions" publicKeyToken="59b66d028979105b" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.50.0" newVersion="4.0.50.0" /> - </dependentAssembly> </assemblyBinding> </runtime> </configuration>
\ No newline at end of file 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 7eab5066a..8309500b7 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs @@ -23,37 +23,21 @@ using Tango.MachineStudio.UI.Views; using Tango.MachineStudio.Common; using Tango.Core; using Tango.BL; -using Tango.Integration.Operation; -using System.Net; -using System.Globalization; -using System.Windows.Markup; 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; } = Environment.GetCommandLineArgs().Skip(1).ToArray(); + public static String[] StartupArgs { get; set; } protected override void OnStartup(StartupEventArgs e) { - //Set culture info. - var enUSCulture = new CultureInfo("en-US"); - - Thread.CurrentThread.CurrentCulture = enUSCulture; - Thread.CurrentThread.CurrentUICulture = enUSCulture; - CultureInfo.DefaultThreadCurrentCulture = enUSCulture; - CultureInfo.DefaultThreadCurrentUICulture = enUSCulture; - - FrameworkElement.LanguageProperty.OverrideMetadata( - typeof(FrameworkElement), - new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); - StartupArgs = e.Args; #if DEBUG @@ -77,14 +61,7 @@ namespace Tango.MachineStudio.UI #if DEBUG LogManager.RegisterLogger(new VSOutputLogger()); #endif - 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.RegisterLogger(new FileLogger()); LogManager.Log("Application Started..."); @@ -95,30 +72,24 @@ namespace Tango.MachineStudio.UI base.OnStartup(e); - exceptionTrapper = new WpfGlobalExceptionTrapper(); - exceptionTrapper.Initialize(this); - exceptionTrapper.ApplicationCrashed += ExceptionTrapper_ApplicationCrashed; - - ApplyEFCacheSettings(); + LogManager.Categories.Clear(); - WebRequest.DefaultWebProxy = null; - GetLastApplicationCrashFromWindows(); - } - - private async void GetLastApplicationCrashFromWindows() - { - var logItem = await exceptionTrapper.GetLastApplicationCrashEventLog(); - if (logItem != null) + if (settings.LoggingCategories.Count == 0) { - LogManager.Log(logItem); + settings.LoggingCategories.Add(LogCategory.Critical); + settings.LoggingCategories.Add(LogCategory.Error); + settings.LoggingCategories.Add(LogCategory.Info); + settings.LoggingCategories.Add(LogCategory.Warning); } - } - private void ApplyEFCacheSettings() - { - var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); + LogManager.Categories.AddRange(settings.LoggingCategories); + + exceptionTrapper = new WpfGlobalExceptionTrapper(); + exceptionTrapper.Initialize(this); + exceptionTrapper.ApplicationCrashed += ExceptionTrapper_ApplicationCrashed; + //Apply Caching if (settings.CachingMode != ObservablesContextInMemoryCachingMode.None) { LogManager.Log("EF Caching is enabled."); @@ -137,7 +108,9 @@ namespace Tango.MachineStudio.UI { LogManager.Log("EF Caching is disabled"); } + } + #region Global Exception Trapping @@ -159,12 +132,15 @@ namespace Tango.MachineStudio.UI } catch { } - if (e.Exception.ToString().Contains("A Task's exception(s) were not observed")) + try { - e.TryRecover = true; - LogManager.Log("Task not observed exception. Ignoring..."); - return; + var eventLogger = TangoIOC.Default.GetInstance<IEventLogger>(); + if (eventLogger != null) + { + eventLogger.Log(e.Exception, "Application Crashed!"); + } } + catch { } Application.Current.Dispatcher.Invoke(() => { 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 26938b203..3cc5e8b49 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs @@ -90,16 +90,13 @@ 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, LoginMethod method, bool bypassVersionCheck = false, Action<String> logAction = null) + public AuthenticationLoginResult Login(string email, string password, bool bypassVersionCheck = false) { _refreshTokenTimer.Stop(); var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); - if (!App.StartupArgs.Contains("-webDebug")) - { - _client.Environment = settings.DeploymentSlot; - } + _client.Environment = settings.DeploymentSlot; var appVersion = AssemblyHelper.GetCurrentAssemblyVersion().ToString(); @@ -112,15 +109,12 @@ 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; } @@ -147,20 +141,9 @@ namespace Tango.MachineStudio.UI.Authentication }; } - if (response.PasswordChangeRequired) - { - return new AuthenticationLoginResult() - { - Response = response - }; - } - try { - ObservablesStaticCollections.Instance.Initialize((x) => - { - logAction.Invoke(x); - }); + ObservablesStaticCollections.Instance.Initialize(); } catch (Exception ex) { @@ -169,7 +152,6 @@ 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) @@ -181,8 +163,6 @@ namespace Tango.MachineStudio.UI.Authentication _refreshTokenTimer.Start(); - logAction.Invoke("Starting application..."); - return new AuthenticationLoginResult() { User = user, diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindow.xaml index cc2c1fd46..0408319ea 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Console/ConsoleWindow.xaml @@ -156,12 +156,12 @@ <RowDefinition Height="200*"/> </Grid.RowDefinitions> - <!--<controls:ScriptEditorControl BorderThickness="0 1 0 0" + <controls:ScriptEditorControl BorderThickness="0 1 0 0" BorderBrush="#616161" Text="{Binding Code,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" RunCommand="{Binding RunCommand}" StopCommand="{Binding StopCommand}" IntellisenseTypes="{Binding IntellisenseTypes}" - HighlightTypes="{Binding HighlightTypes}"/>--> + HighlightTypes="{Binding HighlightTypes}"/> <GridSplitter Grid.Row="1" Background="{StaticResource DarkGrayBrush100}" Foreground="{StaticResource DarkGrayBrush200}" BorderBrush="{StaticResource DarkGrayBrush200}" Height="5" HorizontalAlignment="Stretch" VerticalAlignment="Center" /> 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 differdeleted file mode 100644 index 4cced33e0..000000000 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/active_directory.png +++ /dev/null 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 254fc819a..cb159d4a6 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 differdeleted file mode 100644 index bda45ffd2..000000000 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-signalr.png +++ /dev/null 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 04e47f539..192cbcaa7 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 07814e7de..414bbab04 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 differdeleted file mode 100644 index 9f7d0b9ba..000000000 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/login.png +++ /dev/null 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 differdeleted file mode 100644 index 10a054147..000000000 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/login_white.png +++ /dev/null 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 differdeleted file mode 100644 index 98f1b286a..000000000 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/machinestudio_login.png +++ /dev/null diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml index 054d7b9d8..a76749b05 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}" FontFamily="{StaticResource flexo}" + Title="Tango" Height="800" Width="1280" Foreground="{StaticResource MainWindow.Foreground}" 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/MainWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs index 2e201b6af..915deb484 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs @@ -1,10 +1,8 @@ using MahApps.Metro.Controls; using System; using System.Collections.Generic; -using System.Globalization; using System.Linq; using System.Text; -using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; 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 939adf5d5..41405f7fb 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" FontFamily="{StaticResource flexo}" > + Title="Machine Studio" MinHeight="220" SizeToContent="WidthAndHeight" MinWidth="600" AllowsTransparency="True" WindowStyle="None" WindowStartupLocation="CenterOwner" Background="Transparent" ShowInTaskbar="False"> <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 c26fae591..988e3c21f 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" FontFamily="{StaticResource flexo}" > + Title="Machine Studio" MinHeight="220" MaxHeight="600" SizeToContent="Height" Width="570" Opacity="0" AllowsTransparency="True" WindowStyle="None" WindowStartupLocation="CenterOwner" Background="Transparent" ShowInTaskbar="False"> <Window.Resources> <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></BooleanToVisibilityConverter> @@ -31,7 +31,7 @@ <Grid> <StackPanel Orientation="Horizontal" VerticalAlignment="Top" Margin="0 30 0 0"> <materialDesign:PackIcon Kind="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=IconKind}" VerticalAlignment="Top" Width="50" Height="50" Foreground="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=IconColor}" /> - <TextBox Style="{x:Null}" BorderThickness="0" Background="Transparent" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" IsReadOnly="True" Padding="0 10 0 0" TextWrapping="Wrap" Margin="10 0 0 0" VerticalAlignment="Top" FontSize="14" Text="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=Message}" Width="400" Foreground="{StaticResource Dialog.Foreground}"></TextBox> + <TextBlock Padding="0 10 0 0" TextWrapping="Wrap" Margin="10 0 0 0" VerticalAlignment="Top" FontSize="14" Text="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=Message}" Width="400" Foreground="{StaticResource Dialog.Foreground}"></TextBlock> </StackPanel> </Grid> </DockPanel> 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 fc777ac7f..a43fafb46 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" FontFamily="{StaticResource flexo}" Foreground="{StaticResource Dialog.Foreground}" > + Title="Machine Studio" MinHeight="220" MaxHeight="600" SizeToContent="Height" Width="570" Opacity="0" AllowsTransparency="True" WindowStyle="None" WindowStartupLocation="CenterOwner" Background="Transparent" ShowInTaskbar="False"> <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 4f9bee934..9d843369e 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.2.6.0")] +[assembly: AssemblyVersion("4.0.31.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 feed9e193..0235f8cca 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -42,7 +42,6 @@ namespace Tango.MachineStudio.UI.StudioApplication private INotificationProvider _notification; private List<Window> _openedWindows; private List<IStudioViewModel> _notified_view_models; - private bool _isDialogShown; /// <summary> /// Occurs when the application is ready. @@ -50,11 +49,6 @@ 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> @@ -138,28 +132,15 @@ namespace Tango.MachineStudio.UI.StudioApplication { String failed_reason = (sender as IMachineOperator).FailedStateException.Message; - if (!_isDialogShown) + ConnectionLostViewVM vm = new ConnectionLostViewVM() { - _isDialogShown = true; + Exception = failed_reason + }; - ConnectionLostViewVM vm = new ConnectionLostViewVM() - { - Exception = failed_reason, - AutoReconnect = true, - }; - - InvokeUI(() => - { - _notification.ShowModalDialog<ConnectionLostViewVM, ConnectionLostView>(vm, (x) => - { - _isDialogShown = false; - ReconnectionRequired?.Invoke(this, new EventArgs()); - }, () => - { - _isDialogShown = false; - }); - }); - } + InvokeUI(() => + { + _notification.ShowModalDialog<ConnectionLostViewVM, ConnectionLostView>(vm, (x) => { }, () => { }); + }); } } } @@ -291,7 +272,7 @@ namespace Tango.MachineStudio.UI.StudioApplication var eventLogger = TangoIOC.Default.GetInstance<IEventLogger>(); if (eventLogger != null) { - //eventLogger.Log(EventTypes.APPLICATION_TERMINATED, "Application Terminated!"); + eventLogger.Log(EventTypes.APPLICATION_TERMINATED, "Application Terminated!"); eventLogger.FlushAll(); } 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 b716ed1fb..31b330c3f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs @@ -15,10 +15,8 @@ using Tango.Core.Helpers; using Tango.Core.IO; using Tango.Integration.Operation; using Tango.Logging; -using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Authentication; using Tango.MachineStudio.Common.StudioApplication; -using Tango.Settings; using Tango.SharedUI.Helpers; using Tango.TFS; @@ -161,7 +159,6 @@ namespace Tango.MachineStudio.UI.TFS item.Severity = Severity.Medium; item.State = State.New; item.Type = WorkItemType.Bug; - item.Environment = SettingsManager.Default.GetOrCreate<MachineStudioSettings>().DeploymentSlot.ToDescription(); foreach (var window in Application.Current.Windows.OfType<Window>().Where(x => !String.IsNullOrWhiteSpace(x.Title))) { @@ -188,22 +185,6 @@ 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>(); @@ -211,55 +192,31 @@ 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) { - string[] logFiles = GetLogFiles(appFileLogger); - foreach( string file in logFiles) - { - 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), - }); - } - } + var appLogFile = _tempFolder.CreateImaginaryFile(); + File.Copy(appFileLogger.LogFile, appLogFile.Path); - if (embeddedFileLogger != null && File.Exists(embeddedFileLogger.LogFile)) - { - string[] logFiles = GetLogFiles(embeddedFileLogger); - foreach (string file in logFiles) + item.Attachments.Add(new Attachment() { - 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), - }); - } + Description = "Application Log File", + FilePath = appLogFile.Path, + Name = Path.GetFileName(appFileLogger.LogFile), + }); } - //Add session log file.. - if (MachineOperator.EnableSessionLogFile) + if (embeddedFileLogger != null && File.Exists(embeddedFileLogger.LogFile)) { - var file = MachineOperator.SessionLogger.LogFile; + var embeddedLogFile = _tempFolder.CreateImaginaryFile(); + File.Copy(embeddedFileLogger.LogFile, embeddedLogFile.Path); - if (file != null && File.Exists(file)) + item.Attachments.Add(new Attachment() { - var sessionLogFile = _tempFolder.CreateImaginaryFile(); - File.Copy(file, sessionLogFile.Path); - item.Attachments.Add(new Attachment() - { - Description = "Session Log File", - FilePath = sessionLogFile.Path, - Name = Path.GetFileName(file), - }); - } + Description = "Embedded Log File", + FilePath = embeddedLogFile.Path, + Name = Path.GetFileName(embeddedFileLogger.LogFile), + }); } SystemInformationModel sysModel = new SystemInformationModel(); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamMembersProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamMembersProvider.cs index 464599452..0691ca6bd 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamMembersProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamMembersProvider.cs @@ -13,8 +13,7 @@ namespace Tango.MachineStudio.UI.TFS { public IEnumerable GetSuggestions(string filter) { - var members = TangoIOC.Default.GetInstance<TeamFoundationServiceExtendedClient>().Project.Members; - return members.Where(x => x.AssignName.ToLower().Contains(filter.ToLower())); + return TangoIOC.Default.GetInstance<TeamFoundationServiceExtendedClient>().Project.Members.Where(x => x.AssignName.ToLower().Contains(filter.ToLower())); } } } 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 cd4eb4dd3..3379ef4ae 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_new_small.ico</ApplicationIcon> + <ApplicationIcon>machine.ico</ApplicationIcon> </PropertyGroup> <ItemGroup> <Reference Include="Dragablz, Version=0.0.3.197, Culture=neutral, processorArchitecture=MSIL"> @@ -343,6 +343,14 @@ <DependentUpon>Settings.settings</DependentUpon> <DesignTimeSharedInput>True</DesignTimeSharedInput> </Compile> + <Content Include="..\..\Build\ColorLib\Debug\Tango.ColorLib_v1.dll"> + <Link>Tango.ColorLib_v1.dll</Link> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + <Content Include="..\..\Build\ColorLib\Debug\Tango.ColorLib_v2.dll"> + <Link>Tango.ColorLib_v2.dll</Link> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> <Content Include="..\..\tcc\benchmarks\benchmarks_rgb_lab.csv"> <Link>TCC\benchmarks_rgb_lab.csv</Link> <CopyToOutputDirectory>Always</CopyToOutputDirectory> @@ -351,12 +359,6 @@ <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" /> @@ -418,10 +420,6 @@ <Project>{63561e19-ff5a-414b-a5ef-e30711543e1d}</Project> <Name>Tango.Emulations</Name> </ProjectReference> - <ProjectReference Include="..\..\Tango.Git\Tango.Git.csproj"> - <Project>{99081c0e-065c-4d68-bf60-f82330cca02d}</Project> - <Name>Tango.Git</Name> - </ProjectReference> <ProjectReference Include="..\..\Tango.Integration\Tango.Integration.csproj"> <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> <Name>Tango.Integration</Name> @@ -446,10 +444,6 @@ <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> @@ -466,18 +460,22 @@ <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.ColorLab\Tango.MachineStudio.ColorLab.csproj"> + <Project>{4d183aca-552b-4135-ae81-7c5a8e5fc3b1}</Project> + <Name>Tango.MachineStudio.ColorLab</Name> + </ProjectReference> <ProjectReference Include="..\Modules\Tango.MachineStudio.DataCapture\Tango.MachineStudio.DataCapture.csproj"> <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> @@ -498,10 +496,6 @@ <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> @@ -526,37 +520,6 @@ <Project>{cb0b0aa2-bb24-4bca-a720-45e397684e12}</Project> <Name>Tango.MachineStudio.Common</Name> </ProjectReference> - - <!--ColorLib--> - <ProjectReference Include="..\..\ColorLib\Tango.ColorLib_v4\Tango.ColorLib_v4.vcxproj"> - <Project>{E9528353-7D41-4AA8-BBAC-D65B7FE3A0D6}</Project> - <Name>Tango.ColorLib_v4</Name> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - <OutputItemType>Content</OutputItemType> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </ProjectReference> - <ProjectReference Include="..\..\ColorLib\Tango.ColorLib_v3\Tango.ColorLib_v3.vcxproj"> - <Project>{A3A8ADA0-C150-4E30-A60D-11F291FDBF7A}</Project> - <Name>Tango.ColorLib_v3</Name> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - <OutputItemType>Content</OutputItemType> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </ProjectReference> - <ProjectReference Include="..\..\ColorLib\Tango.ColorLib_v2\Tango.ColorLib_v2.vcxproj"> - <Project>{1A3FC7FB-403C-4B3D-B705-28FCE11317DD}</Project> - <Name>Tango.ColorLib_v2</Name> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - <OutputItemType>Content</OutputItemType> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </ProjectReference> - <ProjectReference Include="..\..\ColorLib\Tango.ColorLib_v1\Tango.ColorLib_v1.vcxproj"> - <Project>{CF4C66B0-CD13-4D31-8133-339A01E7E6F2}</Project> - <Name>Tango.ColorLib_v1</Name> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - <OutputItemType>Content</OutputItemType> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </ProjectReference> - <!--ColorLib--> </ItemGroup> <ItemGroup> <Resource Include="Images\design.png" /> @@ -683,9 +646,7 @@ 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\" -if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)Roslyn\" -if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)lib\"</PostBuildEvent> +if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)ProtoCompilers\"</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"> @@ -696,7 +657,7 @@ if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)lib\"</PostBuildEvent> </Target> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_BuildVersioningStyle="None.None.Increment.DeltaBaseYearDayOfYear" BuildVersion_UpdateFileVersion="True" BuildVersion_DetectChanges="True" BuildVersion_UseGlobalSettings="False" /> + <UserProperties BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="True" BuildVersion_UpdateFileVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.DeltaBaseYearDayOfYear" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs index e0338a319..3fffd69fd 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs @@ -1,7 +1,5 @@ using System; -using System.Linq; using System.Windows; -using Tango.BL.ActionLogs; using Tango.Core.DI; using Tango.Integration.ExternalBridge; using Tango.Logging; @@ -71,19 +69,9 @@ namespace Tango.MachineStudio.UI TangoIOC.Default.Unregister<IDispatcherProvider>(); TangoIOC.Default.Unregister<IFirmwareUpgrader>(); TangoIOC.Default.Unregister<MachineStudioWebClient>(); - TangoIOC.Default.Unregister<IActionLogManager>(); - - 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<MachineStudioWebClient, MachineStudioWebClient>(new MachineStudioWebClient()); TangoIOC.Default.Register<IDispatcherProvider, DefaultDispatcherProvider>(new DefaultDispatcherProvider(Application.Current.Dispatcher)); TangoIOC.Default.Register<INotificationProvider, DefaultNotificationProvider>(); TangoIOC.Default.Register<IAuthenticationProvider, DefaultAuthenticationProvider>(); @@ -95,9 +83,8 @@ 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, "pyulwgs7m3v7pizz3oxusypdkdfw43txggo5mjwu2ouyv2qwprhq")); - + 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 30b2c83fd..16f6938a0 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 jobRuns = await db.JobRuns.Where(x => x.MachineGuid == ApplicationManager.Machine.Guid).Select(x => new { x.StartDate, x.EndDate, x.EndPosition }).ToListAsync(); + var jobs = await db.Jobs.Include(x => x.JobRuns).Where(x => x.MachineGuid == ApplicationManager.Machine.Guid).ToListAsync(); - TotalMachineWorkTime = TimeSpan.FromHours(jobRuns.Select(x => x.EndDate - x.StartDate).Sum(x => x.TotalHours)).ToStringUnlimitedHours(); + TotalMachineWorkTime = TimeSpan.FromHours(jobs.SelectMany(x => x.JobRuns).Select(x => x.EndDate - x.StartDate).Sum(x => x.TotalHours)).ToString(@"hh\:mm\:ss"); - int meters = (int)jobRuns.Select(x => x.EndPosition).Sum(); + int meters = (int)jobs.SelectMany(x => x.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 e96f0ab62..f1f4f69c0 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectionLostViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectionLostViewVM.cs @@ -3,76 +3,12 @@ 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 7d2d8b401..e45c29f73 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/FirmwareUpgradeViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/FirmwareUpgradeViewVM.cs @@ -202,17 +202,11 @@ namespace Tango.MachineStudio.UI.ViewModels { IsFree = true; CanClose = true; - _stream?.Dispose(); UpgradeError = ex.FlattenMessage(); CurrentPage = 3; } } - 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 f4645ecf2..cf34764d9 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs @@ -22,9 +22,6 @@ 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 { @@ -41,7 +38,6 @@ namespace Tango.MachineStudio.UI.ViewModels private Rfc2898Cryptographer cryptographer; private MachineStudioSettings _settings; private MachineStudioWebClient _machineStudioWebClient; - private TaskCompletionSource<object> _updatePasswordCompletionSource; private String _email; /// <summary> @@ -86,14 +82,6 @@ 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. @@ -114,47 +102,6 @@ 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. @@ -162,11 +109,6 @@ 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> @@ -175,7 +117,6 @@ 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>(); @@ -185,22 +126,12 @@ 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); @@ -221,22 +152,13 @@ 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, loginMethod, _settings.ByPassEnvironmentVersionCheck, (progress) => - { - ProgressLog = progress; - }).Response; + LoginResponse result = _authenticationProvider.Login(Email, Password, _settings.ByPassEnvironmentVersionCheck).Response; if (result.VersionChangeRequired && !_settings.ByPassEnvironmentVersionCheck) { @@ -255,113 +177,31 @@ namespace Tango.MachineStudio.UI.ViewModels return; } - if (result.PasswordChangeRequired) - { - StartUpdatePassword().Task.GetAwaiter().GetResult(); - Password = NewPassword1; - Login(); - return; - } - - //_eventLogger.Log(EventTypes.APPLICATION_STARTED, "Application Started!"); + _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(); - EnableSlotSelection = false; + _eventLogger.Log("User logged in."); - IsLogging = false; - ShowLoggingDetails = true; - IsChangingPassword = false; - InvalidateRelayCommands(); + EnableSlotSelection = false; }); } 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()}"); } - } - } - - 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 { + IsLogging = false; 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 5e44bf43d..d1f3cc69e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs @@ -4,7 +4,6 @@ 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; @@ -53,18 +52,7 @@ 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; @@ -120,8 +108,6 @@ 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/MachineLoginViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineLoginViewVM.cs index 81d3f4243..7584617ed 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineLoginViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineLoginViewVM.cs @@ -27,11 +27,6 @@ namespace Tango.MachineStudio.UI.ViewModels public ExternalBridgeLoginIntent Intent { get; set; } /// <summary> - /// Gets or sets a value indicating whether to require safety level operations permission from the remote machine. - /// </summary> - public bool RequireSafetyOperations { get; set; } - - /// <summary> /// Gets or sets the login command. /// </summary> public RelayCommand<String> LoginCommand { get; set; } @@ -46,7 +41,7 @@ namespace Tango.MachineStudio.UI.ViewModels /// </summary> public MachineLoginViewVM() { - Intent = ExternalBridgeLoginIntent.Diagnostics; + Intent = ExternalBridgeLoginIntent.FullControl; LoginCommand = new RelayCommand<string>(Login); CancelCommand = new RelayCommand(Cancel); } 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 4f8c8a9b1..90fe25c8f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -58,9 +58,6 @@ namespace Tango.MachineStudio.UI.ViewModels private IEventLogger _eventLogger; private MachineStudioSettings _settings; private MachineStudioWebClient _machineStudioWebClient; - private IExternalBridgeClient _reconnectionMachine; - private MachineLoginViewVM _reconnectionMachineConfig; - private bool _lastUploadHardwareConfigLocal; /// <summary> /// Gets or sets the current loaded module. @@ -347,20 +344,6 @@ namespace Tango.MachineStudio.UI.ViewModels AboutCommand = new RelayCommand(ShowAboutDialog); ChangeAppThemeCommand = new RelayCommand<MachineStudioTheme>(ChangeTheme); - - ApplicationManager.ReconnectionRequired += ApplicationManager_ReconnectionRequired; - } - - private async void ApplicationManager_ReconnectionRequired(object sender, EventArgs e) - { - if (_reconnectionMachine is IExternalBridgeSecureClient client) - { - ConnectToMachineSecure(client, _reconnectionMachineConfig); - } - else - { - await ConnectToMachineLocal(_reconnectionMachine, _reconnectionMachine.Machine, _lastUploadHardwareConfigLocal); - } } private void MachineEventsStateProvider_EventsResolved(object sender, IEnumerable<MachinesEvent> e) @@ -418,11 +401,13 @@ namespace Tango.MachineStudio.UI.ViewModels String serial = ApplicationManager.ConnectedMachine.SerialNumber; await ApplicationManager.ConnectedMachine.Disconnect(); ApplicationManager.SetConnectedMachine(null); + _eventLogger.Log("Disconnected from machine " + serial); PostMessage(new MachineConnectionChangedMessage() { Machine = null }); } catch (Exception ex) { + _eventLogger.Log(ex, "Error disconnecting from machine."); LogManager.Log(ex, "Could not disconnect from machine."); } finally @@ -470,23 +455,71 @@ 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.Adapter is TcpTransportAdapter) - { - (x.SelectedMachine.Adapter as TcpTransportAdapter).WriteMode = _settings.TcpTransportAdapterWriteMode; } if (x.SelectedMachine.RequiresAuthentication) { - ConnectToMachineSecure(x.SelectedMachine as IExternalBridgeSecureClient); + //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); + } + + InvalidateRelayCommands(); + } + }); } else { @@ -494,15 +527,47 @@ namespace Tango.MachineStudio.UI.ViewModels { if (vm.SelectedMachine != null) { - await ConnectToMachineLocal(x.SelectedMachine, vm.SelectedMachine, x.UploadHardwareConfiguration); + using (NotificationProvider.PushTaskItem("Connecting to " + x.SelectedMachine.ToString() + "...")) + { + try + { + await x.SelectedMachine.Connect(); + x.SelectedMachine.SerialNumber = vm.SelectedMachine.SerialNumber; + ApplicationManager.SetConnectedMachine(x.SelectedMachine); + + PostMessage(new MachineConnectionChangedMessage() { Machine = x.SelectedMachine }); + _eventLogger.Log(String.Format("Successfully connected to machine {0} via USB", x.SelectedMachine.SerialNumber)); + _settings.LastVirtualMachineSerialNumber = vm.SelectedMachine.SerialNumber; + _settings.Save(); + + if (x.UploadHardwareConfiguration) + { + UploadHardwareConfiguration(false); + } + } + catch (Exception ex) + { + LogManager.Log(ex); + + if (x.SelectedMachine != null) + { + _eventLogger.Log(ex, "Error connecting to machine " + x.SelectedMachine.SerialNumber); + } + + _notificationProvider.ShowError("Could not connect to the selected machine." + Environment.NewLine + ex.Message); + + } + + InvalidateRelayCommands(); + } } }); } - base.InvalidateRelayCommands(); + InvalidateRelayCommands(); } - base.InvalidateRelayCommands(); + InvalidateRelayCommands(); }); } else @@ -567,115 +632,6 @@ namespace Tango.MachineStudio.UI.ViewModels InvalidateRelayCommands(); } - private async Task ConnectToMachineLocal(IExternalBridgeClient client, Machine machine, bool uploadHardwareConfig) - { - using (NotificationProvider.PushTaskItem("Connecting to " + client.ToString() + "...")) - { - try - { - _reconnectionMachine = client; - - await client.Connect(); - client.SerialNumber = machine.SerialNumber; - ApplicationManager.SetConnectedMachine(client); - - PostMessage(new MachineConnectionChangedMessage() { Machine = client }); - _settings.LastVirtualMachineSerialNumber = machine.SerialNumber; - _settings.Save(); - - _lastUploadHardwareConfigLocal = uploadHardwareConfig; - - if (uploadHardwareConfig) - { - UploadHardwareConfiguration(false); - } - } - catch (Exception ex) - { - LogManager.Log(ex); - - _notificationProvider.ShowError("Could not connect to the selected machine." + Environment.NewLine + ex.Message); - - } - - 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, - UserName = AuthenticationProvider.CurrentUser.Contact.FullName, - RequireSafetyLevelOperations = config.RequireSafetyOperations - }, new PMR.Integration.ConfigureProtocolRequest() - { - EnableCompression = true, - GenericProtocol = PMR.Integration.GenericMessageProtocol.Bson - }); - - _reconnectionMachine = machine; - _reconnectionMachineConfig = config; - - ApplicationManager.SetConnectedMachine(machine); - machine.SessionClosed -= Machine_SessionClosed; - machine.SessionClosed += Machine_SessionClosed; - PostMessage(new MachineConnectionChangedMessage() { Machine = machine }); - - //if (x.UploadHardwareConfiguration) - //{ - // UploadHardwareConfiguration(false); - //} - - } - catch (ResponseErrorException ex) - { - LogManager.Log(ex); - _notificationProvider.ShowError("Could not connect to the selected machine." + Environment.NewLine + ex.Container.ErrorMessage); - } - catch (Exception ex) - { - LogManager.Log(ex); - _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 @@ -711,7 +667,7 @@ namespace Tango.MachineStudio.UI.ViewModels /// Starts the specified module. /// </summary> /// <param name="module">The module.</param> - internal async void StartModule(IStudioModule module) + internal void StartModule(IStudioModule module) { IsMenuOpened = false; @@ -736,9 +692,10 @@ namespace Tango.MachineStudio.UI.ViewModels m.IsLoaded = false; } + CurrentModule = module; + if (module != null) { - CurrentModule = module; CurrentModule.IsLoaded = true; IsModuleLoaded = true; @@ -749,10 +706,7 @@ namespace Tango.MachineStudio.UI.ViewModels { IsModuleLoaded = false; LogManager.Log(String.Format("Navigating to Home...")); - (MainView.Self as MainView).NavigationControl.NavigateTo("Home", () => - { - CurrentModule = module; - }); + (MainView.Self as MainView).NavigationControl.NavigateTo("Home"); } } @@ -760,7 +714,7 @@ namespace Tango.MachineStudio.UI.ViewModels /// Opens the module in a new window. /// </summary> /// <param name="module">The module.</param> - private async void OpenModuleInWindow(IStudioModule module, Rect? bounds = null, WindowState? state = null, bool setHomeModule = true) + private void OpenModuleInWindow(IStudioModule module, Rect? bounds = null, WindowState? state = null) { if (module == null) return; @@ -768,12 +722,7 @@ namespace Tango.MachineStudio.UI.ViewModels { module.InNewWindow = true; - if (setHomeModule) - { - StartModule(null); - } - - await Task.Delay(1000); + StartModule(null); LogManager.Log(String.Format("Starting module '{0}' in new window...", module.Name)); @@ -969,7 +918,7 @@ namespace Tango.MachineStudio.UI.ViewModels if (module != null && !module.InNewWindow) { - OpenModuleInWindow(module, item.Bounds, item.State, false); + OpenModuleInWindow(module, item.Bounds, item.State); } } 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 160041b5f..2ee8574b1 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs @@ -179,7 +179,6 @@ namespace Tango.MachineStudio.UI.ViewModels _updateInfo = new CheckForUpdatesResponse(); _updateInfo.BlobAddress = response.BlobAddress; _updateInfo.Version = response.Version; - _updateInfo.CdnAddress = response.CdnAddress; LatestVersion = _updateInfo.Version; StartUpdate(); @@ -271,7 +270,7 @@ namespace Tango.MachineStudio.UI.ViewModels { logManager.Log("Creating temporary file " + tempFile); - using (AutoFileDownloader downloader = new AutoFileDownloader(_updateInfo.BlobAddress, _updateInfo.CdnAddress, tempFile.Path)) + using (StorageBlobDownloader downloader = new StorageBlobDownloader(_updateInfo.BlobAddress, tempFile.Path)) { downloader.Progress += (x, e) => { 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 22c1a5c00..f7e90d4f5 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml @@ -9,7 +9,6 @@ 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}"> @@ -29,7 +28,7 @@ <Grid> <StackPanel Orientation="Horizontal" Margin="10"> - <Image Source="{StaticResource MachineSmall}" Width="60" RenderOptions.BitmapScalingMode="Fant"></Image> + <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant"></Image> <TextBlock Text="About" VerticalAlignment="Center" Margin="10 0 0 0" FontSize="20"></TextBlock> </StackPanel> </Grid> @@ -76,9 +75,6 @@ <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 600104095..e69ac516e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml @@ -19,8 +19,6 @@ <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter"></converters:BooleanToVisibilityInverseConverter> <converters:BooleanInverseConverter x:Key="BooleanInverseConverter"></converters:BooleanInverseConverter> <converters:ByteArrayToFileSizeConverter x:Key="ByteArrayToFileSizeConverter" /> - <converters:GenericMessageProtocolToStringConverter x:Key="GenericMessageProtocolToStringConverter" /> - <converters:BooleanToYesNoConverter x:Key="BooleanToYesNoConverter" /> </UserControl.Resources> <Grid> @@ -34,10 +32,6 @@ <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> @@ -71,54 +65,6 @@ <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="Address:" /> - <TextBlock Text="{Binding Adapter.Address}" /> - <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="Compression:" /> - <TextBlock Text="{Binding Adapter.EnableCompression,Mode=OneWay,Converter={StaticResource BooleanToYesNoConverter}}" /> - <TextBlock FontWeight="SemiBold" Text="Generic Protocol:" /> - <TextBlock Text="{Binding GenericProtocol,Mode=OneWay,Converter={StaticResource GenericMessageProtocolToStringConverter}}" /> - <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:" /> @@ -144,10 +90,6 @@ <Run Text="{Binding Adapter.TransferRate,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}"></Run> <Run Text="/ sec"></Run> </TextBlock> - <TextBlock FontWeight="SemiBold" Text="Compression:" /> - <TextBlock Text="{Binding Adapter.EnableCompression,Mode=OneWay,Converter={StaticResource BooleanToYesNoConverter}}" /> - <TextBlock FontWeight="SemiBold" Text="Generic Protocol:" /> - <TextBlock Text="{Binding GenericProtocol,Mode=OneWay,Converter={StaticResource GenericMessageProtocolToStringConverter}}" /> <TextBlock FontWeight="SemiBold" Text="Diagnostics Frame Rate:" /> <TextBlock> <Run Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.DiagnosticsFrameProvider.FrameRate,Mode=OneWay,IsAsync=True}"></Run> 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 ba5624592..b2fa2b3e3 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="350" Background="{StaticResource Dialog.Background}" d:DataContext="{d:DesignInstance Type=vm:ConnectionLostViewVM, IsDesignTimeCreatable=False}" Foreground="{StaticResource MainWindow.Foreground}"> + Width="559" Height="266" 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="{StaticResource MachineSmall}" Width="60" RenderOptions.BitmapScalingMode="Fant"></Image> + <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant"></Image> <Ellipse Fill="#FF2626" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="30" Height="30" Margin="0 0 -5 -5"> </Ellipse> @@ -50,12 +50,7 @@ </Grid> <Grid Grid.Row="1"> - <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> + <Button HorizontalAlignment="Right" Width="140" Command="{Binding OKCommand}">CLOSE</Button> </Grid> </Grid> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml index 5cf23e79e..233f8e4cb 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml @@ -87,7 +87,7 @@ <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <TextBlock HorizontalAlignment="Center" FontSize="18" FontWeight="SemiBold">Upgrading Machine Firmware</TextBlock> <TextBlock Margin="0 40 0 0" HorizontalAlignment="Center" Foreground="{StaticResource GrayBrush}" Text="{Binding Handler.Message,Converter={StaticResource EnumToDescriptionConverter},Mode=OneWay}"></TextBlock> - <ProgressBar Height="15" Width="600" Margin="0 5 0 0" Maximum="{Binding Handler.Total,Mode=OneWay}" Value="{Binding Handler.Current,Mode=OneWay}" IsIndeterminate="{Binding Handler.IsIndeterminate,Mode=OneWay}"></ProgressBar> + <ProgressBar Height="15" Width="600" Margin="0 5 0 0" Maximum="{Binding Handler.Total,Mode=OneWay}" Value="{Binding Handler.Current,Mode=OneWay}" ></ProgressBar> <Button Width="150" Background="{StaticResource RedBrush100}" BorderBrush="{StaticResource RedBrush100}" Margin="0 40 0 0" Height="35" Command="{Binding AbortCommand}">ABORT</Button> </StackPanel> </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 14fcc3a37..df1c1b831 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="{StaticResource MachineBig}" RenderOptions.BitmapScalingMode="Fant" Width="130"></Image> + <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant" Width="100"></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 9a3b3405e..ec6091988 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml @@ -42,102 +42,38 @@ </Grid.Style> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="40"> - <Image Source="{StaticResource MachineBig}" RenderOptions.BitmapScalingMode="Fant" Width="100"></Image> + <Image Source="/Images/machine-trans.png" 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"> - <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"> + <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 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> + <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> - <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> + <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> </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 78557a42e..69ce4c855 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="400" Width="700" Height="500" Background="{StaticResource Dialog.Background}" DataContext="{Binding MachineConnectionViewVM, Source={StaticResource Locator}}" Foreground="{StaticResource MainWindow.Foreground}"> + d:DesignHeight="300" d:DesignWidth="300" Width="630" Height="400" 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="{StaticResource MachineSmall}" Width="60" RenderOptions.BitmapScalingMode="Fant"></Image> + <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant"></Image> <TextBlock Text="Machine Connection" VerticalAlignment="Center" Margin="10 0 0 0" FontSize="20"></TextBlock> </StackPanel> </Grid> @@ -55,28 +55,10 @@ <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">Address:</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" Height="45" RenderOptions.BitmapScalingMode="Fant"></Image> + <Image Source="/Images/external-bridge-tcp.png" Width="38" Height="38" 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> @@ -94,7 +76,7 @@ <DataTemplate DataType="{x:Type integration:ExternalBridgeUsbClient}"> <DockPanel> <StackPanel Orientation="Horizontal"> - <Image Source="/Images/external-bridge-usb.png" Height="45" RenderOptions.BitmapScalingMode="Fant"></Image> + <Image Source="/Images/external-bridge-usb.png" Width="38" Height="38" 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> @@ -109,7 +91,7 @@ <DataTemplate DataType="{x:Type emulations:EmulatorExternalBridge}"> <DockPanel> <StackPanel Orientation="Horizontal"> - <Image Source="/Images/external-bridge-emulator.png" Height="45" RenderOptions.BitmapScalingMode="Fant"></Image> + <Image Source="/Images/external-bridge-emulator.png" Width="38" Height="38" 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 e4cdfe199..7d0b2e25c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineLoginView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineLoginView.xaml @@ -17,26 +17,19 @@ <Grid> <DockPanel LastChildFill="True"> - <Grid DockPanel.Dock="Bottom"> - - <CheckBox IsChecked="{Binding RequireSafetyOperations}" VerticalAlignment="Center" Margin="68 0 0 0" ToolTip="Require safety level operations permission from a near-by machine user"> - <TextBlock Margin="0 -2 0 0">Require Safety Level Operations</TextBlock> - </CheckBox> - - <StackPanel Margin="10" Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right"> - <Button Command="{Binding LoginCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Password}" Style="{StaticResource MaterialDesignFlatButton}" IsDefault="True" Margin="0 8 8 0"> - LOGIN - </Button> - <Button Command="{Binding CancelCommand}" Style="{StaticResource MaterialDesignFlatButton}" Margin="0 8 0 0"> - CANCEL - </Button> - </StackPanel> - </Grid> + <StackPanel Margin="10" Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right" DockPanel.Dock="Bottom"> + <Button Command="{Binding LoginCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Password}" Style="{StaticResource MaterialDesignFlatButton}" IsDefault="True" Margin="0 8 8 0"> + LOGIN + </Button> + <Button Command="{Binding CancelCommand}" Style="{StaticResource MaterialDesignFlatButton}" Margin="0 8 0 0"> + CANCEL + </Button> + </StackPanel> <Grid Margin="10"> <StackPanel> <StackPanel Orientation="Horizontal" VerticalAlignment="Top"> <Grid> - <Image Source="{StaticResource MachineSmall}" Width="60" RenderOptions.BitmapScalingMode="Fant"></Image> + <Image Source="../Images/machine-trans.png" Width="42" 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 2393ab6e7..eea90c7b9 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="{StaticResource MachineSmall}" Width="60" RenderOptions.BitmapScalingMode="Fant"></Image> + <Image Source="/Images/machine-trans.png" 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 ea6e93412..d427be9e5 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -47,27 +47,51 @@ <materialDesign:DrawerHost IsLeftDrawerOpen="{Binding Source={x:Reference MenuToggleButton}, Path=IsChecked}"> <materialDesign:DrawerHost.LeftDrawerContent> - <DockPanel LastChildFill="False" > - <DockPanel.Style> - <Style TargetType="{x:Type DockPanel}"> - <Setter Property="TextElement.Foreground" Value="{StaticResource MainWindow.Foreground}"/> - </Style> - </DockPanel.Style> - <StackPanel MinWidth="300" DockPanel.Dock="Top" > + <DockPanel LastChildFill="False" TextElement.Foreground="{StaticResource MainWindow.Foreground}" > + <StackPanel MinWidth="300" DockPanel.Dock="Top"> <Grid> - <Button Style="{StaticResource MaterialDesignFlatButton}" Command="{Binding HomeCommand}" HorizontalAlignment="Left" HorizontalContentAlignment="Left" Margin="5 10 0 0" Width="200" Height="40" Padding="5 8 8 8" Foreground="{StaticResource BlackBrush}"> - <StackPanel Orientation="Horizontal"> - <materialDesign:PackIcon VerticalAlignment="Center" Kind="Home" Width="32" Height="32" Foreground="{StaticResource HomePageForeground}"></materialDesign:PackIcon> - <TextBlock FontSize="16" VerticalAlignment="Center" Margin="10 0 0 0" Foreground="{StaticResource HomePageForeground}">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> @@ -75,7 +99,7 @@ </StackPanel> <ListBox ItemsSource="{Binding StudioModuleLoader.UserModules}" HorizontalContentAlignment="Stretch" FontSize="14"> <ListBox.ItemContainerStyle> - <Style TargetType="ListBoxItem" BasedOn="{StaticResource MaterialDesignListBoxItem}"> + <Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}"> <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter> <Setter Property="VerticalContentAlignment" Value="Stretch"></Setter> <Setter Property="Visibility" Value="{Binding InNewWindow,Converter={StaticResource BooleanToVisibilityInverseConverter}}"></Setter> @@ -124,36 +148,8 @@ <materialDesign:ColorZone Padding="16" materialDesign:ShadowAssist.ShadowDepth="Depth2" Mode="PrimaryMid" DockPanel.Dock="Top" Background="{StaticResource MainWindow.Header}"> <DockPanel> - <StackPanel Orientation="Horizontal"> - <ToggleButton VerticalAlignment="Center" Style="{StaticResource MaterialDesignHamburgerToggleButton}" IsChecked="{Binding IsMenuOpened}" + <ToggleButton 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}"> @@ -235,71 +231,10 @@ </StackPanel> </materialDesign:PopupBox> <Grid> - - <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> + <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 HorizontalAlignment="Right"> <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> @@ -372,9 +307,6 @@ <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> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml index aac712f59..ef9667b6d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml @@ -12,7 +12,7 @@ xmlns:tfs="clr-namespace:Tango.TFS;assembly=Tango.TFS" xmlns:tfss="clr-namespace:Tango.MachineStudio.UI.TFS" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" - mc:Ignorable="d" Width="530" Height="660" Background="{StaticResource Dialog.Background}" d:DataContext="{d:DesignInstance Type=vm:ReportIssueViewVM, IsDesignTimeCreatable=False}" Foreground="{StaticResource MainWindow.Foreground}"> + mc:Ignorable="d" Width="530" Height="720" Background="{StaticResource Dialog.Background}" d:DataContext="{d:DesignInstance Type=vm:ReportIssueViewVM, IsDesignTimeCreatable=False}" Foreground="{StaticResource MainWindow.Foreground}"> <UserControl.Resources> <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" /> 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 6bda3fe2d..cc1060b2a 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="{StaticResource MachineSmall}" RenderOptions.BitmapScalingMode="Fant" Width="130"></Image> + <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant" Width="100"></Image> <StackPanel Orientation="Horizontal"> <TextBlock FontSize="70" Foreground="Gray">Machine Studio</TextBlock> </StackPanel> 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 01f08491a..25fe4af5d 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}" FontFamily="{StaticResource flexo}" Foreground="{StaticResource Dialog.Foreground}"> + 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}"> <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 5db0277cc..47b36070a 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="Machine Studio" Height="800" Width="1280" WindowStartupLocation="CenterOwner" WindowState="Maximized" Foreground="#494949" BorderThickness="1" BorderBrush="{StaticResource AccentColorBrush}" FontFamily="{StaticResource flexo}"> + Title="{Binding RelativeSource={RelativeSource Self},Path=ModuleContext.Module.Name}" Height="800" Width="1280" WindowStartupLocation="CenterOwner" WindowState="Maximized" Foreground="#494949" BorderThickness="1" BorderBrush="{StaticResource AccentColorBrush}"> <Window.Resources> <converters:StringEllipsisConverter x:Key="StringEllipsisConverter" /> @@ -29,16 +29,8 @@ <DockPanel> <Grid> <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Height="60" HorizontalAlignment="Center"> - <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> + <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> </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 cfea78964..7ca062645 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,8 +12,6 @@ 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 @@ -34,13 +32,6 @@ 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 differdeleted file mode 100644 index dd159c221..000000000 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/machine_new_small.ico +++ /dev/null |
