private void ShowWindowButtonClickHandler(object sender, RoutedEventArgs args) { DemoWindow window = new DemoWindow { WindowStyle = ((WindowStyleViewModel)DataContext).SelectedWindowStyle }; window.ShowDialog(); }
/// 编辑类图(创建并打开相应对话框) private void Edit_Executed(object sender, ExecutedRoutedEventArgs e) { // 判断具体是在哪种类图上点击的右键编辑,即判断选中的类图 var nodesCopy = this.ViewModel.Network.Nodes.ToArray(); foreach (var node in nodesCopy) { if (node.IsSelected) { if (node is ProcessVM) { new ProcessWindow((ProcessVM)node).ShowDialog(); } else if (node is UserType2VM) { new UserTypeWindow((UserType2VM)node).ShowDialog(); } else if (node is SecurityPropertyVM) { new SecurityPropertyWindow((SecurityPropertyVM)node).ShowDialog(); } else if (node is SafetyPropertyVM) { new SafetyPropertyWindow((SafetyPropertyVM)node).ShowDialog(); } else if (node is AxiomVM) { new AxiomWindow((AxiomVM)node).ShowDialog(); } else { DemoWindow demoWindow = new DemoWindow(); demoWindow.ShowDialog(); } break; } } }