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

            openFileDialog.Filter = "Balls doc file (*.bls)|*.bls";
            openFileDialog.Title  = "Open balls doc file";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                FileName = openFileDialog.FileName;
                try
                {
                    using (FileStream fileStream = new FileStream(FileName, FileMode.Open))
                    {
                        IFormatter formater = new BinaryFormatter();
                        ballsDoc = (BallsDoc)formater.Deserialize(fileStream);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Could not read file: " + FileName);
                    FileName = null;
                    return;
                }
                Invalidate(true);
            }
        }
Exemplo n.º 2
0
Arquivo: Form1.cs Projeto: AtanasK/VP
 public Form1()
 {
     InitializeComponent();
     ballsDoc = new BallsDoc();
     generateBall = 0;
     random = new Random();
     timer = new Timer();
     timer.Interval = 100;
     timer.Tick += new EventHandler(timer_Tick);
     timer.Start();
     DoubleBuffered = true;
 }
 public Form1()
 {
     InitializeComponent();
     ballsDoc       = new BallsDoc();
     generateBall   = 0;
     random         = new Random();
     timer          = new Timer();
     timer.Interval = 100;
     timer.Tick    += new EventHandler(timer_Tick);
     timer.Start();
     DoubleBuffered = true;
 }
Exemplo n.º 4
0
Arquivo: Form1.cs Projeto: AtanasK/VP
 private void openFile()
 {
     OpenFileDialog openFileDialog = new OpenFileDialog();
     openFileDialog.Filter = "Balls doc file (*.bls)|*.bls";
     openFileDialog.Title = "Open balls doc file";
     if (openFileDialog.ShowDialog() == DialogResult.OK)
     {
         FileName = openFileDialog.FileName;
         try
         {
             using (FileStream fileStream = new FileStream(FileName, FileMode.Open))
             {
                 IFormatter formater = new BinaryFormatter();
                 ballsDoc = (BallsDoc)formater.Deserialize(fileStream);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Could not read file: " + FileName);
             FileName = null;
             return;
         }
         Invalidate(true);
     }
 }
Exemplo n.º 5
0
Arquivo: Form1.cs Projeto: AtanasK/VP
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ballsDoc = new BallsDoc();
     Invalidate(true);
 }
 private void newToolStripButton_Click(object sender, EventArgs e)
 {
     ballsDoc = new BallsDoc();
     Invalidate(true);
 }