public void Open() { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Cicles doc file (*.plc) | *.plc"; 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 = (BallDoc)formatter.Deserialize(filestream); } } catch (Exception e) { MessageBox.Show("Could not read file: " + FileName); FileName = null; return; } Invalidate(true); } }
private void openFileToolStripMenuItem_Click(object sender, EventArgs e) { if (FileName == null) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Open your balls *.fck | *.fck"; dialog.Title = "Open your balls"; if (dialog.ShowDialog() == DialogResult.OK) { FileName = dialog.FileName; } } if (FileName != null) { try { FileStream fs = new FileStream(FileName, FileMode.Open); IFormatter fi = new BinaryFormatter(); doc = (BallDoc)fi.Deserialize(fs); } catch { throw new Exception("Invalid!"); } } }
public Form1() { InitializeComponent(); topcinja = new BallDoc(); createBall = 0; DoubleBuffered = true; pause = true; }
public Form1() { InitializeComponent(); doc = new BallDoc(); timer1.Start(); timer2.Start(); DoubleBuffered = true; Go = true; }
public Form1() { InitializeComponent(); doc = new BallDoc(); random = new Random(); this.DoubleBuffered = true; timer = new Timer(); timer.Interval = 100; timer.Tick += new EventHandler(timer_Tick); }
private void newToolStripButton_Click(object sender, EventArgs e) { topcinja = new BallDoc(); }
private void newToolStripButton_Click(object sender, EventArgs e) { doc = new BallDoc(); Invalidate(true); }
private void newGameToolStripMenuItem_Click(object sender, EventArgs e) { doc = new BallDoc(); }