Exemple #1
0
        private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                using (var file = saveFileDialog.OpenFile())
                    DrawableSchemeStorage.Save(scheme, file);

                filename = saveFileDialog.FileName;

                modified = false;
            }
        }
Exemple #2
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(filename))
            {
                using (var file = File.Open(filename, FileMode.Create))
                    DrawableSchemeStorage.Save(scheme, file);

                modified = false;
            }
            else
            {
                saveAsToolStripMenuItem_Click(sender, e);
            }
        }
Exemple #3
0
        public static void Save(DrawableScheme scheme, Stream stream)
        {
            #region arguments check

            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }
            if (!stream.CanWrite)
            {
                throw new ArgumentException("The stream must be writeable.", nameof(stream));
            }

            #endregion

            using (var streamWriter = new StreamWriter(stream))
                streamWriter.Write(DrawableSchemeStorage.Save(scheme));
        }