private void OpenNewProject_Click(object sender, EventArgs e)
        {
            Form Form = new DrawScene();

            this.Hide();
            Form.ShowDialog();
            this.Close();
        }
        public CirclePerimeters(DrawScene scene)
        {
            InitializeComponent();
            this.CenterToScreen();
            parent = scene;

            if (parent.IsEditing && parent.SelectedFigure != null)
            {
                double[] Value = parent.SelectedFigure.GetValues();
                RadiusPer.Text = Value[0].ToString();
            }
        }
        public RectPerimeters(DrawScene scene)
        {
            InitializeComponent();
            this.CenterToScreen();
            parent = scene;

            if (parent.IsEditing && parent.SelectedFigure != null)
            {
                double[] Value = parent.SelectedFigure.GetValues();
                HeightRect.Text = Value[0].ToString();
                WidthRect.Text  = Value[1].ToString();
            }
        }
        public TrianglePerimeters(DrawScene scene)
        {
            InitializeComponent();
            this.CenterToScreen();
            parent = scene;

            if (parent.IsEditing && parent.SelectedFigure != null)
            {
                double[] Value = parent.SelectedFigure.GetValues();
                TriLeftSide.Text  = Value[0].ToString();
                TriRightSide.Text = Value[1].ToString();
                TriBaseSide.Text  = Value[2].ToString();
            }
        }
        private void ImportProject_Click(object sender, EventArgs e)
        {
            DrawScene Form = new DrawScene();

            using (var openFileDialog = new OpenFileDialog())
            {
                try
                {
                    openFileDialog.FileName   = "";
                    openFileDialog.Filter     = "Binary files (*.Json)|*.Json|All files(*.*)|*.*";
                    openFileDialog.DefaultExt = "Binary files (*.Json)|*.Json|All files(*.*)|*.*";
                    if (openFileDialog.ShowDialog() == DialogResult.OK)
                    {
                        var strJsonResult = File.ReadAllText(openFileDialog.FileName);
                        var resultShapes  = JsonConvert.DeserializeObject <List <SerializeableShape> >(strJsonResult);
                        var index         = 0;
                        foreach (var f in resultShapes)
                        {
                            switch (f.FigureType)
                            {
                            case (int)FigureTypes.Circle:
                                Form.FigureList.Add(new Circle(f.Perimeters[0], f.Points[0], f.Points[1], f.Color, ++index));
                                break;

                            case (int)FigureTypes.Rectangle:
                                Form.FigureList.Add(new LibraryProject.Rectangle(f.Perimeters[0], f.Perimeters[1], f.Points[0], f.Points[1], f.Color, ++index));
                                break;

                            case (int)FigureTypes.Triangle:
                                Form.FigureList.Add(new Triangle(f.Perimeters[0], f.Perimeters[1], f.Perimeters[2], f.Points[0], f.Points[1], f.Color, ++index));
                                break;
                            }
                        }
                    }
                    Form.ShowDialog();
                    this.Close();
                }

                catch (Exception ex) when(ex is Newtonsoft.Json.JsonReaderException)
                {
                    labelAlert.Text = "INVALID FILE!";
                    labelAlert.Show();
                }
                catch (Exception ex) when(ex is NotImplementedException || ex is System.IndexOutOfRangeException)
                {
                    labelAlert.Text = "INVALID FIGURES!";
                    labelAlert.Show();
                }
            }
        }