Пример #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);
            }
        }
Пример #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!");
                }
            }
        }
Пример #3
0
 public Form1()
 {
     InitializeComponent();
     topcinja       = new BallDoc();
     createBall     = 0;
     DoubleBuffered = true;
     pause          = true;
 }
Пример #4
0
 public Form1()
 {
     InitializeComponent();
     doc = new BallDoc();
     timer1.Start();
     timer2.Start();
     DoubleBuffered = true;
     Go             = true;
 }
Пример #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);
 }
Пример #6
0
 private void newToolStripButton_Click(object sender, EventArgs e)
 {
     topcinja = new BallDoc();
 }
Пример #7
0
 private void newToolStripButton_Click(object sender, EventArgs e)
 {
     doc = new BallDoc();
     Invalidate(true);
 }
Пример #8
0
 private void newGameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     doc = new BallDoc();
 }