示例#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
文件: Form1.cs 项目: kmartin62/VP
        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
文件: Form1.cs 项目: kmartin62/VP
 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
文件: Form1.cs 项目: kmartin62/VP
 private void newGameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     doc = new BallDoc();
 }