//public class MenuItem //{ // public MenuItem() // { // this.Items = new ObservableCollection<MenuItem>(); // } // public string Title { get; set; } // public ObservableCollection<MenuItem> Items { get; set; } //} private void MenuItem_Click(object sender, RoutedEventArgs e) { Sim = new Simulation("", System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @".\EngineInputTemplateTypeDefines.xml"); Sim.New(); VisualData = new TreeViewModel(Sim); TreeviewControl.SetData(VisualData); base.DataContext = TreeviewControl; listView.DataContext = this; }
private void MenuItem_Click_2(object sender, RoutedEventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.InitialDirectory = "c:\\"; openFileDialog1.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*"; openFileDialog1.FilterIndex = 1; openFileDialog1.RestoreDirectory = true; if (openFileDialog1.ShowDialog() == true) { string fileName = openFileDialog1.FileName; Sim = new Simulation(fileName, System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @".\EngineInputTemplateTypeDefines.xml"); } VisualData = new TreeViewModel(Sim); TreeviewControl.SetData(VisualData); base.DataContext = TreeviewControl; listView.DataContext = this; }