private void MenuItem_Click(object sender, RoutedEventArgs e) { MenuItem item = sender as MenuItem; ///edit if (item.Header.ToString().Equals(Properties.Resources.MENU_GRAPH_SETTINGS)) { if (UINodeParameters.Instance != null && graphs.Count > 0) { if (GraphDocuments.SelectedContentIndex > -1) { var graph = graphs[GraphDocuments.SelectedContentIndex]; if (graph.Graph != null) { UINodeParameters.Instance.SetActive(graph.Graph); } } } } else if (item.Header.ToString().Equals(Properties.Resources.MENU_REDO)) { if (GraphDocuments.SelectedContentIndex > -1) { var graph = graphs[GraphDocuments.SelectedContentIndex]; graph.TryAndRedo(); } } else if (item.Header.ToString().Equals(Properties.Resources.MENU_UNDO)) { if (GraphDocuments.SelectedContentIndex > -1) { var graph = graphs[GraphDocuments.SelectedContentIndex]; graph.TryAndUndo(); } } ///windows else if (item.Header.ToString().Equals(Properties.Resources.MENU_3D_PREVIEW)) { if (Preview3DPane.IsVisible) { Preview3DPane.Hide(); } else { Preview3DPane.Show(); } } else if (item.Header.ToString().Equals(Properties.Resources.MENU_2D_PREVIEW)) { if (Preview2DPane.IsVisible) { Preview2DPane.Hide(); } else { Preview2DPane.Show(); } } else if (item.Header.ToString().Equals(Properties.Resources.MENU_PARAMETERS)) { if (ParametersPane.IsVisible) { ParametersPane.Hide(); } else { ParametersPane.Show(); } } else if (item.Header.ToString().Equals(Properties.Resources.MENU_SHELF)) { if (ShelfPane.IsVisible) { ShelfPane.Hide(); } else { ShelfPane.Show(); } } else if (item.Header.ToString().Equals(Properties.Resources.MENU_LOG)) { if (LogPane.IsVisible) { LogPane.Hide(); } else { LogPane.Show(); } } else if (item.Header.ToString().Equals(Properties.Resources.MENU_CLOSE_ALL)) { for (int i = 0; i < documents.Count; ++i) { var doc = documents[i]; doc.Close(); } } //file menu else if (item.Header.ToString().Equals(Properties.Resources.MENU_SAVE_AS)) { if (graphs.Count > 0 && GraphDocuments.SelectedContentIndex > -1 && GraphDocuments.SelectedContentIndex < graphs.Count) { UIGraph graph = graphs[GraphDocuments.SelectedContentIndex]; LayoutDocument doc = documents[GraphDocuments.SelectedContentIndex]; ShowSaveDialog(graph, doc, true); } } else if (item.Header.ToString().Equals(Properties.Resources.MENU_SAVE)) { if (graphs.Count > 0 && GraphDocuments.SelectedContentIndex > -1 && GraphDocuments.SelectedContentIndex < graphs.Count) { UIGraph graph = graphs[GraphDocuments.SelectedContentIndex]; LayoutDocument doc = documents[GraphDocuments.SelectedContentIndex]; HandleSave(graph, doc); } } else if (item.Header.ToString().Equals(Properties.Resources.MENU_OPEN)) { ShowOpenDialog(); } else if (item.Header.ToString().Equals(Properties.Resources.MENU_NEW)) { HandleCreate(); } else if (item.Header.ToString().Equals(Properties.Resources.MENU_EXPORT_OUTPUTS)) { if (graphs.Count > 0 && GraphDocuments.SelectedContentIndex > -1 && GraphDocuments.SelectedContentIndex < graphs.Count) { UIExportOutputs exportdialog = new UIExportOutputs(graphs[GraphDocuments.SelectedContentIndex]); exportdialog.ShowDialog(); } } else if (item.Header.ToString().Equals("_Layers")) { if (LayersPane.IsVisible) { LayersPane.Hide(); } else { LayersPane.Show(); } } }
private void Show_Layers(object sender, RoutedEventArgs e) { LayersPane.Show(); }