void Derive_Click(object sender, RoutedEventArgs e) { ContextMenuDiagramItem m = sender as ContextMenuDiagramItem; if (m.Diagram == null) { ClassController.DerivePSMClassToNewDiagram(); } else { ClassController.DerivePSMClassToDiagram(m.Diagram as PSMDiagram); } }
void mDerive_ContextMenuOpening(object sender, ContextMenuEventArgs e) { ContextMenuDiagramItem m; mDerive.Items.Clear(); foreach (PSMDiagram d in Controller.DiagramController.Project.PSMDiagrams) { m = new ContextMenuDiagramItem(d.Caption, d); m.Click += new RoutedEventHandler(Derive_Click); mDerive.Items.Add(m); } if (Controller.DiagramController.Project.PSMDiagrams.Count > 0) { mDerive.Items.Add(new Separator()); } m = new ContextMenuDiagramItem("New PSM diagram", null); m.Icon = ContextMenuIcon.GetContextIcon("page_white"); m.Click += new RoutedEventHandler(Derive_Click); mDerive.Items.Add(m); }