protected ShellMainViewModel(ViewModelStore viewModelStore, ModelPackage package) : base(viewModelStore, false) { if (!this.ViewModelStore.CustomDataBag.ContainsKey(ShellViewModelStoreIds.ModelPackageId)) this.ViewModelStore.CustomDataBag.Add(ShellViewModelStoreIds.ModelPackageId, package); if (!this.Store.CustomDataBag.ContainsKey(ShellViewModelStoreIds.ModelPackageId)) this.Store.CustomDataBag.Add(ShellViewModelStoreIds.ModelPackageId, package); if (!this.Store.CustomDataBag.ContainsKey(ShellViewModelStoreIds.ViewModelStoreId)) this.Store.CustomDataBag.Add(ShellViewModelStoreIds.ViewModelStoreId, this.ViewModelStore); this.saveModelCommand = new DelegateCommand(SaveModelCommandExecuted); this.modelPackage = package; this.EventManager.GetEvent<DocumentClosingEvent>().Subscribe(this.OnDocumentClosingEvent); this.EventManager.GetEvent<DocumentSavedEvent>().Subscribe(this.OnDocumentSavedEvent); this.showModelTreeCommand = new DelegateCommand(ShowModelTreeCommandExecuted); this.showPropertiesCommand = new DelegateCommand(ShowPropertiesCommandExecuted); this.showErrorListCommand = new DelegateCommand(ShowErrorListCommandExecuted); this.showDependenciesCommand = new DelegateCommand(ShowDependenciesCommandExecuted); this.showDiagramSurfaceCommand = new DelegateCommand(ShowDiagramSurfaceCommandCommandExecuted); this.pluginInformationCommand = new DelegateCommand(PluginInformationCommandExecuted); this.visibleCollection = new ObservableCollection<IDockableViewModel>(); this.hiddenCollection = new ObservableCollection<IDockableViewModel>(); this.Initialize(); }
/// <summary> /// Constructs a new ModelDocView. /// </summary> /// <param name="docData">Modeling doc data.</param> /// <param name="serviceProvider">Service provider.</param> protected ModelDocView(ModelShellData docData, IServiceProvider serviceProvider) : base(docData, serviceProvider) { package = serviceProvider as ModelPackage; this.DocData.DocumentClosing += new EventHandler(DocDataDocumentClosing); this.DocData.DocumentLoaded += new EventHandler(DocDataDocumentLoaded); this.DocData.DocumentSaved += new EventHandler(DocDataDocumentSaved); }
/// <summary> /// Constuctor. /// </summary> /// <param name="package">Package.</param> protected ShellPackageController(ModelPackage package) { this.modelPackage = package; this.availableShellVMs = new Dictionary<ShellMainViewModel, string>(); this.availableShellVMsReversed = new Dictionary<string, ShellMainViewModel>(); this.Initialize(); }
/// <summary> /// Constructor. /// </summary> /// <param name="package">Visual Studio Package.</param> /// <param name="packageController">Package controller.</param> protected ShellDockingManager(ModelPackage package, ShellPackageController packageController) { this.packageController = packageController; this.viewLookup = new Dictionary<string, Dictionary<string, ViewLookUp>>(); this.viewTypeNameLookup = new Dictionary<string, List<string>>(); this.paneViewLookup = new Dictionary<Guid, string>(); this.package = package; //this.visibleCollection = new ObservableCollection<IDockableViewModel>(); //this.hiddenCollection = new ObservableCollection<IDockableViewModel>(); this.package.ActiveWindowChangedEvent += new ModelPackage.ActiveWindowChangedEventHandler(Package_ActiveWindowChangedEvent); this.closeSelectedDocumentPaneCommand = new DelegateCommand(CloseSDPCommand_Execute, CloseSDPCommand_CanExecute); this.documentPaneControlActivated = new DelegateCommand(DocumentPaneControlActivated_Execute); }
private void Package_ActiveWindowChangedEvent(object sender, ModelPackage.WindowChangedEventArgs e) { // there is no need to deactivate a view as this is handled by the main vm // activate view if (this.SelectedShellViewModel == null) return; this.SelectedShellViewModel.IsDockingPaneActive = false; if (e.NewData != null) if (e.NewData.DoesBelongToPackage) { if (e.NewData.IsDocumentFrame) { if (this.selectedShellVMName != e.NewData.FullFileName) { bool bLoadLayout = false; if (this.selectedShellVMName == null) bLoadLayout = true; this.selectedShellVMName = e.NewData.FullFileName; // change current shell vm this.packageController.SetCurrentShellViewModel(this.selectedShellVMName); if (bLoadLayout) this.bForceLoadLayout = true; //else //{ UpdateView(); //} } this.SelectedShellViewModel.IsDockingPaneActive = true; /* if (this.SelectedDocumentPane != null) { this.OnActivePaneChanged(this.SelectedDocumentPane, true); this.activePane = this.SelectedDocumentPane; } else DeactivateCurrentPane(); */ } else { this.SelectedShellViewModel.TriggerDockingPaneActivated = true; if (e.NewData.Key != Guid.Empty) { string accessKey = this.SelectedShellViewModel.FullFileName; if (this.viewLookup.ContainsKey(accessKey)) if (this.viewLookup[accessKey].ContainsKey(this.paneViewLookup[e.NewData.Key])) { this.activePane = this.viewLookup[accessKey][this.paneViewLookup[e.NewData.Key]].View; } if (this.viewLookup.ContainsKey(TransientPanesKey)) if (this.viewLookup[TransientPanesKey].ContainsKey(this.paneViewLookup[e.NewData.Key])) { this.activePane = this.viewLookup[TransientPanesKey][this.paneViewLookup[e.NewData.Key]].Pane.Content.DataContext as IDockableViewModel; //this.activePane = this.viewLookup[TransientPanesKey][this.paneViewLookup[e.NewData.Key]].View; } this.OnActivePaneChanged(this.activePane, true); } else DeactivateCurrentPane(); } } else { if (e.NewData.IsDocumentFrame) { // close vms??? } this.SelectedShellViewModel.TriggerDockingPaneActivated = true; // deactivate current pane DeactivateCurrentPane(); } }