Пример #1
0
        public AddWord(int Keypad, string text)
        {
            InitializeComponent();
            txbWord.Text = text;
            TextBoxBase    textComp   = new TextBox();
            VietKeyHandler keyHandler = new VietKeyHandler(textComp);

            textComp.KeyPress += new KeyPressEventHandler(keyHandler.OnKeyPress);
            if (Keypad == 0)
            {
                VietKeyHandler.VietModeEnabled = false;
            }
            else if (Keypad == 1)
            {
                VietKeyHandler.VietModeEnabled = true;
                VietKeyHandler.InputMethod     = InputMethods.VNI;
            }
            else if (Keypad == 2)
            {
                VietKeyHandler.VietModeEnabled = true;
                VietKeyHandler.InputMethod     = InputMethods.Telex;
            }
            else if (Keypad == 3)
            {
                VietKeyHandler.VietModeEnabled = true;
                VietKeyHandler.InputMethod     = InputMethods.VIQR;
            }
            VietKeyHandler.SmartMark = true;
            txbMeaning.KeyPress     += new KeyPressEventHandler(new VietKeyHandler(txbMeaning).OnKeyPress);
            txbWord.KeyPress        += new KeyPressEventHandler(new VietKeyHandler(txbWord).OnKeyPress);
            result = -1;
        }
Пример #2
0
        public AdvancedSearch(string s, int Keypad)
        {
            InitializeComponent();
            Control.CheckForIllegalCrossThreadCalls = false;
            txtPattern.Text = s;
            TextBoxBase    textComp   = new TextBox();
            VietKeyHandler keyHandler = new VietKeyHandler(textComp);

            textComp.KeyPress += new KeyPressEventHandler(keyHandler.OnKeyPress);
            if (Keypad == 0)
            {
                VietKeyHandler.VietModeEnabled = false;
            }
            else if (Keypad == 1)
            {
                VietKeyHandler.VietModeEnabled = true;
                VietKeyHandler.InputMethod     = InputMethods.VNI;
            }
            else if (Keypad == 2)
            {
                VietKeyHandler.VietModeEnabled = true;
                VietKeyHandler.InputMethod     = InputMethods.Telex;
            }
            else if (Keypad == 3)
            {
                VietKeyHandler.VietModeEnabled = true;
                VietKeyHandler.InputMethod     = InputMethods.VIQR;
            }
            VietKeyHandler.SmartMark = true;
            txtPattern.KeyPress     += new KeyPressEventHandler(new VietKeyHandler(txtPattern).OnKeyPress);
        }
Пример #3
0
        public Rename(int Keypad, int position1, string tu)
        {
            InitializeComponent();
            TextBoxBase    textComp   = new TextBox();
            VietKeyHandler keyHandler = new VietKeyHandler(textComp);

            textComp.KeyPress += new KeyPressEventHandler(keyHandler.OnKeyPress);
            if (Keypad == 0)
            {
                VietKeyHandler.VietModeEnabled = false;
            }
            else if (Keypad == 1)
            {
                VietKeyHandler.VietModeEnabled = true;
                VietKeyHandler.InputMethod     = InputMethods.VNI;
            }
            else if (Keypad == 2)
            {
                VietKeyHandler.VietModeEnabled = true;
                VietKeyHandler.InputMethod     = InputMethods.Telex;
            }
            else if (Keypad == 3)
            {
                VietKeyHandler.VietModeEnabled = true;
                VietKeyHandler.InputMethod     = InputMethods.VIQR;
            }
            VietKeyHandler.SmartMark = true;
            txbNewWord.KeyPress     += new KeyPressEventHandler(new VietKeyHandler(txbNewWord).OnKeyPress);
            position        = position1;
            txbOldWord.Text = tu;
            result          = -1;
        }
Пример #4
0
        public Translation(int Keypad)
        {
            InitializeComponent();
            TextBoxBase    textComp   = new TextBox();
            VietKeyHandler keyHandler = new VietKeyHandler(textComp);

            textComp.KeyPress += new KeyPressEventHandler(keyHandler.OnKeyPress);
            if (Keypad == 0)
            {
                VietKeyHandler.VietModeEnabled = false;
            }
            else if (Keypad == 1)
            {
                VietKeyHandler.VietModeEnabled = true;
                VietKeyHandler.InputMethod     = InputMethods.VNI;
            }
            else if (Keypad == 2)
            {
                VietKeyHandler.VietModeEnabled = true;
                VietKeyHandler.InputMethod     = InputMethods.Telex;
            }
            else if (Keypad == 3)
            {
                VietKeyHandler.VietModeEnabled = true;
                VietKeyHandler.InputMethod     = InputMethods.VIQR;
            }
            VietKeyHandler.SmartMark = true;
            txbParagraph.KeyPress   += new KeyPressEventHandler(new VietKeyHandler(txbParagraph).OnKeyPress);
            for (i = 0; i < MainDict.Dicts.Length; i++)
            {
                lstDict.Items.Add(MainDict.Dicts[i].dln[3]);
            }
        }
