private void openFile()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Balloons doc file (*.bal)|*.bal";
            openFileDialog.Title  = "Open balloons file";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                FileName = openFileDialog.FileName;
                try
                {
                    using (FileStream fileStream = new FileStream(FileName, FileMode.Open))
                    {
                        IFormatter formater = new BinaryFormatter();
                        balloonsDoc = (BalloonsDoc)formater.Deserialize(fileStream);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Could not read file: " + FileName);
                    FileName = null;
                    return;
                }
                Invalidate(true);
            }
        }
 public Form1()
 {
     InitializeComponent();
     balloonsDoc         = new BalloonsDoc();
     this.DoubleBuffered = true;
     timer          = new Timer();
     timer.Interval = 200;
     timer.Tick    += new EventHandler(timer_Tick);
     timer.Start();
 }
Ejemplo n.º 3
0
Archivo: Form1.cs Proyecto: AtanasK/VP
 public Form1()
 {
     InitializeComponent();
     balloonsDoc = new BalloonsDoc();
     this.DoubleBuffered = true;
     timer = new Timer();
     timer.Interval = 200;
     timer.Tick += new EventHandler(timer_Tick);
     timer.Start();
 }
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     balloonsDoc = new BalloonsDoc();
     Invalidate();
 }
Ejemplo n.º 5
0
Archivo: Form1.cs Proyecto: AtanasK/VP
 private void openFile()
 {
     OpenFileDialog openFileDialog = new OpenFileDialog();
     openFileDialog.Filter = "Balloons doc file (*.bal)|*.bal";
     openFileDialog.Title = "Open balloons file";
     if (openFileDialog.ShowDialog() == DialogResult.OK)
     {
         FileName = openFileDialog.FileName;
         try
         {
             using (FileStream fileStream = new FileStream(FileName, FileMode.Open))
             {
                 IFormatter formater = new BinaryFormatter();
                 balloonsDoc = (BalloonsDoc)formater.Deserialize(fileStream);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Could not read file: " + FileName);
             FileName = null;
             return;
         }
         Invalidate(true);
     }
 }
Ejemplo n.º 6
0
Archivo: Form1.cs Proyecto: AtanasK/VP
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     balloonsDoc = new BalloonsDoc();
     Invalidate();
 }