Ejemplo n.º 1
0
        private void tsbPastePlugInDef_Click(object sender, EventArgs e)
        {
            ICloneable builder = _copiedBuilder as ICloneable;

            if (builder == null)
            {
                return;
            }

            try
            {
                ChoPlugInBuilder newBuilder = builder.Clone() as ChoPlugInBuilder;
                if (newBuilder == null)
                {
                    return;
                }

                newBuilder.Name = "{0}_Copy_{1}".FormatString(ChoPlugInBuilder.GetPlugInName(builder.GetType()), NextIndex());
                AddNewBuilder(newBuilder);
            }
            catch (Exception ex)
            {
                txtOutput.Text = FormatException(null, ex, "Error while pasting PlugIn.");
            }
        }
Ejemplo n.º 2
0
        private void btnAddNewPlugIn_Click(object sender, EventArgs e)
        {
            KeyValuePair <string, Type> keyValuePair = (KeyValuePair <string, Type>)cmbAvailPlugIns.SelectedItem;

            if (keyValuePair.Value == null)
            {
                return;
            }

            ChoPlugInBuilder builder = ChoActivator.CreateInstance(keyValuePair.Value) as ChoPlugInBuilder;

            if (builder == null)
            {
                return;
            }

            builder.Name = "{0}_{1}".FormatString(ChoPlugInBuilder.GetPlugInName(builder.GetType()), NextIndex());
            AddNewBuilder(builder);
        }
Ejemplo n.º 3
0
        private void ChoPlugInEditor_Load(object sender, EventArgs e)
        {
            ApplySettings();

            txtParams.Text = Arguments;
            Type plugInType = null;

            SortedDictionary <string, Type> availPlugInDict = new SortedDictionary <string, Type>();

            //Load all plugins builders to combobox
            foreach (Type t in ChoType.GetTypesDerivedFrom <ChoPlugInBuilder>())
            {
                plugInType = ChoPlugInBuilder.GetPlugInType(t);

                if (plugInType != null)
                {
                    availPlugInDict.Add(ChoPlugInBuilder.GetPlugInName(t), t);
                }
            }
            cmbAvailPlugIns.DataSource    = new BindingSource(availPlugInDict, null);
            cmbAvailPlugIns.DisplayMember = "Key";
            cmbAvailPlugIns.ValueMember   = "Value";

            tsbCmbPlugInsGroup.ComboBox.SelectedValueChanged += ComboBox_SelectedValueChanged;
            tsbCmbPlugInsGroup.ComboBox.DropDown             += ComboBox_DropDown;
            Rebind();

            if (!_defaultPlugInGroupName.IsNullOrWhiteSpace())
            {
                if (tsbCmbPlugInsGroup.ComboBox.FindString(_defaultPlugInGroupName) >= 0)
                {
                    tsbCmbPlugInsGroup.ComboBox.Text = _defaultPlugInGroupName;
                }
            }

            //LoadPlugInsFromFile(PlugInDefFilePath);
        }