Пример #5
0
        public EditWord(int Keypad, int editingPosition, string word, string meaning)
        {
            InitializeComponent();
            TextBoxBase    textComp   = new TextBox();
            VietKeyHandler keyHandler = new VietKeyHandler(textComp);

            textComp.KeyPress += new KeyPressEventHandler(keyHandler.OnKeyPress);
            if (Keypad == 0)
            {
                VietKeyHandler.VietModeEnabled = false;
            }
            else if (Keypad == 1)
            {
                VietKeyHandler.VietModeEnabled = true;
                VietKeyHandler.InputMethod     = InputMethods.VNI;
            }
            else if (Keypad == 2)
            {
                VietKeyHandler.VietModeEnabled = true;
                VietKeyHandler.InputMethod     = InputMethods.Telex;
            }
            else if (Keypad == 3)
            {
                VietKeyHandler.VietModeEnabled = true;
                VietKeyHandler.InputMethod     = InputMethods.VIQR;
            }
            VietKeyHandler.SmartMark  = true;
            txbMeaning.KeyPress      += new KeyPressEventHandler(new VietKeyHandler(txbMeaning).OnKeyPress);
            txbWord.Text              = word;
            txbMeaning.Text           = meaning;
            txbMeaning.SelectionStart = 0;
            position = editingPosition;
        }
Пример #6
0
 public DataForm()
 {
     InitializeComponent();
     kanjiUserControl.parent = parent;
     keyHandler      = new VietKeyHandler(txtVietnamese);
     keyPressHandler = new KeyPressEventHandler(keyHandler.OnKeyPress);
 }
Пример #7
0
        public MainDict()
        {
            InitializeComponent();
            cbbKeypad.SelectedIndex = 0;
            TextBoxBase    textComp   = new TextBox();
            VietKeyHandler keyHandler = new VietKeyHandler(textComp);

            textComp.KeyPress         += new KeyPressEventHandler(keyHandler.OnKeyPress);
            VietKeyHandler.InputMethod = InputMethods.Telex;

            VietKeyHandler.VietModeEnabled = false;
            VietKeyHandler.SmartMark       = true;
            cbbWord.KeyPress += new KeyPressEventHandler(new VietKeyHandler(cbbWord).OnKeyPress);
        }
Пример #8
0
        private void Form1_Load(object sender, EventArgs e)
        {
            object[] list_kieugo = Enum.GetValues(typeof(InputMethods))
                                   .Cast <object>()
                                   .ToArray();
            cb_kieugo.Items.AddRange(list_kieugo);
            cb_kieugo.SelectedIndex         = 2;
            cb_kieugo.SelectedValueChanged += Cb_kieugo_SelectedValueChanged;

            VietKeyHandler.InputMethod = InputMethods.VNI;
            keyHandler        = new VietKeyHandler(txtText);
            txtText.KeyPress += new KeyPressEventHandler(keyHandler.OnKeyPress);
            VietKeyHandler.VietModeEnabled = true;
            VietKeyHandler.SmartMark       = true;
        }
