Beispiel #1
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.InitialDirectory = Path.GetDirectoryName(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
            saveFileDialog.FileName         = "MagicShapesSave";
            saveFileDialog.DefaultExt       = "bin";
            saveFileDialog.Filter           = "Binary (*.bin)|*.bin";
            saveFileDialog.ShowDialog();
            PolygonBusiness polygonBusiness = new PolygonBusiness();

            polygonBusiness.Store(Polygons, saveFileDialog.FileName);
        }
Beispiel #2
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = Path.GetDirectoryName(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
            openFileDialog.Filter           = "Binary (*.bin)|*.bin";

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                PolygonBusiness      polygonBusiness = new PolygonBusiness();
                LinkedList <Polygon> filePolygons    = polygonBusiness.Retrieve(openFileDialog.FileName);
                Polygons = filePolygons;
                canvasPanel.Invalidate();
            }
        }