コード例 #1
0
 private void toolStripButtonProperties_Click(object sender, EventArgs e)
 {
     if (_executionAccount != null)
     {
         PropertiesForm form = new PropertiesForm("Account Information Properties", _executionAccount.Info);
         form.ShowDialog();
     }
 }
コード例 #2
0
        private void buttonShowOrder_Click(object sender, EventArgs e)
        {
            List<Order> orders = GetSelectedOrders();
            if (orders.Count > 1)
            {
                MessageBox.Show("Select one order to modify.");
                return;
            }

            if (orders.Count == 0 || orders[0].IsOpenOrPending == false)
            {
                return;
            }

            PropertiesForm form = new PropertiesForm("Order", orders[0]);
            form.Show();
        }
コード例 #3
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);
     }
 }
        private void toolStripButtonCreate_Click(object sender, EventArgs e)
        {
            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);
            }
        }
 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();
     }
 }
コード例 #6
0
 private void toolStripButtonProperties_Click(object sender, EventArgs e)
 {
     PropertiesForm form = new PropertiesForm("Expert Properties", _expert);
     form.ShowDialog();
 }
コード例 #7
0
        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.GetFirstComponent(componentType);
                component.UISerializationInfo.AddValue("componentVisible", true);

                platform_ActiveComponentAddedEvent(component, false);
                return;
            }

            if (componentType.IsSubclassOf(typeof(Expert)))
            {
                component = new LocalExpertHost(UserFriendlyNameAttribute.GetTypeAttributeName(componentType), componentType);
                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);
        }