Ejemplo 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);
            }
        }
Ejemplo 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);
            }
        }
Ejemplo n.º 3
0
 private void newToolStripButton_Click(object sender, EventArgs e)
 {
     doc   = new PolygonDoc();
     start = Point.Empty;
     end   = Point.Empty;
     p     = null;
     Invalidate(true);
 }
Ejemplo n.º 4
0
 void open(string path)
 {
     using (FileStream stream = new FileStream(path, FileMode.Open))
     {
         IFormatter formatter = new BinaryFormatter();
         polygons = (PolygonDoc)formatter.Deserialize(stream);
     }
 }
Ejemplo n.º 5
0
 public Form1()
 {
     InitializeComponent();
     doc   = new PolygonDoc();
     start = Point.Empty;
     end   = Point.Empty;
     // points = new Point[50];
     this.DoubleBuffered = true;
 }
Ejemplo n.º 6
0
 private void newDoc()
 {
     askToSave();
     FileName       = "Untitled";
     polygonDoc     = new PolygonDoc();
     currentPolygon = null;
     startPoint     = Point.Empty;
     previousPoint  = Point.Empty;
     setTitle();
 }
Ejemplo n.º 7
0
Archivo: Form1.cs Proyecto: 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);
     }
 }
Ejemplo n.º 8
0
Archivo: Form1.cs Proyecto: BojanaT/VP
 private void newDoc()
 {
     askToSave();
     FileName = "Untitled";
     polygonDoc = new PolygonDoc();
     currentPolygon = null;
     startPoint = Point.Empty;
     previousPoint = Point.Empty;
     setTitle();
 }
Ejemplo n.º 9
0
 public Form1()
 {
     InitializeComponent();
     DoubleBuffered = true;
     polygons       = new PolygonDoc();
 }
 public void newFile()
 {
     currentPolygon = null;
     polygons       = new PolygonDoc();
     currentColor   = Color.Blue;
 }
Ejemplo n.º 11
0
Archivo: Form1.cs Proyecto: AtanasK/VP
 public Form1()
 {
     InitializeComponent();
     DoubleBuffered = true;
     polygons = new PolygonDoc();
 }