public frmRunTestOffice2013(Form parent, string userName, Test test, Models.Enums.TestMode mode, Task resumeTask = null) : base(parent, userName, test, mode) { InitializeComponent(); this.labelHelpInfo.Visible = mode == Models.Enums.TestMode.Practice; this.loadQuestions(); if (resumeTask != null) { this.Task = resumeTask; this.loadTask(); } else { this.CreateTask(); } this.LoadApp(); this.LoadFileOffice(); this.ResizeForm(); this.CreateDirTemp(); this.labelTestName.Text = this.Test.Name + " - " + this.Mode.ToString() + " Mode"; if (mode == Models.Enums.TestMode.Testing) { this.ucTimer.Max = this.Test.LimitTime * 60; this.ucTimer.EndEvent += this.TimerEnd; } this.ucTimer.Start(); }
public frmBaseRunTest(Form parent, string userName, Test test, Models.Enums.TestMode mode, Models.Task resumeTask = null) { this.Test = test; this.Mode = mode; this.ParentForm = parent; this.UserName = userName; }
private void RunTest( Test test, Models.Enums.TestMode testMode = Models.Enums.TestMode.Practice, Models.Task resumeTask = null) { Dictionary <string, string> appProcesses = new Dictionary <string, string>(); appProcesses.Add("Word", "winword"); appProcesses.Add("PowerPoint", "powerpnt"); appProcesses.Add("Excel", "excel"); Process[] ps = Process.GetProcessesByName(appProcesses[test.OfficeApp]); if (ps.Length > 0) { DialogResult result = MessageBox.Show(ps.Length.ToString() + " " + test.OfficeApp + " process(es) should be end. Do you want to end all processes?", "End Process", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { foreach (var p in ps) { p.Kill(); } } else { return; } } frmLoading.Show(); switch (test.OfficeVersion) { case "2013": (new frmRunTestOffice2013(this, this.txtUserName.Text, test, testMode, resumeTask)).Show(); break; case "2016": (new frmRunTestOffice2016(this, this.txtUserName.Text, test, testMode, resumeTask)).Show(); break; default: throw new Exception("Error"); } this.Hide(); }
public frmRunTestOffice2016(Form parent, string userName, Test test, Models.Enums.TestMode mode, Models.Task resumeTask = null) : base(parent, userName, test, mode) { InitializeComponent(); this.groupQuestions(); this.LoadApp(); if (resumeTask != null) { this.Task = resumeTask; this.loadTask(); } else { List <List <bool> > dict = new List <List <bool> >(); foreach (var p in this.Projects) { List <bool> l = new List <bool>(); for (int j = 0; j < p.Count - 1; ++j) { l.Add(false); } dict.Add(l); } this.CreateTask(dict); } this.SelectedProject = 0; this.loadProject(); this.CreateDirTemp(); this.ResizeForm(); if (mode == Models.Enums.TestMode.Testing) { this.ucTimer.Max = this.Test.LimitTime * 60; this.ucTimer.EndEvent += this.TimerEnd; } this.ucTimer.Start(); this.labelTestName.Text = this.Test.Name + " - " + this.Mode.ToString() + " Mode"; }