private void btnOk_Click(object sender, EventArgs e) { TextOfMessageBox a = new TextOfMessageBox(); DAOTM daoTM = new DAOTM(); List <tablename> tmnames = daoTM.GetTablenames(); if (txtLocation.Text != "" && txtProjectName.Text != "" && ((ckbCreateNewTM.Checked && txtTMName.Text != "") || (ckbUseTMCreated.Checked && cboTMName.SelectedValue != null))) { if (checkExistsTM(tmnames, txtTMName.Text)) { string root = Path.Combine(txtLocation.Text, txtProjectName.Text); if (Directory.Exists(root)) { MessageBox.Show(a.FOLDER_EXISTING_MESAGEBOX, "Cảnh báo", MessageBoxButtons.YesNo); } else { createProject(); } } else { MessageBox.Show(a.EXISTS_TM, "Cảnh báo", MessageBoxButtons.YesNo); } } else { MessageBox.Show(a.CREATE_NEW_PROJECT_MESSAGEBOX, "Cảnh báo", MessageBoxButtons.YesNo); } }
public void loadProject(string path) { this.project = new Project(); if (path != null) { if (this.project.readProject(path)) { if (project != null) { if (project.isEmptySourceFolder()) { editorForm.openTutorial(); } else { } openProjectFilesForm(); setSourceLangandTargetLangtoMachineTrans(); loadTMDATA(); //loadTB(); reloadControl(); reloadNameCAT(); } } else { TextOfMessageBox a = new TextOfMessageBox(); MessageBox.Show(a.FILE_NOT_FOUND, "Cảnh báo", MessageBoxButtons.YesNo); } } }
private void createTranslatedDocumentToolStripMenuItem_Click(object sender, EventArgs e) { if (project != null) { project.createTranslatedDocument(); TextOfMessageBox a = new TextOfMessageBox(); MessageBox.Show(a.CREATE_TRASLATED_DOCUMENT_SUCCESSFULLY, "Thông báo", MessageBoxButtons.YesNo); } }
private void CreateTranslationFile_Click(object sender, EventArgs e) { if (project != null) { using (frmWaitForm frm = new frmWaitForm(project.createTranslatedDocument)) { frm.ShowDialog(this); } //project.createTranslatedDocument(); TextOfMessageBox a = new TextOfMessageBox(); MessageBox.Show(a.CREATE_TRASLATED_DOCUMENT_SUCCESSFULLY, "Thông báo", MessageBoxButtons.YesNo); } }
public void addSegmentToTM() { //Console.WriteLine(editorGrid.CurrentRow.Index); editorGrid.EndEdit(); int Index = editorGrid.CurrentRow.Index; if (editorGrid.Rows[Index].Cells["targetColumn"].Value != null && editorGrid.Rows[Index].Cells["sourceColumn"].Value != null) { string targetText = editorGrid.Rows[Index].Cells["targetColumn"].Value.ToString(); string sourceText = editorGrid.Rows[Index].Cells["sourceColumn"].Value.ToString(); DAOTM daotm = new DAOTM(); if (mainForm.project != null) { string tmname = mainForm.project.getTMName(); tm tmp = new tm() { Source = sourceText, Target = targetText }; Segment segment = new Segment(); segment.setTM(tmp); if (tmp.Source != string.Empty && tmp.Target != string.Empty && tmname != string.Empty) { int result = daotm.addSegmentToTM(segment, tmname); if (result != 1) { TextOfMessageBox a = new TextOfMessageBox(); MessageBox.Show(a.ADD_SEGMENT_FAILED, "Cảnh báo", MessageBoxButtons.YesNo); } else { if (result == 1) { lblStatus.Text = "Đã lưu thành công"; editorGrid.Rows[Index].Cells["confirmColumn"].Value = true; } } } else { TextOfMessageBox a = new TextOfMessageBox(); MessageBox.Show(a.EMPTY_TARGET, "Cảnh báo", MessageBoxButtons.YesNo); } } } else { TextOfMessageBox a = new TextOfMessageBox(); MessageBox.Show(a.EMPTY_TARGET, "Cảnh báo", MessageBoxButtons.YesNo); } }
private void SaveProjectButton_Click(object sender, EventArgs e) { if (project != null) { if (project.getCurrentFile() == null) { TextOfMessageBox a = new TextOfMessageBox(); MessageBox.Show(a.NO_FILE_TO_SAVE, "Cảnh báo", MessageBoxButtons.YesNo); } else { saveProject(); } } }
private void createProject() { DAOTM tmdao = new DAOTM(); TextOfMessageBox a = new TextOfMessageBox(); string name = txtProjectName.Text; string sourceFileLanguge = cboSourceFilesLanguage.Text; string translatedFileLanguge = cboTranslatedFilesLanguage.Text; //string locationFolder = txtLocation.Text + "\\" + txtProjectName.Text; string locationFolder = Path.Combine(txtLocation.Text, txtProjectName.Text); DateTime now = new DateTime(); now = DateTime.Now; Project project = new Project(); project.setLanguage(sourceFileLanguge, translatedFileLanguge); project.setNameProject(name); project.setPathProject(locationFolder); project.setCreationTime(now); if (ckbUseTMCreated.Checked) { tablename tbn = cboTMName.SelectedItem as tablename; project.setTMName(tbn.name); mainForm.setProject(project); closeForm(); mainForm.createNewProject(); //mainForm.creatNewProjectForm = null; //closeForm(); } if (ckbCreateNewTM.Checked) { string tmname = txtTMName.Text; project.setTMName(tmname); int result = tmdao.createTable(project.getTMName()); if (result == 0) { mainForm.setProject(project); closeForm(); mainForm.createNewProject(); //mainForm.creatNewProjectForm = null; closeForm(); } else { MessageBox.Show(a.CREATE_TM_FAILED, "Cảnh báo", MessageBoxButtons.YesNo); } } }
private void ReloadFolder_Click(object sender, EventArgs e) { if (project != null) { initForm(); if (project.getCurrentFile() == null) { TextOfMessageBox a = new TextOfMessageBox(); MessageBox.Show(a.NO_FILE_TO_SAVE, "Cảnh báo", MessageBoxButtons.YesNo); } else { saveProject(); } string path = Path.Combine(this.project.getPathProject(), this.project.getNameFileProject()); loadProject(path); } }
public void createTranslationDocument() { List <Segment> segments = new List <Segment>(); segments = editorForm.getListSegment(); //List<Segment> listSegs = new List<Segment>(); //listSegs = editorForm.getListSegment(); project.reWriteListSegment(segments); using (frmWaitForm frm = new frmWaitForm(project.createTranslatedDocument)) { frm.ShowDialog(this); } //project.createTranslatedDocument(); TextOfMessageBox a = new TextOfMessageBox(); DialogResult dialogResult = MessageBox.Show(a.CREATE_TRASLATED_DOCUMENT_SUCCESSFULLY, "Thông báo", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { string path = this.project.getPathTargetFolder(); Process.Start(path); } }
private void btnOk_Click(object sender, EventArgs e) { TextOfMessageBox a = new TextOfMessageBox(); if (txtLocation.Text != "" && txtProjectName.Text != "") { string root = Path.Combine(txtLocation.Text, txtProjectName.Text); if (Directory.Exists(root)) { MessageBox.Show(a.FOLDER_EXISTING_MESAGEBOX, "Cảnh báo", MessageBoxButtons.YesNo); } else { string name = txtProjectName.Text; string sourceFileLanguge = cboSourceFilesLanguage.Text; string translatedFileLanguge = cboTranslatedFilesLanguage.Text; //string locationFolder = txtLocation.Text + "\\" + txtProjectName.Text; string locationFolder = Path.Combine(txtLocation.Text, txtProjectName.Text); DateTime now = new DateTime(); now = DateTime.Now; Project project = new Project(); project.setLanguage(sourceFileLanguge, translatedFileLanguge); project.setNameProject(name); project.setPathProject(locationFolder); project.setCreationTime(now); mainForm.setProject(project); mainForm.createNewProject(); //mainForm.creatNewProjectForm = null; closeForm(); } } else { MessageBox.Show(a.CREATE_NEW_PROJECT_MESSAGEBOX, "Cảnh báo", MessageBoxButtons.YesNo); } }