Example #1
0
        public RubberBandForm(MainForm mainform)
        {
            this.mainform = mainform;
            InitializeComponent();
            this.TopMost = true;
            this.Opacity = .30;
            this.TransparencyKey = System.Drawing.Color.White;
            this.Location = new Point(0, 0);
            DoubleBuffered = true;
            pen = new Pen(System.Drawing.Color.DarkRed, 3);
            pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;

            int maxX = 0;
            int maxY = 0;

            foreach (Screen screen in System.Windows.Forms.Screen.AllScreens)
            {
                int x = screen.Bounds.X + screen.Bounds.Width;
                if (x > maxX)
                    maxX = x;
                int y = screen.Bounds.Y + screen.Bounds.Height;
                if (y > maxY)
                    maxY = y;

            }
            bounds.X = 0;
            bounds.Y = 0;
            bounds.Width = maxX;
            bounds.Height = maxY;

            this.Size = new Size(bounds.Width, bounds.Height);

        }
Example #2
0
        static void send(MainForm frm)
        {
            Uri URL = new Uri(Program.url + "/insert_bug.aspx");

            ExtendedWebClient extendedWebClient = new ExtendedWebClient();
            CredentialCache myCredCache = new CredentialCache();
            myCredCache.Add(URL, "Basic", new NetworkCredential(Program.username, Program.password));
            myCredCache.Add(URL, "NTLM", new NetworkCredential(Program.username, Program.password, Program.domain));
            extendedWebClient.Credentials = myCredCache;
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            frm.getBitmap().Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
            string base64 = System.Convert.ToBase64String(ms.ToArray());
            ms.Close();
            ms.Dispose();

            try
            {
                // Anmelden per POST; anonymer Typ als Parameterobjekt
                WebRequest req = extendedWebClient.Post(URL, new
                {
                    username = Program.username,
                    password = Program.password,
                    bugid = frm.textBoxBugId.Text,
                    short_desc = frm.textBoxShortDescription.Text,
                    projectid = Convert.ToString(Program.project_id),
                    attachment_content_type = "image/jpg",
                    attachment_filename = String.Format("screenshot_{0}.jpg", DateTime.Now.ToString("yyyyMMdd'_'HHmmss")),
                    attachment = base64
                });

                WebResponse res = (WebResponse)req.GetResponse();
                frm.BeginInvoke(new MainForm.ResponseDelegate(frm.handleResponse), res);
            }
            catch (Exception e2)
            {
                frm.BeginInvoke(new MainForm.ResponseDelegate(frm.handleResponse), e2);
            }
        }