コード例 #1
0
ファイル: TakaoPreference.cs プロジェクト: zhtw2013/KeyKey
        private void InitUI()
        {
            toolbarButtonBackgroundColor = Color.Transparent;
            this.u_panelGeneral          = new PanelGeneral(this.m_generalDictionary, this.m_searchDictionary, this.m_genericInputMethods, this.u_applyButton);
            this.AddPreferencePane(u_panelGeneral, "General");
            PanelPhonetic panelPhonetic = new PanelPhonetic(this.m_traditionalPhoneticDictionary, this.m_smartPhoneticDictionary, this.u_applyButton);

            this.AddPreferencePane(panelPhonetic, "Phonetic");
            PanelCangjie panelCangjie = new PanelCangjie(this.m_cangjieDictionary, this.u_applyButton);

            this.AddPreferencePane(panelCangjie, "Cangjie");
            PanelSimplex panelSimplex = new PanelSimplex(this.m_simplexDictionary, this.u_applyButton);

            this.AddPreferencePane(panelSimplex, "Simplex");
            if (this.m_hasGenericInputMethods == false)
            {
                this.u_toolbarGeneric.Visible = false;
                this.u_toolbar.Controls.Remove(this.u_toolbarGeneric);
                this.u_settingsPanel.Left = 43;
                this.u_toolbar.Width      = this.u_toolbar.Width - 56;
                this.Width = this.Width - 56;
            }
            else
            {
                this.u_panelGeneric = new PanelGeneric(m_venderIdentifer, m_genericInputMethods, u_applyButton);
                this.AddPreferencePane(u_panelGeneric, "Generic");
            }
            PanelMisc panelMisc = new PanelMisc(m_generalDictionary, u_applyButton);

            this.AddPreferencePane(panelMisc, "Misc");
            PanelPhrases panelPhrases = new PanelPhrases();

            this.AddPreferencePane(panelPhrases, "Phrases");
            PanelUpdate panelUpdate = new PanelUpdate(m_generalDictionary, u_applyButton);

            this.AddPreferencePane(panelUpdate, "Update");

            BIAboutPanel.c_icon = global::TakaoPreference.Properties.Resources.yahoo;
            this.u_panelAbout   = new BIAboutPanel(this);
            this.AddPreferencePane(u_panelAbout, "About");
            this.u_toolbarGeneral.Checked   = true;
            this.u_toolbarGeneral.BackColor = toolbarButtonBackgroundColor;
            this.u_applyButton.Enabled      = false;

            System.Windows.Forms.Control.ControlCollection c = this.u_settingsPanel.Controls;
            int i = 0;

            foreach (Control item in c)
            {
                if (i == 0)
                {
                    item.Visible = true;
                }
                else
                {
                    item.Visible = false;
                }
                i++;
            }
        }
コード例 #2
0
ファイル: TakaoPreference.cs プロジェクト: zhtw2013/KeyKey
        /// <summary>
        /// Handle the event to switch to another preference pane.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ChangeTab(object sender, MouseEventArgs e)
        {
            string selectedOption = "";

            try
            {
                u_toolbarGeneral.Checked  = false;
                u_toolbarPhonetic.Checked = false;
                u_toolbarCanjie.Checked   = false;
                u_toolbarSimplex.Checked  = false;
                u_toolbarPhrases.Checked  = false;
                u_toolbarMisc.Checked     = false;
                u_toolbarUpdate.Checked   = false;
                u_toolbarAbout.Checked    = false;

                u_toolbarGeneral.BackColor  = u_toolbar.BackColor;
                u_toolbarPhonetic.BackColor = u_toolbar.BackColor;
                u_toolbarCanjie.BackColor   = u_toolbar.BackColor;
                u_toolbarSimplex.BackColor  = u_toolbar.BackColor;
                u_toolbarPhrases.BackColor  = u_toolbar.BackColor;
                u_toolbarMisc.BackColor     = u_toolbar.BackColor;
                u_toolbarUpdate.BackColor   = u_toolbar.BackColor;
                u_toolbarAbout.BackColor    = u_toolbar.BackColor;

                if (m_hasGenericInputMethods)
                {
                    u_toolbarGeneric.Checked   = false;
                    u_toolbarGeneric.BackColor = u_toolbar.BackColor;
                }
            }
            catch
            {
            }

            if (sender == u_toolbarGeneral)
            {
                selectedOption             = "General";
                u_toolbarGeneral.Checked   = true;
                u_toolbarGeneral.BackColor = toolbarButtonBackgroundColor;
            }
            else if (sender == u_toolbarPhonetic)
            {
                selectedOption              = "Phonetic";
                u_toolbarPhonetic.Checked   = true;
                u_toolbarPhonetic.BackColor = toolbarButtonBackgroundColor;
            }
            else if (sender == u_toolbarCanjie)
            {
                selectedOption            = "Cangjie";
                u_toolbarCanjie.Checked   = true; //
                u_toolbarCanjie.BackColor = toolbarButtonBackgroundColor;
            }
            else if (sender == u_toolbarSimplex)
            {
                selectedOption             = "Simplex";
                u_toolbarSimplex.Checked   = true;
                u_toolbarSimplex.BackColor = toolbarButtonBackgroundColor;
            }
            else if (sender == u_toolbarGeneric)
            {
                selectedOption             = "Generic";
                u_toolbarGeneric.Checked   = true;
                u_toolbarGeneric.BackColor = toolbarButtonBackgroundColor;
            }
            else if (sender == u_toolbarPhrases)
            {
                selectedOption             = "Phrases";
                u_toolbarPhrases.Checked   = true;
                u_toolbarPhrases.BackColor = toolbarButtonBackgroundColor;
            }
            else if (sender == u_toolbarMisc)
            {
                selectedOption          = "Misc";
                u_toolbarMisc.Checked   = true;
                u_toolbarMisc.BackColor = toolbarButtonBackgroundColor;
            }
            else if (sender == u_toolbarUpdate)
            {
                selectedOption            = "Update";
                u_toolbarUpdate.Checked   = true;
                u_toolbarUpdate.BackColor = toolbarButtonBackgroundColor;
            }
            else if (sender == u_toolbarAbout)
            {
                selectedOption           = "About";
                u_toolbarAbout.Checked   = true;
                u_toolbarAbout.BackColor = toolbarButtonBackgroundColor;
            }
            else
            {
                selectedOption             = "General";
                u_toolbarGeneral.Checked   = true;
                u_toolbarGeneral.BackColor = toolbarButtonBackgroundColor;
            }

            System.Windows.Forms.Control.ControlCollection c = this.u_settingsPanel.Controls;

            foreach (Control item in c)
            {
                if (item.Name == selectedOption)
                {
                    item.Visible = true;
                    if (item is BIAboutPanel)
                    {
                        BIAboutPanel aboutPanel = (BIAboutPanel)item;
                        aboutPanel.UpdateVersionInfo();
                        aboutPanel.UpdateWordCount();
                    }
                }
                else
                {
                    item.Visible = false;
                }
            }
        }