/// <summary> /// Removes a shell vm. /// </summary> /// <param name="shellViewModel">Shell vm.</param> public void RemoveShellViewModel(ShellMainViewModel shellViewModel) { shellViewModel.PackageController = null; this.availableShellVMsReversed.Remove(this.availableShellVMs[shellViewModel]); this.availableShellVMs.Remove(shellViewModel); if (this.availableShellVMs.Count > 0) { // close windows... this.LayoutManager.CloseConfiguration(shellViewModel.FullFileName); this.SetCurrentShellViewModel(this.availableShellVMs.Keys.ElementAt(0)); this.LayoutManager.UpdateView(); } else { this.LayoutManager.SaveConfiguration(shellViewModel.ModelData.CurrentModelContext.Name); this.LayoutManager.SaveConfigurations(); this.LayoutManager.CloseConfiguration(); this.CurrentShellViewModel = null; } }
/// <summary> /// Adds a shell vm. /// </summary> /// <param name="shellViewModel">Shell vm.</param> /// <param name="name">Name of the vm. (Must be the full file name of the loaded model).</param> public void AddShellViewModel(ShellMainViewModel shellViewModel, string name) { shellViewModel.PackageController = this; this.availableShellVMs.Add(shellViewModel, name); this.availableShellVMsReversed.Add(name, shellViewModel); }
/// <summary> /// Set current shell vm. /// </summary> /// <param name="shellViewModel">Shell vm.</param> public void SetCurrentShellViewModel(ShellMainViewModel shellViewModel) { this.CurrentShellViewModel = shellViewModel; }
public DisconnectCommand(ShellMainViewModel viewModel) { _viewModel = viewModel; _viewModel.PropertyChanged += (_, _) => { OnCanExecuteChanged(); }; }