void MainWindow_ExecutedCommand(CommandBase command, bool isPartOfMacro, CommandBase macroCommand) { ActivateDiagramCommand adc = command as ActivateDiagramCommand; if (adc != null) { if (adc.ActivatedDiagram != null && adc.Element != null) { DiagramTabManager.ActivateDiagramWithElement(adc.ActivatedDiagram, adc.Element); } if (adc.ActivatedDiagram == null && adc.Element != null && adc.Element is PIMClass) { DiagramTabManager.GoToPimClass((PIMClass)adc.Element); } if (adc.ActivatedDiagram != null && adc.Element == null) { DiagramTabManager.ActivateDiagram(((ActivateDiagramCommand)command).ActivatedDiagram); } } }
public void OpenProjectDiagrams() { #if DEBUG if (Environment.MachineName.Contains("TRUPIK")) { string currentFile = CurrentProject.FilePath; List <string> recentFiles; if (File.Exists(lastFilePath)) { recentFiles = File.ReadAllLines(lastFilePath).ToList(); } else { recentFiles = new List <string>(); } if (!String.IsNullOrEmpty(currentFile)) { if (recentFiles.Contains(currentFile)) { recentFiles.Remove(currentFile); } recentFiles.Insert(0, currentFile); } bOpenProject.ContextMenu = new ContextMenu(); foreach (string recentFile in recentFiles) { if (!string.IsNullOrEmpty(recentFile)) { string name = Path.GetFileNameWithoutExtension(recentFile); ContextMenuItem cmi = new ContextMenuItem(name); cmi.DataContext = recentFile; cmi.Click += delegate { OpenProject((string)cmi.DataContext); }; bOpenProject.ContextMenu.Items.Add(cmi); } } File.WriteAllLines(lastFilePath, recentFiles.Take(15).ToArray()); if (System.Windows.Forms.Screen.AllScreens.Length > 1) { this.WindowState = WindowState.Normal; this.Left = System.Windows.Forms.Screen.AllScreens[0].Bounds.X; this.Top = System.Windows.Forms.Screen.AllScreens[0].Bounds.Y; this.Width = System.Windows.Forms.Screen.AllScreens[0].Bounds.Width; this.Height = System.Windows.Forms.Screen.AllScreens[0].Bounds.Height; } } #endif if (CurrentProject != null) { VersionManager versionManager = CurrentProject.VersionManager; // HACK - TRUPIK: added for simplier debugging, only on my machine.. if (Environment.MachineName.Contains("TRUPIK") && versionManager != null && versionManager.Versions.Count == 2) { Version v1 = versionManager.Versions[0]; Version v2 = versionManager.Versions[1]; ObservableCollection <PSMDiagram> diagramsV1 = versionManager.VersionedProjects[v1].PSMDiagrams; ObservableCollection <PSMDiagram> diagramsV2 = versionManager.VersionedProjects[v2].PSMDiagrams; if (diagramsV1.Count > 0) { DiagramTabManager.AddTab(diagramsV1.Last()); propertiesWindow.BindDiagram(ref dockManager); } if (diagramsV2.Count > 0) { DiagramTabManager.AddTab(diagramsV2.Last()); propertiesWindow.BindDiagram(ref dockManager); } if (diagramsV1.Count == 0 && diagramsV2.Count == 0) { ObservableCollection <PIMDiagram> pimDiagramsV1 = versionManager.VersionedProjects[v1].PIMDiagrams; ObservableCollection <PIMDiagram> pimDiagramsV2 = versionManager.VersionedProjects[v2].PIMDiagrams; if (pimDiagramsV1.Count > 0) { DiagramTabManager.AddTab(pimDiagramsV1.Last()); propertiesWindow.BindDiagram(ref dockManager); } if (pimDiagramsV2.Count > 0) { DiagramTabManager.AddTab(pimDiagramsV2.Last()); propertiesWindow.BindDiagram(ref dockManager); } } //DocumentPane.NewVerticalTabGroupCommand.Execute(null, DiagramTabManager.ActivePane); DiagramTabManager.ActivePane.CreateNewVerticalTabGroup(); if (diagramsV2.Count > 0) { DiagramTabManager.ActivateDiagram(diagramsV2.Last()); } } else { for (int i = 0; i < Math.Min(CurrentProject.Diagrams.Count, 8); i++) { DiagramTabManager.AddTab(CurrentProject.Diagrams[i]); propertiesWindow.BindDiagram(ref dockManager); } } } }