public void showMsg(Status status) { txtMsg.Text = status.Msg; //txtMsg.Text += "\nStatus Code: " + status.Code.ToString(); if ((status.Code == 201) || (status.Code == 200)) { SystemSounds.Beep.Play(); } else { SystemSounds.Asterisk.Play(); } }
void Posted(Status status) { //this.Enabled = true; foreach (Control et in this.Controls) { et.Enabled = true; } this.Cursor = Cursors.Default; if ((status.Code != 201) || (!cbClose.Checked)) { notice = new notify(); notice.showMsg(status); notice.ShowDialog(this); } if ((status.Code == 201) && (cbClose.Checked)) { this.Close(); } //MessageBox.Show(this, Msg, "tumblr Communications - WinTumblr", MessageBoxButtons.OK, MessageBoxIcon.Information); }
void Posted(Status status) { btnValidate.Enabled = true; this.Cursor = Cursors.Default; notice = new notify(); notice.showMsg(status); //notice.showAuthenticate(status.Msg); notice.ShowDialog(this); }
public void ActivateTumblrEvent(Status status) { TumblrEventArgs TumblrArgs = new TumblrEventArgs(status); if (TumblrEvent != null) { TumblrEvent(this, TumblrArgs); } }
private Status PostIt(byte[] data) { // Generic Post to Tumblr method HttpWebRequest myRequest; HttpWebResponse response = null; Stream newStream = null; Status status = new Status(); // Prepare web request... myRequest = (HttpWebRequest)WebRequest.Create("http://www.tumblr.com/api/write"); //myRequest.Proxy WebProxy myProxy; Uri newUri; if ((Proxy.UseProxy != null) && ((bool)Proxy.UseProxy)) { try { myProxy = new WebProxy(); newUri = new Uri(Proxy.ServerURL + ":" + Proxy.ServerPort); myProxy.Address = newUri; if ((Proxy.Domain != null) && (Proxy.Domain.Length > 0)) { myProxy.Credentials = new NetworkCredential(Proxy.UserName, Proxy.Password, Proxy.Domain); } else { myProxy.Credentials = new NetworkCredential(Proxy.UserName, Proxy.Password); } myRequest.Proxy = myProxy; } catch (Exception ex) { status.Msg = Convert.ToString(ex.Message); } } myRequest.Credentials = CredentialCache.DefaultCredentials; myRequest.Method = "POST"; myRequest.ContentType = "application/x-www-form-urlencoded; charset=utf-8"; myRequest.ReadWriteTimeout = 600000; // Ten minutes - default should be 5 minutes. Change made due to timeout on larger uploads myRequest.Timeout = 600000; //header("Content-Type: text/html; charset=iso-8859-1"); myRequest.ContentLength = data.Length; try { newStream = myRequest.GetRequestStream(); // Send the data. newStream.WriteTimeout = 600000; // Ten minutes - Change made due to timeout on larger uploads. I wonder which is enforced? myRequest or the newStream. newStream.Write(data, 0, data.Length); // Get the response response = (HttpWebResponse)myRequest.GetResponse(); status.Code = Convert.ToInt32(response.StatusCode); status.Msg = response.StatusDescription; } catch (ProtocolViolationException ex) { status.Msg = Convert.ToString(ex.Message); } catch (NotSupportedException ex) { status.Msg = Convert.ToString(ex.Message); } catch (WebException ex) { status.Msg = Convert.ToString(ex.Message); } catch (Exception e) { status.Msg = Convert.ToString(e.Message); } finally { if (response != null) { response.Close(); } if (newStream != null) { newStream.Close(); } ActivateTumblrEvent(status); } return status; }
public TumblrEventArgs(Status status) { this.message = status.Msg; }