public void TabPageAccessibilityObject_Ctor_Default()
        {
            using TabPage tabPage = new TabPage();
            tabPage.CreateControl();

            Assert.NotNull(tabPage.AccessibilityObject);
            Assert.True(tabPage.IsHandleCreated);
        }
        private static TabControl AddPluginTabContainer()
        {
            if (m_of == null)
            {
                PluginDebug.AddError("Could not identify KeePass options form", 0);
                return(null);
            }
            TabControl tcMain = Tools.GetControl("m_tabMain", m_of) as TabControl;

            if (tcMain == null)
            {
                PluginDebug.AddError("Could not locate m_tabMain", 0);
                return(null);
            }
            TabPage    tPlugins  = null;
            TabControl tcPlugins = null;

            if (tcMain.TabPages.ContainsKey(c_tabRookiestyle))
            {
                tPlugins  = tcMain.TabPages[c_tabRookiestyle];
                tcPlugins = (TabControl)tPlugins.Controls[c_tabControlRookiestyle];
                if (tcPlugins == null)
                {
                    PluginDebug.AddError("Could not locate " + c_tabControlRookiestyle, 0);
                    return(null);
                }
                tcPlugins.Multiline = false;                 //Older version of PluginTools might still be used by other plugins
                PluginDebug.AddInfo("Found " + c_tabControlRookiestyle, 0);
                return(tcPlugins);
            }
            tPlugins      = new TabPage(KeePass.Resources.KPRes.Plugin + " " + m_of.Text);
            tPlugins.Name = c_tabRookiestyle;
            tPlugins.CreateControl();
            if (!OptionsEnabled)
            {
                while (tcMain.TabCount > 0)
                {
                    tcMain.TabPages.RemoveAt(0);
                }
                PluginDebug.AddInfo("Removed tab pages from KeePass options form", 0);
            }
            tcMain.TabPages.Add(tPlugins);
            tcPlugins           = new TabControl();
            tcPlugins.Name      = c_tabControlRookiestyle;
            tcPlugins.Dock      = DockStyle.Fill;
            tcPlugins.Multiline = false;
            tcPlugins.CreateControl();
            if (tcPlugins.ImageList == null)
            {
                tcPlugins.ImageList = new ImageList();
            }
            tPlugins.Controls.Add(tcPlugins);
            PluginDebug.AddInfo("Added " + c_tabControlRookiestyle, 0);
            return(tcPlugins);
        }
        public void TabPageAccessibilityObject_Role_IsClient_ByDefault()
        {
            using TabPage tabPage = new TabPage();
            tabPage.CreateControl();
            // AccessibleRole is not set = Default

            AccessibleRole actual = tabPage.AccessibilityObject.Role;

            Assert.Equal(AccessibleRole.Client, actual);
            Assert.True(tabPage.IsHandleCreated);
        }
        public void TabPageAccessibilityObject_ControlType_IsPane_IfAccessibleRoleIsDefault()
        {
            using TabPage tabPage = new TabPage();
            tabPage.CreateControl();
            // AccessibleRole is not set = Default

            object actual = tabPage.AccessibilityObject.GetPropertyValue(UiaCore.UIA.ControlTypePropertyId);

            Assert.Equal(UiaCore.UIA.PaneControlTypeId, actual);
            Assert.True(tabPage.IsHandleCreated);
        }
        public static void AddPluginToOptionsForm(KeePass.Plugins.Plugin p, UserControl uc)
        {
            m_OptionsShown = m_PluginContainerShown = false;
            TabPage tPlugin = new TabPage(DefaultCaption);

            tPlugin.CreateControl();
            tPlugin.Name = m_TabPageName = c_tabRookiestyle + p.GetType().Name;
            uc.Dock      = DockStyle.Fill;
            uc.Padding   = new Padding(15, 10, 15, 10);
            tPlugin.Controls.Add(uc);
            PluginDebug.AddInfo("Adding/Searching " + c_tabControlRookiestyle);
            TabControl tcPlugins = AddPluginTabContainer();
            int        i         = 0;
            bool       insert    = false;

            for (int j = 0; j < tcPlugins.TabPages.Count; j++)
            {
                if (string.Compare(tPlugin.Text, tcPlugins.TabPages[j].Text, StringComparison.CurrentCultureIgnoreCase) < 0)
                {
                    i      = j;
                    insert = true;
                    break;
                }
            }
            if (!insert)
            {
                i = tcPlugins.TabPages.Count;
                PluginDebug.AddInfo(p.GetType().Name + " tab index : " + i.ToString() + " - insert!", 0);
            }
            else
            {
                PluginDebug.AddInfo(p.GetType().Name + " tab index : " + i.ToString(), 0);
            }
            tcPlugins.TabPages.Insert(i, tPlugin);
            AddPluginToOverview(tPlugin.Name.Replace(c_tabRookiestyle, string.Empty), tcPlugins);
            if (p.SmallIcon != null)
            {
                tcPlugins.ImageList.Images.Add(tPlugin.Name, p.SmallIcon);
                tPlugin.ImageKey = tPlugin.Name;
            }
            TabControl tcMain = Tools.GetControl("m_tabMain", m_of) as TabControl;

            if (!string.IsNullOrEmpty(PluginURL))
            {
                AddPluginLink(uc);
            }
        }
