/// <summary>The constructor for the main form.</summary> public MainForm() { InitializeComponent(); // These controls should only appear if there is an MDI child mdiChildItems = new List <ToolStripItem> { menuSaveAs, menuPrint, menuPrintPreview, menuPrintSetup, toolbarPrint, toolbarSaveAs }; // Initially disable Save, etc. MainForm_MdiChildActivate(null, null); #if DEBUG // For quick debugging, open a default file WaveformWindow ww = new WaveformWindow(this, Library.Waveform.FromXMLFile(@"BenfWaves.Tests\Samples\100ksine.xml")); ww.Show(); #endif }
/// <summary>Save a file to a specific location.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void SaveFile_Click(object sender, EventArgs e) { WaveformWindow ww = ActiveMdiChild as WaveformWindow; if (ww != null) { ww.SaveAs(); } }
/// <summary>Open a file.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void OpenFile_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.DefaultExt = "xml"; dialog.Filter = "DSO Nano XML files (*.xml)|*.xml|All files (*.*)|*.*"; dialog.Multiselect = true; if (dialog.ShowDialog() == DialogResult.OK) { foreach (string filename in dialog.FileNames) { Waveform newwave = Waveform.FromXMLFile(filename); WaveformWindow ww = new WaveformWindow(this, newwave); ww.Show(); } } }