Beispiel #1
0
        private void Save(object sender, EventArgs e)
        {
            var fileDialog = new SaveFileDialog {
                Filter = "dotnet-paint files (*.dnp)|*.dnp"
            };

            fileDialog.ShowDialog(this);

            if (string.IsNullOrEmpty(fileDialog.FileName))
            {
                return;
            }

            ExecuteAsync(
                () => ShapesPersistence.SaveToFile(fileDialog.FileName, drawingArea.Shapes),
                "Saving...");
        }
Beispiel #2
0
        private void Open(object sender, EventArgs e)
        {
            var fileDialog = new OpenFileDialog {
                Filter = "dotnet-paint files (*.dnp)|*.dnp"
            };

            fileDialog.ShowDialog(this);

            if (string.IsNullOrEmpty(fileDialog.FileName))
            {
                return;
            }

            IList <IShape> shapes = null;

            ExecuteAsync(
                () => shapes = ShapesPersistence.LoadFromFile(fileDialog.FileName),
                "Loading...",
                () => drawingArea.SetShapes(shapes));
        }