private void loadFile(string path) { ULogFile f = new ULogFile(); if (f.Load(path, fieldConfigs)) { LogPageControl lpc = new LogPageControl(f, this); lpc.addFieldBtn.Click += AddFieldBtn_Click; TabPage page = new TabPage(); page.Header = f.File.Name; page.Content = lpc; page.DisposableContent = f; mainTabControl.Items.Insert(mainTabControl.Items.Count - 1, page); mainTabControl.SelectedIndex = mainTabControl.Items.Count - 2; currentPage = lpc; } }
public LogPageControl(ULogFile uf, MainWindow w) { InitializeComponent(); logFile = uf; paramList.ItemsSource = logFile.Parameters; msgList.ItemsSource = logFile.Messages; propList.ItemsSource = logFile.Infomations; graphs = new ObservableCollection <Graph>(); graphs.Add(new BlankGraph()); graphList.ItemsSource = graphs; mainWindow = w; Graph g = new Graph(); graphs.Insert(graphs.Count - 1, g); graphList.SelectedIndex = graphs.Count - 2; setCurrentGraph(g); Dispatcher.BeginInvoke(new Action(() => currentGraph.TakeSnapShot(mainChart)), System.Windows.Threading.DispatcherPriority.ContextIdle, null); }
private void Button_Click(object sender, RoutedEventArgs e) { System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog(); if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string path = ofd.FileName; ULogFile f = new ULogFile(); if (f.Load(path, fieldConfigs)) { LogPageControl lpc = new LogPageControl(f, this); lpc.addFieldBtn.Click += AddFieldBtn_Click; TabPage page = new TabPage(); page.Header = f.File.Name; page.Content = lpc; page.DisposableContent = f; mainTabControl.Items.Insert(mainTabControl.Items.Count - 1, page); mainTabControl.SelectedIndex = mainTabControl.Items.Count - 2; currentPage = lpc; } } }