From db5c4418d90840ec033a8eacc948419b72755857 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 12 Mar 2019 15:26:36 +0200 Subject: Machine Studio v4.0.10 PPC v1.0.6 --- .../Notifications/DefaultNotificationProvider.cs | 399 ++++++++++++--------- .../Notifications/DialogWindow.xaml | 2 +- .../Notifications/MessageBoxWindow.xaml | 2 +- .../Notifications/TextInputBoxWindow.xaml | 2 +- .../Tango.MachineStudio.UI/ViewModelLocator.cs | 2 - .../ViewModels/MachineConnectionViewVM.cs | 46 ++- .../ViewModels/MachineLoginViewVM.cs | 7 + .../ViewModels/MainViewVM.cs | 32 +- .../Views/MachineLoginView.xaml | 23 +- 9 files changed, 313 insertions(+), 202 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs index 161177bf1..7c56115e3 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs @@ -105,109 +105,148 @@ namespace Tango.MachineStudio.UI.Notifications } /// - /// Creates a new instance of the specified View type and displays it as a modal dialog. + /// Shows the specified view with the specified view model as it's data context. /// + /// The type of the mm. /// The type of the view. - /// The type of the view model. - /// Accept button callback. - /// Cancel button callback. - public void ShowModalDialog(Action onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM + /// The view model. + /// The view. + /// The accept action. + /// The cancel action. + public void ShowModalDialog(VM vm, View view, Action onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM { - var view = Activator.CreateInstance(); - DialogWindow dialog = new DialogWindow(); - dialog.Owner = Application.Current.MainWindow; - dialog.InnerContent = view; - MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; - view.Loaded += (x, y) => + try { - VM context = view.DataContext as VM; - dialog.DataContext = context; + DialogWindow dialog = new DialogWindow(); + dialog.Owner = Application.Current.MainWindow; + dialog.InnerContent = view; + MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; + view.Loaded += (x, y) => + { + try + { + VM context = vm; + dialog.DataContext = context; - Action onAcceptAction = null; - Action onCancelAction = null; + Action onAcceptAction = null; + Action onCancelAction = null; - onAcceptAction = new Action(() => - { - dialog.Close(); - onAccept(context); - context.Accepted -= onAcceptAction; - context.Canceled -= onCancelAction; - }); + onAcceptAction = new Action(() => + { + dialog.Close(); + onAccept(context); + context.Accepted -= onAcceptAction; + context.Canceled -= onCancelAction; + }); - onCancelAction = new Action(() => - { - dialog.Close(); + onCancelAction = new Action(() => + { + dialog.Close(); - if (onCancel != null) - { - onCancel(); - } + if (onCancel != null) + { + onCancel(); + } - context.Accepted -= onAcceptAction; - context.Canceled -= onCancelAction; - }); + context.Canceled -= onCancelAction; + context.Accepted -= onAcceptAction; + }); - context.Accepted += onAcceptAction; - context.Canceled += onCancelAction; + context.Accepted += onAcceptAction; + context.Canceled += onCancelAction; - context.OnShow(); - }; - dialog.ShowDialog(); - MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + context.OnShow(); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error display modal dialog. {typeof(VM).Name}"); + onCancel?.Invoke(); + } + }; + + dialog.ShowDialog(); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error display modal dialog. {typeof(VM).Name}"); + onCancel?.Invoke(); + } + finally + { + MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + } } /// - /// Shows the specified view with the specified view model as it's data context. + /// Creates a new instance of the specified View type and displays it as a modal dialog. /// - /// The type of the mm. /// The type of the view. - /// The view model. - /// The view. - /// The accept action. - /// The cancel action. - public void ShowModalDialog(VM vm, Action onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM + /// The type of the view model. + /// Accept button callback. + /// Cancel button callback. + public void ShowModalDialog(Action onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM { - var view = Activator.CreateInstance(); - DialogWindow dialog = new DialogWindow(); - dialog.Owner = Application.Current.MainWindow; - dialog.InnerContent = view; - MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; - view.Loaded += (x, y) => + try { - VM context = vm; - dialog.DataContext = context; + var view = Activator.CreateInstance(); + DialogWindow dialog = new DialogWindow(); + dialog.Owner = Application.Current.MainWindow; + dialog.InnerContent = view; + MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; + view.Loaded += (x, y) => + { + try + { + VM context = view.DataContext as VM; + dialog.DataContext = context; - Action onAcceptAction = null; - Action onCancelAction = null; + Action onAcceptAction = null; + Action onCancelAction = null; - onAcceptAction = new Action(() => - { - dialog.Close(); - onAccept(context); - context.Accepted -= onAcceptAction; - context.Canceled -= onCancelAction; - }); + onAcceptAction = new Action(() => + { + dialog.Close(); + onAccept(context); + context.Accepted -= onAcceptAction; + context.Canceled -= onCancelAction; + }); - onCancelAction = new Action(() => - { - dialog.Close(); + onCancelAction = new Action(() => + { + dialog.Close(); - if (onCancel != null) - { - onCancel(); - } + if (onCancel != null) + { + onCancel(); + } - context.Accepted -= onAcceptAction; - context.Canceled -= onCancelAction; - }); + context.Accepted -= onAcceptAction; + context.Canceled -= onCancelAction; + }); - context.Accepted += onAcceptAction; - context.Canceled += onCancelAction; + context.Accepted += onAcceptAction; + context.Canceled += onCancelAction; - context.OnShow(); - }; - dialog.ShowDialog(); - MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + context.OnShow(); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error display modal dialog. {typeof(VM).Name}"); + onCancel?.Invoke(); + } + }; + dialog.ShowDialog(); + MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error display modal dialog. {typeof(VM).Name}"); + onCancel?.Invoke(); + } + finally + { + MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + } } /// @@ -219,48 +258,68 @@ namespace Tango.MachineStudio.UI.Notifications /// The view. /// The accept action. /// The cancel action. - public void ShowModalDialog(VM vm, View view, Action onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM + public void ShowModalDialog(VM vm, Action onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM { - DialogWindow dialog = new DialogWindow(); - dialog.Owner = Application.Current.MainWindow; - dialog.InnerContent = view; - MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; - view.Loaded += (x, y) => + try { - VM context = vm; - dialog.DataContext = context; + var view = Activator.CreateInstance(); + DialogWindow dialog = new DialogWindow(); + dialog.Owner = Application.Current.MainWindow; + dialog.InnerContent = view; + MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; + view.Loaded += (x, y) => + { + try + { + VM context = vm; + dialog.DataContext = context; - Action onAcceptAction = null; - Action onCancelAction = null; + Action onAcceptAction = null; + Action onCancelAction = null; - onAcceptAction = new Action(() => - { - dialog.Close(); - onAccept(context); - context.Accepted -= onAcceptAction; - context.Canceled -= onCancelAction; - }); + onAcceptAction = new Action(() => + { + dialog.Close(); + onAccept(context); + context.Accepted -= onAcceptAction; + context.Canceled -= onCancelAction; + }); - onCancelAction = new Action(() => - { - dialog.Close(); + onCancelAction = new Action(() => + { + dialog.Close(); - if (onCancel != null) - { - onCancel(); - } + if (onCancel != null) + { + onCancel(); + } - context.Canceled -= onCancelAction; - context.Accepted -= onAcceptAction; - }); + context.Accepted -= onAcceptAction; + context.Canceled -= onCancelAction; + }); - context.Accepted += onAcceptAction; - context.Canceled += onCancelAction; + context.Accepted += onAcceptAction; + context.Canceled += onCancelAction; - context.OnShow(); - }; - dialog.ShowDialog(); - MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + context.OnShow(); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error display modal dialog. {typeof(VM).Name}"); + onCancel?.Invoke(); + } + }; + dialog.ShowDialog(); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error display modal dialog. {typeof(VM).Name}"); + onCancel?.Invoke(); + } + finally + { + MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + } } /// @@ -272,67 +331,87 @@ namespace Tango.MachineStudio.UI.Notifications /// Could not locate view " + viewName public void ShowModalDialog(Action onAccept, Action onCancel) where VM : DialogViewVM { - String viewName = typeof(VM).Name.Replace("VM", ""); - - if (viewTypes == null) - { - viewTypes = AppDomain.CurrentDomain.GetAssemblies().Where(x => x.FullName.Contains("MachineStudio")).SelectMany(x => x.GetTypes()).ToList(); - } - - var viewType = viewTypes.SingleOrDefault(x => x.Name == viewName); - - if (viewType == null) + try { - throw new NullReferenceException("Could not locate view " + viewName); - } + String viewName = typeof(VM).Name.Replace("VM", ""); - var view = Activator.CreateInstance(viewType) as FrameworkElement; - DialogWindow dialog = new DialogWindow(); - dialog.Owner = Application.Current.MainWindow; - dialog.InnerContent = view; - MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; - view.Loaded += (x, y) => - { - VM context = view.DataContext as VM; - if (context == null) + if (viewTypes == null) { - context = Activator.CreateInstance(); + viewTypes = AppDomain.CurrentDomain.GetAssemblies().Where(x => x.FullName.Contains("MachineStudio")).SelectMany(x => x.GetTypes()).ToList(); } - dialog.DataContext = context; - Action onCancelAction = null; - Action onAcceptAction = null; + var viewType = viewTypes.SingleOrDefault(x => x.Name == viewName); - onAcceptAction = new Action(() => + if (viewType == null) { - dialog.Close(); - onAccept(context); - - context.Canceled -= onCancelAction; - context.Accepted -= onAcceptAction; - }); + throw new NullReferenceException("Could not locate view " + viewName); + } - onCancelAction = new Action(() => + var view = Activator.CreateInstance(viewType) as FrameworkElement; + DialogWindow dialog = new DialogWindow(); + dialog.Owner = Application.Current.MainWindow; + dialog.InnerContent = view; + MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; + view.Loaded += (x, y) => { - dialog.Close(); - - if (onCancel != null) + try { - onCancel(); + VM context = view.DataContext as VM; + if (context == null) + { + context = Activator.CreateInstance(); + } + dialog.DataContext = context; + + Action onCancelAction = null; + Action onAcceptAction = null; + + onAcceptAction = new Action(() => + { + dialog.Close(); + onAccept(context); + + context.Canceled -= onCancelAction; + context.Accepted -= onAcceptAction; + }); + + onCancelAction = new Action(() => + { + dialog.Close(); + + if (onCancel != null) + { + onCancel(); + } + + context.Canceled -= onCancelAction; + context.Accepted -= onAcceptAction; + }); + + context.Accepted += onAcceptAction; + context.Canceled += onCancelAction; + + context.OnShow(); } + catch (Exception ex) + { + LogManager.Log(ex, $"Error display modal dialog. {typeof(VM).Name}"); + onCancel?.Invoke(); + return; + } + }; - context.Canceled -= onCancelAction; - context.Accepted -= onAcceptAction; - }); - - context.Accepted += onAcceptAction; - context.Canceled += onCancelAction; - - context.OnShow(); - }; - - dialog.ShowDialog(); - MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + dialog.ShowDialog(); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error display modal dialog. {typeof(VM).Name}"); + onCancel?.Invoke(); + } + finally + { + MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + } } /// 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 c11e2e11b..2eb1080cb 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"> + Title="Machine Studio" MinHeight="220" SizeToContent="WidthAndHeight" MinWidth="600" AllowsTransparency="True" WindowStyle="None" WindowStartupLocation="CenterOwner" Background="Transparent" ShowInTaskbar="False"> 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 a89f8eeca..8f9512236 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"> + Title="Machine Studio" MinHeight="220" MaxHeight="600" SizeToContent="Height" Width="570" Opacity="0" AllowsTransparency="True" WindowStyle="None" WindowStartupLocation="CenterOwner" Background="Transparent" ShowInTaskbar="False"> 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 d2aad7cee..5e27071ec 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"> + Title="Machine Studio" MinHeight="220" MaxHeight="600" SizeToContent="Height" Width="570" Opacity="0" AllowsTransparency="True" WindowStyle="None" WindowStartupLocation="CenterOwner" Background="Transparent" ShowInTaskbar="False"> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs index 7fbb0008c..3fffd69fd 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs @@ -61,7 +61,6 @@ namespace Tango.MachineStudio.UI TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); - TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); @@ -79,7 +78,6 @@ namespace Tango.MachineStudio.UI TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); - TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); 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 7737911e0..ce49d805e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs @@ -19,18 +19,16 @@ namespace Tango.MachineStudio.UI.ViewModels /// public class MachineConnectionViewVM : DialogViewVM { - private EmulatorExternalBridge _emulator; - - private ExternalBridgeScanner _scanner; - /// - /// Gets or sets the machine scanner. - /// + private static ExternalBridgeScanner _scanner; public ExternalBridgeScanner Scanner { get { return _scanner; } set { _scanner = value; RaisePropertyChangedAuto(); } } + + private EmulatorExternalBridge _emulator; + private IExternalBridgeClient _selectedMachine; /// /// Gets or sets the selected machine. @@ -50,11 +48,15 @@ namespace Tango.MachineStudio.UI.ViewModels /// Initializes a new instance of the class. /// /// The scanner. - public MachineConnectionViewVM(ExternalBridgeScanner scanner) + public MachineConnectionViewVM() { + if (_scanner == null) + { + _scanner = new ExternalBridgeScanner(); + } + EnableDiagnostics = true; UploadHardwareConfiguration = true; - Scanner = scanner; ConnectCommand = new RelayCommand(Connect, (x) => SelectedMachine != null); } @@ -65,7 +67,7 @@ namespace Tango.MachineStudio.UI.ViewModels { if (SelectedMachine != null) { - Scanner.Stop(); + _scanner.Stop(); Accept(); } } @@ -75,7 +77,7 @@ namespace Tango.MachineStudio.UI.ViewModels /// protected override void Cancel() { - Scanner.Stop(); + _scanner.Stop(); base.Cancel(); } @@ -85,19 +87,27 @@ namespace Tango.MachineStudio.UI.ViewModels public override void OnShow() { base.OnShow(); - Scanner.AvailableMachines.Clear(); - if (SettingsManager.Default.GetOrCreate().UseExternalBridgeEmulator) + try { - if (_emulator != null) + _scanner.AvailableMachines.Clear(); + + if (SettingsManager.Default.GetOrCreate().UseExternalBridgeEmulator) { - _emulator.Disconnect(); + if (_emulator != null) + { + _emulator.Disconnect(); + } + _emulator = new EmulatorExternalBridge(); } - _emulator = new EmulatorExternalBridge(); - } - Scanner.AvailableMachines.Add(_emulator); - Scanner.Start(); + _scanner.AvailableMachines.Add(_emulator); + _scanner.Start(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error starting external bridge scanner."); + } } private bool _enableDiagnostics; 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 2b1acdbe6..7584617ed 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineLoginViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineLoginViewVM.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using Tango.Core.Commands; using Tango.MachineStudio.Common.Notifications; +using Tango.PMR.Integration; using Tango.SharedUI; namespace Tango.MachineStudio.UI.ViewModels @@ -20,6 +21,11 @@ namespace Tango.MachineStudio.UI.ViewModels /// public String Password { get; set; } + /// + /// Gets or sets the intent. + /// + public ExternalBridgeLoginIntent Intent { get; set; } + /// /// Gets or sets the login command. /// @@ -35,6 +41,7 @@ namespace Tango.MachineStudio.UI.ViewModels /// public MachineLoginViewVM() { + Intent = ExternalBridgeLoginIntent.FullControl; LoginCommand = new RelayCommand(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 986bf483f..3f69ff771 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -9,6 +9,7 @@ using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; +using System.Windows.Input; using System.Windows.Media; using Tango.BL; using Tango.BL.Builders; @@ -467,7 +468,7 @@ namespace Tango.MachineStudio.UI.ViewModels HostName = Environment.MachineName, Password = login.Password, UserGuid = AuthenticationProvider.CurrentUser.Guid, - Intent = PMR.Integration.ExternalBridgeLoginIntent.Override, + Intent = login.Intent, }); ApplicationManager.SetConnectedMachine(x.SelectedMachine); @@ -892,25 +893,28 @@ namespace Tango.MachineStudio.UI.ViewModels { if (!IsApplicationReady) { - var settings = SettingsManager.Default.GetOrCreate(); - - foreach (var item in settings.StudioModulesBounds) + if (!Keyboard.IsKeyDown(Key.LeftCtrl)) { - var module = StudioModuleLoader.AllModules.SingleOrDefault(x => x.Name == item.Name); + var settings = SettingsManager.Default.GetOrCreate(); - if (module != null && !module.InNewWindow) + foreach (var item in settings.StudioModulesBounds) { - OpenModuleInWindow(module, item.Bounds, item.State); - } - } + var module = StudioModuleLoader.AllModules.SingleOrDefault(x => x.Name == item.Name); - if (settings.LastMainModuleName != null) - { - var m = StudioModuleLoader.UserModules.SingleOrDefault(x => x.Name == settings.LastMainModuleName); + if (module != null && !module.InNewWindow) + { + OpenModuleInWindow(module, item.Bounds, item.State); + } + } - if (m != null) + if (settings.LastMainModuleName != null) { - StartModule(m); + var m = StudioModuleLoader.UserModules.SingleOrDefault(x => x.Name == settings.LastMainModuleName); + + if (m != null) + { + StartModule(m); + } } } 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 04f787c41..14967686f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineLoginView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineLoginView.xaml @@ -5,9 +5,16 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:pmr="clr-namespace:Tango.PMR.Integration;assembly=Tango.PMR" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" d:DesignHeight="200" d:DesignWidth="550" Background="White" DataContext="{Binding MachineLoginViewVM, Source={StaticResource Locator}}"> + + + + + @@ -26,12 +33,18 @@ - - - - Enter machine password - + + + + Enter machine password + + + + Intent + + + -- cgit v1.3.1