예제 #1
0
 public TaskReportListForm(Reports reports)
 {
     mReports = reports;
     InitializeComponent();
 }
예제 #2
0
        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();
        }
예제 #3
0
파일: HTTPAgent.cs 프로젝트: hong1975/wats
        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();
        }