private void editSuccessModuleRestrictions_Click(object sender, EventArgs e)
 {
     if (this.addedSuccessModulesList.SelectedIndex >= 0)
     {
         SuccessModule          sm = (SuccessModule)addedSuccessModulesList.Items[addedSuccessModulesList.SelectedIndex];
         RestrictionEditingForm restrictionEditingForm = new RestrictionEditingForm(sm);
         restrictionEditingForm.TopMost = true;
         restrictionEditingForm.Show();
     }
 }
        private void successModulesSelection_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (successModulesSelection.SelectedIndex == -1)
            {
                return;
            }

            SuccessModule sm = (SuccessModule)Activator.CreateInstance(successModulesSelection.Items[successModulesSelection.SelectedIndex].GetType());

            addedSuccessModulesList.Items.Add(sm);

            addedSuccessModulesList.SelectedIndex = addedSuccessModulesList.Items.Count - 1;
            successModulesSelection.SelectedIndex = -1;
            this.changed = true;
        }
        private void loadSuccessModule(SuccessModule sm)
        {
            this.clearEditPanel();
            Control[] controls = sm.getEditControls();

            if (controls.Length == 0)
            {
                Label infoLabel = new Label();
                infoLabel.Text  = "No controls for this SuccessModule";
                infoLabel.Width = 200;

                controls = new Control[] { infoLabel };
            }

            this.editPanel.Controls.AddRange(controls);
        }
        private void loadSuccessModules()
        {
            string @namespace = "CheckMaster.SuccessModules";

            var q = from t in Assembly.GetExecutingAssembly().GetTypes()
                    where t.IsClass && t.Namespace == @namespace && t.Name != "MasterSuccessModule"
                    select t;

            q.ToList().ForEach(sm => {
                if (sm.Name.Contains("MasterSuccessModule") == false)
                {
                    SuccessModule instance = (SuccessModule)Activator.CreateInstance(sm);
                    this.successModulesSelection.Items.Add(instance);
                }
            });
        }
        private void addedSuccessModulesList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (addedSuccessModulesList.SelectedIndex == -1)
            {
                clearEditPanel();
                this.removeSuccessModuleButton.Enabled     = false;
                this.editSuccessModuleRestrictions.Enabled = false;
                return;
            }

            this.addedModulesList.SelectedIndex = -1;

            SuccessModule sm = (SuccessModule)addedSuccessModulesList.Items[addedSuccessModulesList.SelectedIndex];

            loadSuccessModule(sm);
            this.removeSuccessModuleButton.Enabled     = true;
            this.editSuccessModuleRestrictions.Enabled = true;
            this.changed = true;
        }
Exemplo n.º 6
0
        public RestrictionEditingForm(SuccessModule successModule)
        {
            this.successModule = successModule;

            init();
        }