void doInBackground() { BackgroundWorker bgWorker = new BackgroundWorker(); long compilerID = long.Parse(cboCompiler.Value.ToString()); BUS_Submission objSubmiss = new BUS_Submission(getHdfAsLong(ProblemId), compilerID, getHdfAsLong(ContestId)); hdfUrl.Set(SubmissionId, objSubmiss.Insert()); bgWorker.DoWork += new DoWorkEventHandler(bgWorker_DoWork); bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgWorker_RunWorkerCompleted); bgWorker.RunWorkerAsync(); }
public void submiss() { try { //#include <iostream> //using namespace std; //int main() //{ //freopen("input.txt", "r", stdin); // int a= 1; // int i = 0; // cin >> a; // while(i <= a){ // cout << "Tien dat" << endl; // i++; // } // return 0; //} long compilerID = long.Parse(cboCompiler.Value.ToString()); BUS_Submission objSubmiss = new BUS_Submission(getHdfAsLong(ProblemId), compilerID, getHdfAsLong(ProblemId)); objSubmiss.Insert(); string FolderPath = getHdfAsString(PathFolderSave); string inputFile = FolderPath + "/" + getHdfAsString(ProblemsUrl) + "." + getExtenstion(); FileHelper.SaveFile(inputFile, txtInput.Text); //Biên dịch sang exe double timeToCOmpiler = CompilerC.CompileToExe(SettingsHelper.COMPILER_PATH.CPlusPlusGccCompilerCodeBlockPath, inputFile, FolderPath + "/" + getHdfAsString(ProblemsUrl) + ".exe"); //Chạy file exe lấy kết quả List <string> inputs = new List <string>(); inputs.Add("8"); //executablePath.Add("3"); //Ghi vào file // txtOutput.Text = CompilerC.RunExeGetOutput(FolderPath, FolderPath + "/" + getHdfAsString(ProblemsUrl) + ".exe", executablePath); // HELPER.CGlobal.Alert(this, "Submiss thành công!"); } catch (Exception ex) { txtOutput.Text = ex.Message; } }
protected void btnSubmiss_Click(object sender, EventArgs e) { hdfUrl.Set(Point, 0); if (string.IsNullOrWhiteSpace(txtInput.Text)) { HELPER.Client.Alert(this, "Vui lòng nhập code!"); } else { hdfUrl.Set(CompilerID, cboCompiler.Value); hdfUrl.Set(TextCode, txtInput.Text); BUS_Submission objSubmiss = new BUS_Submission(getHdfAsLong(ProblemId), getHdfAsLong(CompilerID), getHdfAsLong(ContestId)); hdfUrl.Set(SubmissionId, objSubmiss.Insert()); BackgroundWorker bgWorker = new BackgroundWorker(); bgWorker.DoWork += new DoWorkEventHandler(bgWorker_DoWork); bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgWorker_RunWorkerCompleted); bgWorker.RunWorkerAsync(); } }