Beispiel #6
0
        private void LoadProgramingLanguagesList(int index)
        {
            TC_ProgramingLanguages.TabPages.Clear();
            SQLiteDataReader reader = SQLCommand("SELECT * FROM ProgramingLanguages");

            while (reader.Read())
            {
                ProgramingLanguage programingLanguage = new ProgramingLanguage(int.Parse(reader["id"].ToString()), reader["name"].ToString());
                TabPage            tabPage            = new TabPage();
                tabPage.Name = programingLanguage.Id.ToString();
                tabPage.Text = programingLanguage.Name;
                tabPage.CreateControl();
                TC_ProgramingLanguages.TabPages.Add(tabPage);
            }
            TC_ProgramingLanguages.TabPages.Add(this.NewProgramingLanguageForm);
            if (index == -2)
            {
                TC_ProgramingLanguages.SelectTab(TC_ProgramingLanguages.TabPages.Count - 1);
            }
            else
            {
                TC_ProgramingLanguages.SelectTab(index);
            }
        }
Beispiel #7
0
        private static TabControl AddPluginTabContainer()
        {
            TabControl tcMain    = Tools.GetControl("m_tabMain", m_of) as TabControl;
            TabPage    tPlugins  = null;
            TabControl tcPlugins = null;

            if (tcMain.TabPages.ContainsKey(c_tabRookiestyle))
            {
                tPlugins            = tcMain.TabPages[c_tabRookiestyle];
                tcPlugins           = (TabControl)tPlugins.Controls[c_tabControlRookiestyle];
                tcPlugins.Multiline = false;                 //Older version of PluginTools might still be used by other plugins
                return(tcPlugins);
            }
            tPlugins      = new TabPage(KeePass.Resources.KPRes.Plugin + " " + m_of.Text);
            tPlugins.Name = c_tabRookiestyle;
            tPlugins.CreateControl();
            if (!OptionsEnabled)
            {
                while (tcMain.TabCount > 0)
                {
                    tcMain.TabPages.RemoveAt(0);
                }
            }
            tcMain.TabPages.Add(tPlugins);
            tcPlugins           = new TabControl();
            tcPlugins.Name      = c_tabControlRookiestyle;
            tcPlugins.Dock      = DockStyle.Fill;
            tcPlugins.Multiline = false;
            tcPlugins.CreateControl();
            if (tcPlugins.ImageList == null)
            {
                tcPlugins.ImageList = new ImageList();
            }
            tPlugins.Controls.Add(tcPlugins);
            return(tcPlugins);
        }
        private static void AddPluginToOverview(string sPluginName, TabControl tcPlugins)
        {
            if (tcPlugins == null)
            {
                tcPlugins = AddPluginTabContainer();
            }
            TabPage  tpOverview    = null;
            ListView lv            = null;
            string   sTabName      = c_tabRookiestyle + "_PluginOverview";
            string   sListViewName = c_tabRookiestyle + "_PluginOverviewListView";

            if (tcPlugins.TabPages.ContainsKey(sTabName))
            {
                tpOverview = tcPlugins.TabPages[sTabName];
                lv         = (ListView)tpOverview.Controls.Find(sListViewName, true)[0];
                PluginDebug.AddInfo("Found " + sTabName, 0, "Listview: " + (lv == null ? "null" : lv.Items.Count.ToString() + " /" + lv.Name.ToString()));
            }
            else
            {
                tpOverview = new TabPage("Overview");
                tpOverview.CreateControl();
                tpOverview.Name = sTabName;
                UserControl uc = new UserControl();
                uc.Dock    = DockStyle.Fill;
                uc.Padding = new Padding(15, 10, 15, 10);
                tpOverview.Controls.Add(uc);
                lv      = new ListView();
                lv.Name = sListViewName;
                lv.Dock = DockStyle.Fill;
                lv.View = View.Details;
                lv.Columns.Add("Plugin");
                lv.Columns.Add("Version");
                lv.CheckBoxes      = true;
                tpOverview.Layout += TpOverview_Layout;
                Label lInfo = new Label();
                lInfo.Text = "Use the checkbox to activate/deactivate debug mode";
                lInfo.Dock = DockStyle.Bottom;
                uc.Controls.Add(lv);
                uc.Controls.Add(lInfo);
            }
            lv.ItemCheck    += Lv_ItemCheck;
            lv.Sorting       = SortOrder.Ascending;
            lv.FullRowSelect = true;
            ListViewItem lvi = new ListViewItem();

            lvi.Name    = sPluginName;
            lvi.Checked = PluginDebug.DebugMode;
            lvi.Text    = DefaultCaption;
            Version v = new Version(0, 0);

            GetLoadedPluginsName().TryGetValue(sPluginName.Replace("Ext", string.Empty) + "." + sPluginName, out v);
            if (v == null)
            {
                PluginDebug.AddError("Could not get loaded plugins' data", 0);
            }
            string ver = (v == null) ? "???" : v.ToString();

            if (ver.EndsWith(".0"))
            {
                ver = ver.Substring(0, ver.Length - 2);
            }
            else
            {
                ver += " (Dev)";
            }
            lvi.SubItems.Add(ver);
            lv.Items.Add(lvi);
            tcPlugins.TabPages.Remove(tpOverview);
            tcPlugins.TabPages.Add(tpOverview);
            PluginDebug.AddInfo("Added " + sTabName, 0, "Listview: " + (lv == null ? "null" : lv.Items.Count.ToString() + " /" + lv.Name.ToString()));
        }