Example #1
0
        /// <summary>
        /// Обработчик события открытия файла
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void openFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var saver = new Saver();

            if (openFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            try
            {
                var fileLoadedEventArgs = saver.OpenFromFile(openFileDialog.FileName);
                FileLoaded?.Invoke(this, fileLoadedEventArgs);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Example #2
0
        /// <summary>
        /// Метод для сохранения
        /// </summary>
        private void SaveToFile()
        {
            var saver = new Saver();

            if (saveFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            try
            {
                saver.SaveToFile(_undoRedoStack,
                                 saveFileDialog.FileName);
                Canvas.Refresh();
            }
            catch (Exception)
            {
                throw new Exception();
            }
        }