示例#1
0
        private void repositoryItemButtonEditSource_ButtonClick(object sender, ButtonPressedEventArgs e)
        {
            var scriptSource = Scripts.ElementAt(GridViewScripts.FocusedRowHandle).ScriptSource as IPropertiesProvider;

            if (scriptSource != null)
            {
                var form = new PropertiesForm();

                var validationRules = scriptSource.GetValidationRules();
                form.SetValidationRules(validationRules);
                var propertyEditors = scriptSource.GetPropertyEditors();
                form.SetPropertyEditors(propertyEditors);
                var simpleProperties = scriptSource.GetSimpleProperties();
                form.SetSimpleProperties(simpleProperties);
                var collectionProperties = scriptSource.GetCollections();
                form.SetCollectionProperties(collectionProperties);

                if (form.ShowDialog() == DialogResult.OK)
                {
                    scriptSource.ApplySimpleProperties();
                    scriptSource.ApplyCollections();
                    GridViewScripts.HideEditor();
                    GridViewScripts.RefreshData();
                }
                else
                {
                    form.RevertChanges();
                }
            }
        }
        public void ShowPropertyGrid(object control, PropertiesNode focusedNode)
        {
            var propertiesControl = control as IPropertiesProvider;

            if (propertiesControl != null)
            {
                var form = new PropertiesForm();

                var validationRules = propertiesControl.GetValidationRules();
                form.SetValidationRules(validationRules);
                var propertyEditors = propertiesControl.GetPropertyEditors();
                form.SetPropertyEditors(propertyEditors);
                var simpleProperties = propertiesControl.GetSimpleProperties();


                form.SetSimpleProperties(simpleProperties);
                var collectionProperties = propertiesControl.GetCollections();
                form.SetCollectionProperties(collectionProperties);

                if (form.ShowDialog() == DialogResult.OK)
                {
                    propertiesControl.ApplySimpleProperties();
                    propertiesControl.ApplyCollections();

                    RenameNode(focusedNode, simpleProperties["Name"].Value.ToString());
                }
                else
                {
                    form.RevertChanges();
                }
            }
        }
示例#3
0
 private void toolStripButtonProperties_Click(object sender, EventArgs e)
 {
     if (_executionAccount != null)
     {
         PropertiesForm form = new PropertiesForm("Account Information Properties", _executionAccount.Info);
         form.ShowDialog();
     }
 }
 private void toolStripButtonAdapterProperties_Click(object sender, EventArgs e)
 {
     foreach (ListViewItem item in listViewIntegrations.SelectedItems)
     {
         IIntegrationAdapter adapter = (IIntegrationAdapter)item.Tag;
         PropertiesForm      form    = new PropertiesForm("Adapter Properties", adapter);
         form.ShowOkCancel = false;
         form.ShowDialog();
     }
 }
示例#5
0
        private void toolStripButtonProperties_Click(object sender, EventArgs e)
        {
            PropertiesForm form = new PropertiesForm("Expert Type Properties", this._expertInformation);

            form.ShowDialog();
            if (ExpertUpdateEvent != null)
            {
                ExpertUpdateEvent(this);
            }
        }
示例#6
0
        private void btnProperties_Click(object sender, EventArgs e)
        {
            this.Hide();
            PropertiesForm properties = new PropertiesForm();

            properties.Location      = this.Location;
            properties.StartPosition = this.StartPosition;
            properties.FormClosing  += delegate { this.Show(); };
            properties.ShowDialog();
        }
        private void ViewPropertiesStripMenuItemClick(object sender, EventArgs e)
        {
            if (!(treeNavigation.SelectedNode?.Tag is ICoreItem itemToValue))
            {
                return;
            }
            //Load the form
            //
            var frm = new PropertiesForm(itemToValue);

            frm.ShowDialog();
        }
示例#8
0
        private void toolStripButtonCreate_Click(object sender, EventArgs e)
        {
            try
            {
                int  index       = toolStripComboBoxAdapterType.SelectedIndex;
                Type adapterType = _adapterTypes[index];

                // First try the specialized constructor, if available.
                ConstructorInfo constructor = adapterType.GetConstructor(new Type[] { typeof(AdapterManagementComponent) });

                if (constructor == null)
                {// Try the default parameterless constructor.
                    constructor = adapterType.GetConstructor(new Type[] { });
                }

                if (constructor == null)
                {
                    SystemMonitor.Error("Constructor not found.");
                    return;
                }

                IIntegrationAdapter adapter;
                if (constructor.GetParameters() == null || constructor.GetParameters().Length == 0)
                {// Default constructor.
                    adapter = (IIntegrationAdapter)constructor.Invoke(null);
                }
                else
                {// Specialized constructor.
                    adapter = (IIntegrationAdapter)constructor.Invoke(new object[] { Operator });
                }

                if (adapter == null)
                {
                    MessageBox.Show("Failed to create adapter.");
                    return;
                }

                PropertiesForm form = new PropertiesForm("Adapter Properties", adapter);
                if (form.ShowDialog() == DialogResult.OK)
                {
                    Operator.Adapters.Add(adapter);
                }
            }
            catch (Exception ex)
            {
                SystemMonitor.Error(GeneralHelper.GetExceptionMessage(ex));
                //if (ex.InnerException != null && string.IsNullOrEmpty(ex.InnerException.Message) == false)
                //{
                //    SystemMonitor.Error(ex.InnerException.Message);
                //}
            }
        }
