public TaskReportListForm(Reports reports) { mReports = reports; InitializeComponent(); }
void WorkspaceForm_onGetReportsSuccessfully(long taskID, Reports reports, object context) { string taskName = DataCenter.Instance().Tasks[taskID].Name; if (reports == null || reports.Report == null || reports.Report.Count == 0) { MessageBox.Show("No report for task '" + taskName + "' !"); return; } TaskReportListForm taskReportListForm = new TaskReportListForm(reports); taskReportListForm.ShowDialog(); }
public void getTaskReports(Form attachedForm, long taskID, object context) { new Thread(delegate() { string json = ""; byte[] respData; WebHeaderCollection headers; string url = getUrl(Action.getreports, taskID); HttpStatusCode statusCode = HTTPRequest.MakeRequest(url, "GET", Constants.JSON_MIME, null, null, out respData, out headers); if (statusCode == HttpStatusCode.OK) { if (onGetReportsSuccessfully != null) { Reports reports = new Reports(); if (respData != null) { json = Encoding.UTF8.GetString(respData); reports = Utility.JsonDeserialize<Reports>(json); Utility.FillReports(reports); } attachedForm.BeginInvoke(onGetReportsSuccessfully, taskID, reports, context); } } else { if (onGetReportsFailed != null) { attachedForm.BeginInvoke(onGetReportsFailed, taskID, statusCode); } } }).Start(); }