Exemplo n.º 1
0
        private void LayoutProcessesInfo()
        {
            int       x          = this.labelAccount.Location.X;
            const int progressDx = 20;
            int       y          = labelDomainExample.Location.Y + labelDomainExample.Size.Height + 6;
            Size      preferredSize;
            int       maxLineDx = this.Size.Width - 2 * x;

            foreach (var test in Tests)
            {
                var l = new Label();
                l.ForeColor   = System.Drawing.Color.Black;
                l.AutoSize    = true;
                l.Location    = new System.Drawing.Point(x, y);
                l.Text        = test.DisplayName;
                preferredSize = l.GetPreferredSize(new Size(maxLineDx, 13));
                l.Size        = preferredSize;
                l.Show();
                test.Label = l;
                this.Controls.Add(l);
                int dy = preferredSize.Height;
                int dx = preferredSize.Width;

                var pi = new ProgressIndicator();
                pi.Location            = new Point(x + dx + 4, y - 3);
                pi.Size                = new Size(progressDx, dy);
                test.ProgressIndicator = pi;
                this.Controls.Add(pi);
                pi.Start();

                y += (dy + 6);
            }
            FinishedCountLabel          = new Label();
            FinishedCountLabel.Visible  = true;
            FinishedCountLabel.Location = new Point(x, y);
            FinishedCountLabel.Text     = String.Format("Finished 0 out {0} tests.", Tests.Count);
            FinishedCountLabel.Location = new Point(x, y);
            //preferredSize = FinishedCountLabel.GetPreferredSize(new Size(maxLineDx, 13));
            //FinishedCountLabel.Size = preferredSize;
            FinishedCountLabel.AutoSize = true;
            this.Controls.Add(FinishedCountLabel);

            SeeResultsLabel              = new LinkLabel();
            SeeResultsLabel.Visible      = false;
            SeeResultsLabel.Location     = new Point(x, y);
            SeeResultsLabel.Text         = "See results";
            preferredSize                = SeeResultsLabel.GetPreferredSize(new Size(maxLineDx, 13));
            SeeResultsLabel.Size         = preferredSize;
            SeeResultsLabel.LinkClicked += new LinkLabelLinkClickedEventHandler(LinkLabel_Clicked);
            y += (preferredSize.Height + buttonExit.Size.Height + 30);
            this.Controls.Add(SeeResultsLabel);
            if (ClientSize.Height < y)
            {
                ClientSize = new Size(this.ClientSize.Width, y);
            }
        }
Exemplo n.º 2
0
 private void SubmitDiagnosticReport()
 {
     try
     {
         var    wc       = new WebClient();
         byte[] response = wc.UploadFile(REPORT_SUBMIT_URL, ResultsFileName);
         string resp     = Encoding.UTF8.GetString(response, 0, response.Length);
         ResultsUrl = resp;
         int x         = this.labelAccount.Location.X;
         int maxLineDx = this.Size.Width - 2 * x;
         SeeResultsLabel.Text = "See results at " + ResultsUrl;
         Size preferredSize = SeeResultsLabel.GetPreferredSize(new Size(maxLineDx, 13));
         SeeResultsLabel.Size = preferredSize;
     }
     catch
     {
     }
 }