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

            openFileDialog.Filter = "Cicles doc file (*.bal) | *.bal";
            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 = (BallsDoc)formatter.Deserialize(filestream);
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show("Could not read file: " + FileName);
                    FileName = null;
                    return;
                }
                Invalidate(true);
            }
        }
Exemplo n.º 2
0
Arquivo: Form1.cs Projeto: AtanasK/VP
 private void openFile()
 {
     OpenFileDialog openFileDialog = new OpenFileDialog();
     openFileDialog.Filter = "Balls doc file (*.bll)|*.bll";
     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();
                 doc = (BallsDoc)formater.Deserialize(fileStream);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Could not read file: " + FileName);
             FileName = null;
             return;
         }
         Invalidate(true);
     }
 }
Exemplo n.º 3
0
Arquivo: Form1.cs Projeto: AtanasK/VP
 public Form1()
 {
     InitializeComponent();
     DoubleBuffered = true;
     doc = new BallsDoc(this.Width, this.Height);
     timer = new Timer();
     timer.Interval = 50;
     timer.Tick += new EventHandler(timer_Tick);
 }
Exemplo n.º 4
0
 public Form1()
 {
     InitializeComponent();
     DoubleBuffered = true;
     doc            = new BallsDoc(this.Width, this.Height);
     timer          = new Timer();
     timer.Interval = 50;
     timer.Tick    += new EventHandler(timer_Tick);
 }
Exemplo n.º 5
0
 public Form1()
 {
     InitializeComponent();
     doc = new BallsDoc();
     this.DoubleBuffered = true;
     timer          = new Timer();
     timer.Interval = 50;
     timer.Tick    += new EventHandler(timer_Tick);
     timer.Start();
 }
Exemplo n.º 6
0
Arquivo: Form1.cs Projeto: AtanasK/VP
 private void newToolStripButton_Click(object sender, EventArgs e)
 {
     doc = new BallsDoc(Width, Height);
     Invalidate(true);
 }
Exemplo n.º 7
0
 private void newToolStripButton_Click(object sender, EventArgs e)
 {
     doc = new BallsDoc(Width, Height);
     Invalidate(true);
 }
Exemplo n.º 8
0
 public void newFile()
 {
     clickedBall = null;
     random      = new Random();
     balls       = new BallsDoc();
 }