Esempio n. 1
0
        private void buttonAddShape_Click(object sender, EventArgs e)
        {
            // TODO factory madness
            if (sender == buttonAddRectangle)
            {
                Shapes.Add(new RectangleShape());
            }
            else
            {
                Shapes.Add(new CircleShape());
            }

            // select the last element in the listbox
            listBoxShapes.SelectedIndex = listBoxShapes.Items.Count - 1;
            buttonRemove.Enabled        = true;
            groupBoxShape.Visible       = true;

            // when adding the very first shape selectedindexchanged event is not called so we need to update setting controls manually
            if (Shapes.Count == 1)
            {
                UpdateShapePanel(listBoxShapes.SelectedItem as Shape);
            }

            ModificationObserver.AddAddAction(listBoxShapes.SelectedItem as Shape, ref listBoxShapes, ref groupBoxShape);
            undoToolStripMenuItem.Enabled = true;
        }
Esempio n. 2
0
        private void buttonRemove_Click(object sender, EventArgs e)
        {
            ModificationObserver.AddDeleteAction(listBoxShapes.SelectedItem as Shape, ref listBoxShapes, ref groupBoxShape);

            Shapes.RemoveAt(listBoxShapes.SelectedIndex);

            if (listBoxShapes.Items.Count <= 0)
            {
                buttonRemove.Enabled  = false;
                groupBoxShape.Visible = false;
            }

            SendDataToClient();
        }
Esempio n. 3
0
 private void redoToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ModificationObserver.PerformRedo();
 }