示例#9
0
 private void ButtonFileId_ExecuteEvent(object sender, ExecuteEventArgs e)
 {
     try
     {
         PropertiesForm dialog = new PropertiesForm();
         dialog.SelectedObject  = null;
         dialog.SelectedObjects = DataManager.Instance.FileIdValues.ToArray();
         dialog.Header          = "FileId";
         if (dialog.ShowDialog(_form) == DialogResult.OK)
         {
         }
     }
     catch
     {
         throw;
     }
 }
示例#10
0
 private void ButtonPowerZones_ExecuteEvent(object sender, ExecuteEventArgs e)
 {
     try
     {
         PropertiesForm dialog = new PropertiesForm();
         dialog.SelectedObjects = null;
         dialog.SelectedObject  = DataManager.Instance.PowerManager.GetPowerZones();
         dialog.Header          = "Power Zones";
         if (dialog.ShowDialog(_form) == DialogResult.OK)
         {
         }
     }
     catch
     {
         throw;
     }
 }
示例#11
0
 private void ButtonMyExtras_ExecuteEvent(object sender, ExecuteEventArgs e)
 {
     try
     {
         PropertiesForm dialog = new PropertiesForm();
         dialog.SelectedObjects   = null;
         dialog.SelectedObject    = DataManager.Instance.SessionExtras;
         dialog.Grid.PropertySort = PropertySort.Categorized;
         dialog.Header            = "Session Extras";
         if (dialog.ShowDialog(_form) == DialogResult.OK)
         {
         }
     }
     catch
     {
         throw;
     }
 }
        private void toolStripButtonProperties_Click(object sender, EventArgs e)
        {
            PropertiesForm form = new PropertiesForm("Expert Properties", _expert);

            form.ShowDialog();
        }
        void createItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem item = (ToolStripMenuItem)sender;
            Type componentType     = (Type)item.Tag;

            PlatformComponent component = null;

            bool showPropertiesForm = ComponentManagementAttribute.GetTypeAttribute(componentType).RequestPreStartSetup;

            if (ComponentManagementAttribute.GetTypeAttribute(componentType).IsMandatory)
            {// Mandatory components we do not create, only show / hide.
                component = _platform.GetFirstComponentByType(componentType);
                component.UISerializationInfo.AddValue("componentVisible", true);

                platform_ActiveComponentAddedEvent(component, false);
                return;
            }

            if (componentType.IsSubclassOf(typeof(Expert)))
            {
                component          = new LocalExpertHost(UserFriendlyNameAttribute.GetTypeAttributeName(componentType), componentType);
                showPropertiesForm = showPropertiesForm || ComponentManagementAttribute.GetTypeAttribute(typeof(LocalExpertHost)).RequestPreStartSetup;
            }
            else if (componentType.IsSubclassOf(typeof(WizardControl)))
            {// Wizards are run in Hosting forms.
                ConstructorInfo info = componentType.GetConstructor(new Type[] { typeof(Platform) });

                if (info != null)
                {
                    WizardControl wizardControl = (WizardControl)info.Invoke(new object[] { _platform });
                    HostingForm   hostingForm   = new HostingForm(UserFriendlyNameAttribute.GetTypeAttributeName(componentType), wizardControl);
                    hostingForm.Icon = Resources.magic_wand1;
                    hostingForm.Show();
                    return;
                }
            }
            else if (componentType.IsSubclassOf(typeof(CommonBaseControl)))
            {// Tester/editor etc. controls have no components, they are standalone UI components.
                ConstructorInfo info = componentType.GetConstructor(new Type[] { });
                // If failed to find orderInfo, just fall trough to failed to create component (which remains null).
                if (info != null)
                {// Since this is a UI only component, just create and return.
                    CommonBaseControl testerControl = (CommonBaseControl)info.Invoke(new object[] { });
                    /*tabControl.SelectedTab = */ AddComponentControl(testerControl, true);

                    return;
                }
            }
            else
            {
                ConstructorInfo info = componentType.GetConstructor(new Type[] { });
                if (info != null)
                {
                    component = (PlatformComponent)info.Invoke(new object[] { });
                }
            }

            // ...
            if (component == null)
            {
                MessageBox.Show("Failed to create component.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Set settings for component.
            if (component.SetInitialState(_platform.Settings) == false)
            {
                MessageBox.Show("Component failed to initialize from initial state.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            if (showPropertiesForm)
            {
                // Show properties for the user to configure.
                PropertiesForm form = new PropertiesForm("Properties", component);
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            // Register to platform.
            _platform.RegisterComponent(component);
        }