Exemplo n.º 1
0
 private void ShapeButton_Click(object sender, EventArgs e)
 {
     if (Shapes.State == EState.None)
     {
         Shapes.State = EState.ReadyDrawing;
         ShapeButton btn = (ShapeButton)sender;
         
         Shapes.ShapeToWork = (Shape)Activator.CreateInstance(btn.TypeOfShape, new object[] { colorDialogSelect.Color, Int32.Parse(labelThickness.Text), 0, 0, 0, 0 });
     }
 }
Exemplo n.º 2
0
        private void importToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ConfigSettings == null)
            {
                MessageBox.Show("Config wasn't load.");
                return;
            }
            try
            {
                InitializeImport(ConfigSettings.ModuleSettings.ModulePath);

                var y = 1;
                var runtimeTypes = new List<Type>();
                foreach (var extension in imports.readerExtCollection)
                {
                    try
                    {
                        var btn = new ShapeButton();
                        btn.Text = extension.Value.GetType().ToString().Split('.')[0];
                        btn.Location = new Point(5, 22 * (y++));
                        btn.TypeOfShape = extension.Value.GetType();
                        btn.Click += new EventHandler(ShapeButton_Click);
                        groupBoxShape.Controls.Add(btn);

                        runtimeTypes.Add(extension.Value.GetType());
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }
                runtimeTypes.Add(Shapes.GetType());
                runtimeTypes.Add(Shapes.list.GetType());
                runtimeTypes.Add(typeof(Instrument));

                kBinder.KnownTypes = runtimeTypes;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            ClearFileDialog();
        }