예제 #1
0
        private void EditShapeButtonClick(object sender, EventArgs e)
        {
            string        strForComparing = this.ShapeListBox.SelectedItem.ToString();
            dynamic       shape           = this.ShapeListBox.SelectedItem;
            ShapeEditForm shapeEditForm   = new ShapeEditForm(shape);

            if (shapeEditForm.ShowDialog() == DialogResult.OK)
            {
                // To rewrite text
                int index = this.ShapeListBox.SelectedIndex;
                this.ShapeListBox.Items.RemoveAt(index);
                this.ShapeListBox.Items.Insert(index, shape);

                if (strForComparing != shape.ToString())
                {
                    this.EnableSaving();
                }
            }
        }
예제 #2
0
 private void AddShapeButton_Click(object sender, EventArgs e)
 {
     if (this.ImportedShapesComboBox.SelectedIndex >= 0)
     {
         foreach (Lazy <AbstractShape, IShapeData> shape in this.pluginContainer.ImportedShapePlugins)
         {
             if (shape.Metadata.Name == this.ImportedShapesComboBox.SelectedItem.ToString())
             {
                 dynamic       shapeToAdd = shape.Value.Clone();
                 ShapeEditForm f          = new ShapeEditForm(shapeToAdd);
                 if (f.ShowDialog() == DialogResult.OK)
                 {
                     this.ShapeListBox.Items.Add(shapeToAdd);
                     this.EnableSaving();
                 }
             }
         }
     }
 }