Esempio n. 1
0
        private void AddShapeButton_Click(object sender, EventArgs e)
        {
            inputShape = textBox1.Text;

            DrawEngineParser d = new DrawEngineParser(this.canvas);

            d.ParsingToShape(d.Parse(inputShape));

            this.textBox1.Clear();
            this.sourcePanel.Controls.Clear();
        }
Esempio n. 2
0
        private void loadButton_Click(object sender, EventArgs e)
        {
            if (this.canvas.Shapes.Count > 0)
            {
                DialogResult result = MessageBox.Show
                                          ("You have unsaved changes\nyou are about to overwrite your current board", "Confirm overwrite", MessageBoxButtons.YesNo);
                if (result == DialogResult.Cancel || result == DialogResult.Abort || result == DialogResult.No)
                {
                    return;
                }
            }

            this.allSourceCode = ShapeManager.load();

            if (allSourceCode == null)
            {
                return;
            }

            if (allSourceCode.Count > 0)
            {
                this.canvas.Shapes.Clear();
            }

            DrawEngineParser d = new DrawEngineParser(this.canvas);

            foreach (var line in allSourceCode)
            {
                d.ParsingToShape(d.Parse(line));
            }

            this.loading = true;

            this.drawingCanvas.Invalidate();
            this.textBox1.Clear();
            this.sourcePanel.Controls.Clear();
        }