public Workspace(string path) { this.PaneDataTemplateSelector = new UI.GenericDataTemplateSelector(Assembly.GetExecutingAssembly(), (s) => s.StartsWith("ArmA.Studio.UI.DataTemplates.")); this.WorkingDir = path; this._PanelsAvailable = new ObservableCollection <PanelBase>(FindAllAnchorablePanelsInAssembly()); this.PanelsDisplayed = new ObservableCollection <PanelBase>(); this._DebugContext = new DebuggerContext(); this._DocumentsDisplayed = new ObservableCollection <DocumentBase>(); this._DocumentsAvailable = new ObservableCollection <DocumentBase>(FindAllDocumentsInAssembly()); this.CmdDisplayPanel = new RelayCommand((p) => { if (p is PanelBase) { var pb = p as PanelBase; if (this.PanelsDisplayed.Contains(p)) { pb.CurrentVisibility = pb.CurrentVisibility == Visibility.Visible ? Visibility.Hidden : Visibility.Visible; } else { this.PanelsDisplayed.Add(pb); } } }); this.CmdDisplayLicensesDialog = new RelayCommand((p) => { var dlg = new Dialogs.LicenseViewer(); var dlgResult = dlg.ShowDialog(); }); this.CmdDockingManagerInitialized = new RelayCommand((p) => this.DockingMangerInitialized(p as DockingManager)); this.CmdMainWindowClosing = new RelayCommand((p) => { SaveLayout(this.MWDockingManager, Path.Combine(App.ConfigPath, CONST_DOCKING_MANAGER_LAYOUT_NAME)); App.Current.Shutdown((int)App.ExitCodes.OK); }); this.CmdSwitchWorkspace = new RelayCommand((p) => { if (App.SwitchWorkspace()) { App.Shutdown(App.ExitCodes.Restart); } }); this.CmdShowProperties = new RelayCommand((p) => { var dlgDc = new Dialogs.PropertiesDialogDataContext(); var dlg = new Dialogs.PropertiesDialog(dlgDc); dlg.ShowDialog(); if (dlgDc.RestartRequired) { var msgResult = MessageBox.Show(Properties.Localization.ChangesRequireRestart_Body, Properties.Localization.ChangesRequireRestart_Title, MessageBoxButton.YesNo, MessageBoxImage.Information); if (msgResult == MessageBoxResult.Yes) { App.Shutdown(App.ExitCodes.Restart); } } }); this.CmdQuit = new RelayCommand((p) => { App.Shutdown(App.ExitCodes.OK); }); this.CmdSave = new RelayCommand((p) => { foreach (var doc in this.DocumentsDisplayed) { if (doc.IsSelected) { if (!doc.HasChanges) { break; } doc.SaveDocument(doc.FilePath); break; } } }); this.CmdSaveAll = new RelayCommand((p) => { foreach (var doc in this.DocumentsDisplayed) { if (doc.HasChanges) { doc.SaveDocument(doc.FilePath); } } this.SaveSolution(); }); this.CmdActiveContentChanged = new RelayCommand((p) => { var dm = p as DockingManager; this.CurrentDocument = dm.ActiveContent as DocumentBase; }); const double DEF_WIN_HEIGHT = 512; const double DEF_WIN_WIDTH = 1024; this._WindowHeight = DEF_WIN_HEIGHT; this._WindowWidth = DEF_WIN_WIDTH; this._WindowLeft = (SystemParameters.PrimaryScreenWidth - DEF_WIN_WIDTH) / 2; if (this._WindowLeft < 0) { this._WindowLeft = 0; } this._WindowTop = (SystemParameters.PrimaryScreenHeight - DEF_WIN_HEIGHT) / 2; if (this._WindowTop < 0) { this._WindowTop = 0; } this._WindowCurrentState = WindowState.Normal; }