Exemple #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;
        }
Exemple #2
0
        private void SelectionChanged(object sender, EventArgs e)
        {
            ISelectionService svc = (ISelectionService)GetService(typeof(ISelectionService));

            SettingsControl sc = (SettingsControl)Component;

            foreach (object comp in svc.GetSelectedComponents())
            {
                if (comp == sc)
                {
                    selected = true;
                    ReloadTexts();
                    return;
                }
            }

            foreach (SettingsItem item in sc.Items)
            {
                foreach (Control ctrl in svc.GetSelectedComponents())
                {
                    if (item.Contains(ctrl) && sc.selected_item != item)
                    {
                        sc.ShowItem(item.index);
                        break;
                    }
                }
            }

            selected = false;
        }
Exemple #3
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;
        }
Exemple #4
0
        //Elimina los hijos asociados a SplitterPanel
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                try {
                    ISelectionService svc = (ISelectionService)GetService(typeof(ISelectionService));
                    if (svc != null)
                    {
                        svc.SelectionChanged -= SelectionChanged;
                    }

                    SettingsControl sc   = (SettingsControl)Control;
                    IDesignerHost   host = (IDesignerHost)GetService(typeof(IDesignerHost));

                    foreach (SettingsItem itm in sc.Items)
                    {
                        host.DestroyComponent(itm);
                    }
                } catch {
                }
            }

            base.Dispose(disposing);
        }
Exemple #5
0
        void ReloadTexts()
        {
            SettingsControl sc = (SettingsControl)Control;

            sc.UpdateList();
        }