Пример #1
0
        public void AddSection(object obj, EventArgs e)
        {
            SettingsControl sc = (SettingsControl)Component;

            IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));

            if (host == null)
            {
                return;
            }

            try {
                SettingsItem item = (SettingsItem)host.CreateComponent(typeof(SettingsItem));
                item.TabText = "Settings Item";

                sc.Items.Add(item);
                sc.UpdateList();

                if (sc.Items.Count == 1)
                {
                    sc.ShowItem(0);
                }
            } catch {
            }

            remove_verb.Enabled = sc.Items.Count > 0;
        }
Пример #2
0
        public void RemoveSection(object obj, EventArgs e)
        {
            SettingsControl sc   = (SettingsControl)Control;
            IDesignerHost   host = (IDesignerHost)GetService(typeof(IDesignerHost));


            if (sc.Items.Count > 0 && sc.selected_item != null)
            {
                int index    = sc.selected_item.index;
                int sc_count = sc.Items.Count;

                host.DestroyComponent(sc.selected_item);

                sc.Items.RemoveAt(index);

                if (index + 1 == sc_count && sc.Items.Count > 0)
                {
                    sc.ShowItem(sc.Items.Count - 1);
                }
                sc.UpdateList();
            }

            remove_verb.Enabled = sc.Items.Count > 0;
        }
Пример #3
0
        void ReloadTexts()
        {
            SettingsControl sc = (SettingsControl)Control;

            sc.UpdateList();
        }