diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-20 15:08:22 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-20 15:08:22 +0200 |
| commit | 2fe707abce023813d234b57b097a731174fd4a26 (patch) | |
| tree | 010fd3d915f24c266e9dff119c3b5c3657ae80f8 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs | |
| parent | 98507ffd2075fcd7ae69d97d4f4795ca8c85c646 (diff) | |
| download | Tango-2fe707abce023813d234b57b097a731174fd4a26.tar.gz Tango-2fe707abce023813d234b57b097a731174fd4a26.zip | |
Implemented module popping!
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs | 34 |
1 files changed, 34 insertions, 0 deletions
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 679ba5ff3..503532223 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -7,6 +7,9 @@ using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; using Tango.Core.Commands; using Tango.Integration.Services; using Tango.Logging; @@ -18,8 +21,10 @@ using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.Common.StudioApplication; using Tango.MachineStudio.UI.SupervisingController; using Tango.MachineStudio.UI.Views; +using Tango.MachineStudio.UI.Windows; using Tango.PMR.Stubs; using Tango.SharedUI; +using Tango.SharedUI.Helpers; using Tango.Transport.Adapters; namespace Tango.MachineStudio.UI.ViewModels @@ -69,6 +74,11 @@ namespace Tango.MachineStudio.UI.ViewModels public RelayCommand<IStudioModule> StartModuleCommand { get; set; } /// <summary> + /// Gets or sets the open module in window command. + /// </summary> + public RelayCommand<IStudioModule> OpenModuleInWindowCommand { get; set; } + + /// <summary> /// Gets or sets the home command. /// </summary> public RelayCommand HomeCommand { get; set; } @@ -157,6 +167,7 @@ namespace Tango.MachineStudio.UI.ViewModels ConnectCommand = new RelayCommand(ConnectToMachine); SignoutCommand = new RelayCommand(SignOut); DisconnectCommand = new RelayCommand(DisconnectFromMachine, (x) => ApplicationManager.IsMachineConnected && !_isDisconnecting); + OpenModuleInWindowCommand = new RelayCommand<IStudioModule>(OpenModuleInWindow); } /// <summary> @@ -302,5 +313,28 @@ namespace Tango.MachineStudio.UI.ViewModels { base.OnViewAttached(); } + + private void OpenModuleInWindow(IStudioModule module) + { + module.InNewWindow = true; + + var parent = (MainView.Self as MainView).TransitionControl.Controls.SingleOrDefault(x => x.Tag.ToString() == module.Name).Content as Grid; + + var view = parent.Children[0] as FrameworkElement; + parent.Children.Remove(view); + + ModuleWindowVM vm = new ModuleWindowVM(module, parent); + ModuleWindow window = new ModuleWindow(this, vm, view); + + window.Closing += (x, y) => + { + window.grid.Children.Remove(view); + parent.Children.Add(view); + module.InNewWindow = false; + }; + + window.Owner = MainWindow.Instance; + window.Show(); + } } } |
