private void openFile()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Пулсирачки кругови (*.pc)|*.pc";
            openFileDialog.Title  = "Отвори го фајлот";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                FileName = openFileDialog.FileName;
                try
                {
                    using (FileStream fileStream = new FileStream(FileName, FileMode.Open))
                    {
                        IFormatter formatter = new BinaryFormatter();
                        CircleDoc = (CircleDoc)formatter.Deserialize(fileStream);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Could not read file: " + FileName);
                    FileName = null;
                    return;
                }
                Invalidate(true);
            }
        }
 public Form1()
 {
     InitializeComponent();
     CircleDoc           = new CircleDoc();
     Filename            = string.Empty;
     Color               = Color.DarkBlue;
     this.DoubleBuffered = true;
 }
 public Form1()
 {
     InitializeComponent();
     CircleDoc      = new CircleDoc();
     Color          = Color.Red;
     DoubleBuffered = true;
     timer          = new Timer();
     timer.Interval = 100;
     timer.Tick    += new EventHandler(timer_Tick);
     isStarted      = false;
 }
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.Clear(Color.White);

            CircleDoc.Draw(e.Graphics);

            if (Filename != string.Empty)
            {
                this.Text = $"Pulsing circles | {Filename.Substring(Filename.LastIndexOf(@"\") + 1)}";
            }
            else
            {
                this.Text = "Pulsing circles";
            }
        }
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     timer1.Stop();
     if (MessageBox.Show("Are you sure you want to start a new game?", "Start a new game",
                         MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         CircleDoc             = new CircleDoc();
         toolStripButton1.Text = "Ста&рт";
         Filename = string.Empty;
         Invalidate(true);
     }
     if (toolStripButton1.Text != "Ста&рт")
     {
         timer1.Start();
     }
 }
 private void timer1_Tick(object sender, EventArgs e)
 {
     CircleDoc.IncrementCirclesRadius();
     Invalidate();
 }
 private void statusStrip1_Paint(object sender, PaintEventArgs e)
 {
     e.Graphics.Clear(Color.White);
     toolStripStatusLabel1.Text = $"Total: {CircleDoc.CirclesCount()}";
 }
 private void Form1_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     CircleDoc.AddCircle(e.Location, Color);
     Invalidate(true);
 }