Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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!");
                }
            }
        }
Ejemplo n.º 3
0
 public Form1()
 {
     InitializeComponent();
     topcinja       = new BallDoc();
     createBall     = 0;
     DoubleBuffered = true;
     pause          = true;
 }
Ejemplo n.º 4
0
 public Form1()
 {
     InitializeComponent();
     doc = new BallDoc();
     timer1.Start();
     timer2.Start();
     DoubleBuffered = true;
     Go             = true;
 }
Ejemplo n.º 5
0
 public Form1()
 {
     InitializeComponent();
     doc    = new BallDoc();
     random = new Random();
     this.DoubleBuffered = true;
     timer          = new Timer();
     timer.Interval = 100;
     timer.Tick    += new EventHandler(timer_Tick);
 }
Ejemplo n.º 6
0
 private void newToolStripButton_Click(object sender, EventArgs e)
 {
     topcinja = new BallDoc();
 }
Ejemplo n.º 7
0
 private void newToolStripButton_Click(object sender, EventArgs e)
 {
     doc = new BallDoc();
     Invalidate(true);
 }
Ejemplo n.º 8
0
 private void newGameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     doc = new BallDoc();
 }