/// <summary> /// Saves the integrator data using the specified saver. /// </summary> /// <param name="saver">The saver to use</param> /// <remarks></remarks> public void save(ISaver saver) { if (object.ReferenceEquals(null, saver)) { throw new ArgumentNullException("saver"); } lock (slockop) { saver.save(this); } }
public override void execute(ref int stackIndex, ref List <Command> stack) { SaveFileDialog saveFileDialog = new SaveFileDialog() { Filter = "Midi|*.mid|Lilypond|*.ly|PDF|*.pdf" }; saveFileDialog.FileName = tempFileName; if (saveFileDialog.ShowDialog() == true) { string extension = Path.GetExtension(saveFileDialog.FileName); SaverFactory factory = new SaverFactory(); ISaver saver = factory.createSaver(extension); if (saver != null) { saver.save(saveFileDialog.FileName, textBox.Text); } else { MessageBox.Show($"Extension {extension} is not supported."); } } }