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; } }
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; } } }