예제 #1
0
        public ReportViewForm(Report report)
        {
            InitializeComponent();
            SingleAnalysisTabPage.Text = "360\x00B0Analysis";
            mIsViewReport = true;
            mViewReport = report;

            mTask = DataCenter.Instance().Tasks[report.TaskID];
            mChannelSettings = DataCenter.Instance().ChannelSettings[report.ChannelSettingID];
            mEmiFileData = DataCenter.Instance().EMIs[mViewReport.EmiFileID];

            mLimitSetting = mViewReport.LimitSetting;
        }
예제 #2
0
        void AnalysisViewForm_onUploadReportSuccessfully(long taskID, Report report, object context)
        {
            HTTPAgent.instance().onUploadReportSuccessfully -= new HTTPAgent.uploadReportSuccessfully(AnalysisViewForm_onUploadReportSuccessfully);
            HTTPAgent.instance().onUploadReportFailed -= new HTTPAgent.uploadReportFailed(AnalysisViewForm_onUploadReportFailed);

            MessageBox.Show("Upload report for task '" + mTask.Name + "' succeed !");
        }
예제 #3
0
        private void UpdateButton_Click(object sender, EventArgs e)
        {
            WatsEmiReportTool.Utility.ClearTempFiles();

            VerticalPicture.ImageLocation = null;
            HorizontalPicture.ImageLocation = null;
            SpanEditor.Text = SpanEditor.Text.Trim();
            if (SpanEditor.Text.Length == 0)
            {
                MessageBox.Show("Please input span value !", "Warning");
                SpanEditor.Focus();
                return;
            }
            if (!Regex.IsMatch(SpanEditor.Text, @"^[1-9]\d*(\.\d+)?$"))
            {
                MessageBox.Show(SpanEditor.Text + " is not a valid span value !", "Warning");
                SpanEditor.SelectAll();
                SpanEditor.Focus();
                return;
            }

            if (FrequencePreferredRadioButton.Checked)
            {
                if (!Regex.IsMatch(StartFreqEditor.Text, @"^[1-9]\d*(\.\d+)?$"))
                {
                    MessageBox.Show(StartFreqEditor.Text + " is not a valid start frequency value !", "Warning");
                    StartFreqEditor.SelectAll();
                    StartFreqEditor.Focus();
                    return;
                }

                if (!Regex.IsMatch(EndFreqEditor.Text, @"^[1-9]\d*(\.\d+)?$"))
                {
                    MessageBox.Show(EndFreqEditor.Text + " is not a valid start frequency value !", "Warning");
                    EndFreqEditor.SelectAll();
                    EndFreqEditor.Focus();
                    return;
                }

                if (double.Parse(EndFreqEditor.Text.Trim()) <= double.Parse(StartFreqEditor.Text.Trim()))
                {
                    MessageBox.Show("EndFrequency should bigger than StartFrequency !");
                    StartFreqEditor.SelectAll();
                    StartFreqEditor.Focus();
                    return;
                }
            }

            Program.Config.WriteInt("General", "ChannelPreferred", ChannelPreferredRadioButton.Checked ? 1 : 0);
            Program.Config.WriteInt("General", "DisplayChannel", DisplayChannelCheckBox.Checked ? 1 : 0);
            Program.Config.WriteString("General", "Span", SpanEditor.Text.Trim());

            mExportSpan = SpanEditor.Text;
            mStartFreq = StartFreqEditor.Text;
            mEndFreq = EndFreqEditor.Text;

            GenerateGraphs();

            mReport = new Report();
            mReport.Analyzer = HTTPAgent.Username;
            mReport.IsPairReport = false;
            mReport.TaskID = mTask.ID;
            mReport.ChannelSettingID = mTask.ChannelSettingID;
            mReport.LimitSetting = mLimitSetting;
            mReport.Span = double.Parse(mExportSpan);
            mReport.StartFreq = double.Parse(StartFreqEditor.Text);
            mReport.EndFreq = double.Parse(EndFreqEditor.Text);
            mReport.IsChannelPreferred = ChannelPreferredRadioButton.Checked;
            mReport.IsDisplayChannel = DisplayChannelCheckBox.Checked;
            mReport.EmiFileID = mEmiFileData.UID;
        }
예제 #4
0
파일: HTTPAgent.cs 프로젝트: hong1975/wats
        public void uploadTaskReport(Form attachedForm, long taskID, Report report, object context)
        {
            new Thread(delegate()
            {
                string json = "";
                byte[] respData;
                WebHeaderCollection headers;
                string url = getUrl(Action.getreports, taskID);
                HttpStatusCode statusCode = HTTPRequest.MakeRequest(url, "POST",
                    Constants.JSON_MIME, Constants.JSON_MIME,
                    Encoding.UTF8.GetBytes(Utility.JsonSerialize<Report>(report)), out respData, out headers);
                if (statusCode == HttpStatusCode.OK)
                {
                    if (onUploadReportSuccessfully != null)
                    {
                        report = new Report();
                        if (respData != null)
                        {
                            json = Encoding.UTF8.GetString(respData);
                            report = Utility.JsonDeserialize<Report>(json);
                        }
                        attachedForm.BeginInvoke(onUploadReportSuccessfully, taskID, report, context);
                    }
                }
                else
                {
                    if (onUploadReportFailed != null)
                    {
                        attachedForm.BeginInvoke(onUploadReportFailed, taskID, statusCode);
                    }
                }

            }).Start();
        }