void item_Click(object sender, EventArgs e) { Hashtable tag = (Hashtable)this.ActiveMdiChild.Tag; Core.KeySuite suite; if (tag.ContainsKey(TagKeys.KeySuite)) { suite = Core.Ref.UniSuite[(int)tag[TagKeys.KeySuite]] as Core.KeySuite; DialogResult replace = Core.Utility.Confirm(string.Format( "Trong cửa sổ: '{0}'" + Environment.NewLine + "đã nhận chấm dựa trên bộ đáp án: '{1}'." + Environment.NewLine + "Bạn có muốn thay thế bằng bộ đáp án mới chọn: '{2}' không?", this.ActiveMdiChild.Text, suite.name, ((ToolStripMenuItem)sender).Text)); if (replace == DialogResult.OK) { tag[TagKeys.KeySuite] = (int)(((ToolStripMenuItem)sender).Tag); } else { return; } } else { tag.Add(TagKeys.KeySuite, (int)((ToolStripMenuItem)sender).Tag); } suite = Core.Ref.UniSuite[(int)tag[TagKeys.KeySuite]] as Core.KeySuite; FormInterpret form = this.ActiveMdiChild as FormInterpret; form.txtLog.AppendText(Environment.NewLine + "Bộ đáp án được chọn: " + suite.ToString()); }
private void mnuDataExportRtf_Click(object sender, EventArgs e) { if (this.ActiveMdiChild is FormInterpret) { FormInterpret fi = this.ActiveMdiChild as FormInterpret; saveFileDialog.Filter = UI.Properties.Settings.Default.FilterRtf; saveFileDialog.Title = "Luu ket qua cho Word"; saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); if (saveFileDialog.ShowDialog() == DialogResult.OK) { Core.Print.Result.ExportRtf(fi.Result, saveFileDialog.FileName); } } }
private void mnuRecognizeFolder_Click(object sender, EventArgs e) { if (folderBrowserDialog.ShowDialog() == DialogResult.OK) { FormInterpret formInterpret = new FormInterpret(); formInterpret.MdiParent = this; Hashtable tag = (Hashtable)formInterpret.Tag; tag.Add(TagKeys.AutomateSource, Core.Automate.Source.Folder); tag.Add(TagKeys.Caption, "Chấm điểm thư mục " + folderBrowserDialog.SelectedPath); tag.Add(TagKeys.Path, folderBrowserDialog.SelectedPath); AddWindowMenuItem(formInterpret, (string)tag[TagKeys.Caption]); formInterpret.Show(); } }
private void mnuRecognizeFile_Click(object sender, EventArgs e) { PrepareFileDlg2Interpret(); if (openFileDialog.ShowDialog() == DialogResult.OK && openFileDialog.FileNames.Length >= 1) { FormInterpret formInterpret = new FormInterpret(); formInterpret.MdiParent = this; Hashtable tag = (Hashtable)formInterpret.Tag; tag.Add(TagKeys.AutomateSource, Core.Automate.Source.Files); string[] fileNames = openFileDialog.FileNames; string[] safeFileName = new string[fileNames.Length]; for (int i = 0; i < fileNames.Length; i++) { safeFileName[i] = Core.Utility.GetSafeFileName(fileNames[i]); } formInterpret.txtLog.AppendText(string.Join(Environment.NewLine, safeFileName)); tag.Add(TagKeys.Caption, "Cham diem: " + string.Join(",", safeFileName)); tag.Add(TagKeys.Files, fileNames); AddWindowMenuItem(formInterpret, (string)tag[TagKeys.Caption]); formInterpret.Show(); } }