Esempio n. 1
0
        public void Open()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Polygon doc file (*.pol) | *.pol";
            openFileDialog.Title  = "OpenFile";

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                FileName = openFileDialog.FileName;
                try
                {
                    using (FileStream filestream = new FileStream(FileName, FileMode.Open))
                    {
                        IFormatter formatter = new BinaryFormatter();
                        doc = (PolygonDoc)formatter.Deserialize(filestream);
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show("Could not read file: " + FileName);
                    FileName = null;
                    return;
                }
                Invalidate(true);
            }
        }
Esempio n. 2
0
        private void openFile()
        {
            askToSave();
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Polygons doc file (*.pgn)|*.pgn";
            openFileDialog.Title  = "Open polygons doc file";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                FileName = openFileDialog.FileName;
                try
                {
                    using (FileStream fileStream = new FileStream(FileName, FileMode.Open))
                    {
                        IFormatter formater = new BinaryFormatter();
                        polygonDoc = (PolygonDoc)formater.Deserialize(fileStream);
                    }
                    setTitle();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Could not read file: " + FileName);
                    FileName = null;
                    return;
                }
                Invalidate(true);
            }
        }
Esempio n. 3
0
 private void newToolStripButton_Click(object sender, EventArgs e)
 {
     doc   = new PolygonDoc();
     start = Point.Empty;
     end   = Point.Empty;
     p     = null;
     Invalidate(true);
 }
Esempio n. 4
0
 void open(string path)
 {
     using (FileStream stream = new FileStream(path, FileMode.Open))
     {
         IFormatter formatter = new BinaryFormatter();
         polygons = (PolygonDoc)formatter.Deserialize(stream);
     }
 }
Esempio n. 5
0
 public Form1()
 {
     InitializeComponent();
     doc   = new PolygonDoc();
     start = Point.Empty;
     end   = Point.Empty;
     // points = new Point[50];
     this.DoubleBuffered = true;
 }
Esempio n. 6
0
 private void newDoc()
 {
     askToSave();
     FileName       = "Untitled";
     polygonDoc     = new PolygonDoc();
     currentPolygon = null;
     startPoint     = Point.Empty;
     previousPoint  = Point.Empty;
     setTitle();
 }
Esempio n. 7
0
File: Form1.cs Progetto: BojanaT/VP
 private void openFile()
 {
     askToSave();
     OpenFileDialog openFileDialog = new OpenFileDialog();
     openFileDialog.Filter = "Polygons doc file (*.pgn)|*.pgn";
     openFileDialog.Title = "Open polygons doc file";
     if (openFileDialog.ShowDialog() == DialogResult.OK)
     {
         FileName = openFileDialog.FileName;
         try
         {
             using (FileStream fileStream = new FileStream(FileName, FileMode.Open))
             {
                 IFormatter formater = new BinaryFormatter();
                 polygonDoc = (PolygonDoc)formater.Deserialize(fileStream);
             }
             setTitle();
         }
         catch (Exception ex)
         {
             MessageBox.Show("Could not read file: " + FileName);
             FileName = null;
             return;
         }
         Invalidate(true);
     }
 }
Esempio n. 8
0
File: Form1.cs Progetto: BojanaT/VP
 private void newDoc()
 {
     askToSave();
     FileName = "Untitled";
     polygonDoc = new PolygonDoc();
     currentPolygon = null;
     startPoint = Point.Empty;
     previousPoint = Point.Empty;
     setTitle();
 }
Esempio n. 9
0
 public Form1()
 {
     InitializeComponent();
     DoubleBuffered = true;
     polygons       = new PolygonDoc();
 }
 public void newFile()
 {
     currentPolygon = null;
     polygons       = new PolygonDoc();
     currentColor   = Color.Blue;
 }
Esempio n. 11
0
File: Form1.cs Progetto: AtanasK/VP
 public Form1()
 {
     InitializeComponent();
     DoubleBuffered = true;
     polygons = new PolygonDoc();
 }