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();
 }
Exemplo n.º 3
0
Arquivo: Form1.cs Projeto: 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();
 }
Exemplo n.º 5
0
Arquivo: Form1.cs Projeto: 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);
     }
 }
Exemplo n.º 6
0
Arquivo: Form1.cs Projeto: AtanasK/VP
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     balloonsDoc = new BalloonsDoc();
     Invalidate();
 }