private void ChineseTextBoxTextChanged(object sender, EventArgs e) { updateButton.Enabled = !string.IsNullOrEmpty(chineseTextBox.Text.Trim()); deleteButton.Enabled = !string.IsNullOrEmpty(chineseTextBox.Text.Trim()); if (string.IsNullOrEmpty(chineseTextBox.Text.Trim())) { phienAmTextBox.Text = ""; return; } phienAmTextBox.Text = Translator.ChineseToHanViet(chineseTextBox.Text, out _).Trim(); if (1 != chineseTextBox.Text.Length) { deleteButton.Enabled = false; updateButton.Enabled = false; return; } bool flag = Operator.ExistInSinoVietPronunciationDict(chineseTextBox.Text); deleteButton.Enabled = flag; updateButton.Enabled = true; updateButton.Text = (flag ? "Update" : "Add"); }
private void ChineseTextBoxTextChanged(object sender, EventArgs e) { updateButton.Enabled = chineseTextBox.Text.Trim() != ""; deleteButton.Enabled = chineseTextBox.Text.Trim() != ""; existInBaikeLabel.Text = "Đang kiểm tra..."; existInBaikeLabel.ForeColor = SystemColors.ControlText; surfBaikeLinkLabel.Visible = false; if (chineseTextBox.Text.Trim() == "") { hanVietRichTextBox.Text = ""; vietPhraseRichTextBox.Text = ""; CheckBaikeInNewThread(chineseTextBox.Text.Trim()); return; } hanVietRichTextBox.Text = Translator.ChineseToHanViet(chineseTextBox.Text, out _).Trim(); string text = (type == 0) ? Operator.GetVietPhrase(chineseTextBox.Text) : Operator.GetName(chineseTextBox.Text, type == 1); vietPhraseRichTextBox.Text = text ?? ((type == 0) ? hanVietRichTextBox.Text : CultureInfo.CurrentCulture.TextInfo.ToTitleCase(hanVietRichTextBox.Text)); deleteButton.Enabled = text != null; updateButton.Text = (text != null) ? "Update" : "Add"; updatedByLabel.Text = (type == 0) ? Operator.GetVietPhraseLogRecord(chineseTextBox.Text) : Operator.GetNameLogRecord(chineseTextBox.Text, type == 1); CheckBaikeInNewThread(chineseTextBox.Text.Trim()); }