Пример #9
0
        public void GanBogo(Form frm, System.Windows.Forms.TextBox textBox1)
        {
            TabControl     tabclt;
            VietKeyHandler keyHandler = new VietKeyHandler(textBox1);

            textBox1.KeyPress += new KeyPressEventHandler(keyHandler.OnKeyPress);
            foreach (Control ctl in frm.Controls)
            {
                System.Windows.Forms.TextBox txt;
                switch (ctl.GetType().ToString())
                {
                case "System.Windows.Forms.Panel":

                    foreach (Control ctl1 in ctl.Controls)
                    {
                        System.Windows.Forms.TextBox txt1;
                        if (ctl1.GetType().ToString() == "MaskedBox.MaskedBox")
                        {
                            continue;
                        }
                        if (ctl1.GetType().ToString() == "MaskedTextBox.MaskedTextBox")
                        {
                            continue;
                        }
                        if (ctl1.GetType().ToString() == "System.Windows.Forms.Button")
                        {
                            continue;
                        }
                        if (ctl1.GetType().ToString() == "System.Windows.Forms.TextBox")
                        {
                            txt1           = (TextBox)ctl1;
                            txt1.KeyPress += new KeyPressEventHandler(new VietKeyHandler(txt1).OnKeyPress);
                        }
                        foreach (Control ctl2 in ctl1.Controls)
                        {
                            if (ctl2.GetType().ToString() == "MaskedBox.MaskedBox")
                            {
                                continue;
                            }
                            if (ctl2.GetType().ToString() == "MaskedTextBox.MaskedTextBox")
                            {
                                continue;
                            }
                            if (ctl2.GetType().ToString() == "System.Windows.Forms.TextBox")
                            {
                                txt1           = (TextBox)ctl2;
                                txt1.KeyPress += new KeyPressEventHandler(new VietKeyHandler(txt1).OnKeyPress);
                            }
                        }
                    }
                    break;

                case "System.Windows.Forms.GroupBox":
                    foreach (Control ctl1 in ctl.Controls)
                    {
                        System.Windows.Forms.TextBox txt2;
                        if (ctl1.GetType().ToString() == "MaskedBox.MaskedBox")
                        {
                            continue;
                        }
                        if (ctl1.GetType().ToString() == "MaskedTextBox.MaskedTextBox")
                        {
                            continue;
                        }
                        if (ctl1.GetType().ToString() == "System.Windows.Forms.TextBox")
                        {
                            txt2           = (TextBox)ctl1;
                            txt2.KeyPress += new KeyPressEventHandler(new VietKeyHandler(txt2).OnKeyPress);
                        }
                    }
                    break;

                case "System.Windows.Forms.TabControl":
                    tabclt = (TabControl)ctl;
                    foreach (TabPage tab in tabclt.TabPages)
                    {
                        foreach (Control ct in tab.Controls)
                        {
                            System.Windows.Forms.TextBox txt3;
                            switch (ct.GetType().ToString())
                            {
                            case "MaskedBox.MaskedBox":
                                break;

                            case "System.Windows.Forms.ComboBox":
                                break;

                            case "System.Windows.Forms.TextBox":
                                txt3           = (TextBox)ct;
                                txt3.KeyPress += new KeyPressEventHandler(new VietKeyHandler(txt3).OnKeyPress);
                                break;

                            case "System.Windows.Forms.GroupBox":

                                foreach (Control ct1 in ct.Controls)
                                {
                                }
                                break;

                            case "System.Windows.Forms.Button":
                                break;
                            }
                        }
                    }
                    break;

                case "System.Windows.Forms.TextBox":
                    txt           = (TextBox)ctl;
                    txt.KeyPress += new KeyPressEventHandler(new VietKeyHandler(txt).OnKeyPress);
                    break;

                default:

                    break;
                }
            }
            VietKeyHandler.InputMethod     = InputMethods.VNI;
            VietKeyHandler.VietModeEnabled = true;
            VietKeyHandler.SmartMark       = true;
        }
Пример #10
0
 public KanjiUC()
 {
     InitializeComponent();
     keyHandler      = new VietKeyHandler(tbxKanjiMeaning);
     keyPressHandler = new KeyPressEventHandler(keyHandler.OnKeyPress);
 }
Пример #11
0
        public ManageDict(int keypad)
        {
            InitializeComponent();
            typing = keypad;
            TextBoxBase    textComp   = new TextBox();
            VietKeyHandler keyHandler = new VietKeyHandler(textComp);

            textComp.KeyPress += new KeyPressEventHandler(keyHandler.OnKeyPress);
            if (keypad == 0)
            {
                VietKeyHandler.VietModeEnabled = false;
            }
            else if (keypad == 1)
            {
                VietKeyHandler.VietModeEnabled = true;
                VietKeyHandler.InputMethod     = InputMethods.VNI;
            }
            else if (keypad == 2)
            {
                VietKeyHandler.VietModeEnabled = true;
                VietKeyHandler.InputMethod     = InputMethods.Telex;
            }
            else if (keypad == 3)
            {
                VietKeyHandler.VietModeEnabled = true;
                VietKeyHandler.InputMethod     = InputMethods.VIQR;
            }
            VietKeyHandler.SmartMark = true;
            txbDictName.KeyPress    += new KeyPressEventHandler(new VietKeyHandler(txbDictName).OnKeyPress);
            txbAuthor.KeyPress      += new KeyPressEventHandler(new VietKeyHandler(txbAuthor).OnKeyPress);
            // Them giong phat am vao combobox
            foreach (ISpeechObjectToken t in voice.GetVoices("", ""))
            {
                cbbVoice.Items.Add(t.GetAttribute("Name"));
            }

            int i;

            string[] s1;
            //load từ điển đang dùng và từ điển không dùng
            if (MainDict.Dicts == null) //khi không có từ điển nào
            {
                s1 = new string[0];
            }
            else
            {
                s1 = new string[MainDict.Dicts.Length];
            }
            for (i = 0; i < s1.Length; i++)
            {
                s1[i] = MainDict.Dicts[i].fileName;
            }
            listBox1.Items.AddRange(s1);
            string[] s2 = Directory.GetFiles(MainDict.path + "\\Dictionary\\", "*.idt", SearchOption.TopDirectoryOnly);
            for (i = 0; i < s2.Length; i++)
            {
                s2[i] = Path.GetFileNameWithoutExtension(s2[i]);
                if (Array.IndexOf(s1, s2[i]) == -1)
                {
                    listBox2.Items.Add(s2[i]);
                }
            }
            // Kiểm tra các tuỳ chọn tra cứu
            if (MainDict.establish[1] == '1')
            {
                chbChangeKeypad.Checked = true;
            }
            else
            {
                chbChangeKeypad.Checked = false;
            }
            if (MainDict.establish[2] == '1')
            {
                chbMoveDict.Checked = true;
            }
            else
            {
                chbMoveDict.Checked = false;
            }
        }