Esempio n. 1
0
        public void openFile()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Pie doc file (*.pie)|*.pie";
            openFileDialog.Title  = "Open pie doc";
            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                fileName = openFileDialog.FileName;
                try
                {
                    using (FileStream fileStream = new FileStream(fileName, FileMode.Open))
                    {
                        IFormatter formatter = new BinaryFormatter();
                        doc = (PieDocument)formatter.Deserialize(fileStream);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Could not read file: " + fileName);
                    fileName = null;
                    return;
                }
                Invalidate(true);
            }
        }
Esempio n. 2
0
 public Form1()
 {
     InitializeComponent();
     doc            = new PieDocument();
     color          = Color.Blue;
     timer          = new Timer();
     timer.Interval = 500;
     timer.Tick    += new EventHandler(timer_Tick);
 }
Esempio n. 3
0
 private void newToolStripButton_Click(object sender, EventArgs e)
 {
     doc = new PieDocument();
     Invalidate(true);
 }