void timer2_Tick(object sender, EventArgs e) { ri = new RestImpl(); string tagURL = Explorer.LocationURL; if (tagURL != previousURL && tagURL != String.Empty) { previousURL = tagURL; try { string target_url = "http://sgcsoft.net/work/commoncause/admin/tag_counter.php"; webRequest = ri.CreateRequestForTagCount(target_url, tagURL); string response = ri.GetResponse(webRequest); this.lblTags.Text = ""; if (Int32.Parse(response) > 0) { this.lblTags.Text = "Add (" + response + ")"; } else { this.lblTags.Text = "Add (" + response + ")"; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
void Explorer_BeforeNavigate(string URL, int Flags, string TargetFrameName, ref object PostData, string Headers, ref bool Cancel) { //throw new Exception("The method or operation is not implemented."); ri = new RestImpl(); string tagURL = URL; //MessageBox.Show("getew"); if (!tagURL.EndsWith("/")) { tagURL += "/"; } try { string target_url = "http://spheresolutions.org/feedmanager/admin/tag_counter.php"; webRequest = ri.CreateRequestForTagCount(target_url, tagURL); string response = ri.GetResponse(webRequest); this.lblSubmitThisStory.Text = "Submit this story "; if (Int32.Parse(response) > 0) { this.lblSubmitThisStory.Text += "(" + response + ")"; } else { this.lblSubmitThisStory.Text += "(" + response + ")"; } } catch (Exception ex) { //MessageBox.Show(ex.ToString()); } }
private void CommonCause_Load(object sender, EventArgs e) { /*which is empty*/ previousURL = Explorer.LocationURL; //MessageBox.Show(previousURL); Explorer.BeforeNavigate += new DWebBrowserEvents_BeforeNavigateEventHandler(Explorer_BeforeNavigate); ri = new RestImpl(); IDictionary <String, String> paramList = new Dictionary <String, String>(); try { string target_url = "http://spheresolutions.org/feedmanager/admin/commoncause_xml.php"; webRequest = ri.CreateRequest(target_url, paramList); strResponse = ri.GetXMLResponse(webRequest); /*get the deley counter*/ XmlNodeList list = strResponse.GetElementsByTagName("alerts"); XmlElement element = (XmlElement)list.Item(0); Int32 deleyTime = Int32.Parse(element.GetAttribute("delay")); /*get the alert messages*/ alertlist = strResponse.GetElementsByTagName("alert"); counter = 0; srchLbl.Text = ""; srchLbl.Text = alertlist.Item(counter).InnerText; timer1.Start(); timer1.Interval = deleyTime * 1000; timer1.Tick += new EventHandler(timer1_Tick); } catch (Exception ex) { //MessageBox.Show(ex.ToString()); } finally { } this.imgbtn.Location = new System.Drawing.Point(Screen.PrimaryScreen.Bounds.Width - 135, 0); this.Controls.Add(this.imgbtn); }
private void pcboxDrop_Click(object sender, MouseEventArgs e) { RestImpl ri = new RestImpl(); string tagURL = Explorer.LocationURL; //if (tagURL.StartsWith("http://") ) //{ // tagURL = tagURL.Substring(7, tagURL.Length - 7); //} //if (tagURL.StartsWith("https://")) //{ // tagURL = tagURL.Substring(8, tagURL.Length - 8); //} //tagURL = tagURL.Substring(0, tagURL.Length - 1); try { string target_url = "http://sgcsoft.net/work/commoncause/admin/tag_counter.php"; HttpWebRequest webRequest = ri.CreateRequestForTagCount(target_url, tagURL); string response = ri.GetResponse(webRequest); this.addUrlToolStripMenuItem.Text = ""; if (Int32.Parse(response) > 0) { this.addUrlToolStripMenuItem.Text = "Add URL: " + response + " Tags"; } else { this.addUrlToolStripMenuItem.Text = "Add URL: " + response + " Tag"; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.addUrlToolStripMenuItem }); this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Size = new System.Drawing.Size(149, 48); this.contextMenuStrip1.ResumeLayout(false); this.contextMenuStrip1.Show(this.Location.X + 35, this.Location.Y + 65); }
private void pcboxDrop_Click(object sender, MouseEventArgs e) { RestImpl ri = new RestImpl(); string tagURL = Explorer.LocationURL; try { string target_url = "http://spheresolutions.org/feedmanager/admin/tag_counter.php"; HttpWebRequest webRequest = ri.CreateRequestForTagCount(target_url, tagURL); string response = ri.GetResponse(webRequest); this.addUrlToolStripMenuItem.Text = ""; if (Int32.Parse(response) > 0) { this.addUrlToolStripMenuItem.Text = "Add URL: " + response + " Tags"; } else { this.addUrlToolStripMenuItem.Text = "Add URL: " + response + " Tag"; } } catch (Exception ex) { //MessageBox.Show(ex.ToString()); } this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.addUrlToolStripMenuItem }); this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Size = new System.Drawing.Size(149, 48); this.contextMenuStrip1.ResumeLayout(false); this.contextMenuStrip1.Show(this.Location.X + 35, this.Location.Y + 65); }
public void loadTags(object pDisp, ref object URL) { MessageBox.Show("HIT !!!!"); ri = new RestImpl(); string tagURL = URL.ToString(); try { string target_url = "http://sgcsoft.net/work/commoncause/admin/tag_counter.php"; webRequest = ri.CreateRequestForTagCount(target_url, tagURL); string response = ri.GetResponse(webRequest); this.lblTags.Text = ""; if (Int32.Parse(response) > 0) { this.lblTags.Text = "Add (" + response + ")"; } else { this.lblTags.Text = "Add (" + response + ")"; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } //this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.addUrlToolStripMenuItem }); //this.contextMenuStrip1.Name = "contextMenuStrip1"; //this.contextMenuStrip1.Size = new System.Drawing.Size(149, 48); //this.contextMenuStrip1.ResumeLayout(false); //this.contextMenuStrip1.Show(this.Location.X + 35, this.Location.Y + 65); }
private void BtnSave_Click(object sender, EventArgs e) { selectedTag = new ArrayList(); selectedTagName = new ArrayList(); foreach (Control con in this.Controls) { if (con.GetType() == typeof(System.Windows.Forms.CheckBox)) { CheckBox ch = (CheckBox)con; if (ch.Checked) { selectedTagName.Add(ch.Text); //int tagIndex = Int32.Parse(ch.Name.Substring(8)); int ind; for (ind = 0; ind < alertlist.Count; ind++) { if (alertlist.Item(ind).InnerText == ch.Text) { /*get the index value and break*/ break; } } int tagIndex = Int32.Parse(tagid[ind].ToString()); selectedTag.Add(tagIndex); } } } RestImpl newRi = new RestImpl(); IDictionary <String, String> newparamList = new Dictionary <String, String>(); newparamList.Add("url", this.lblBrowserURL.Text); newparamList.Add("title", this.txtTitle.Text); newparamList.Add("notes", this.txtNotes.Text); string selectedState = ""; if (this.comboBox1.SelectedItem != null) { selectedState = this.comboBox1.SelectedItem.ToString(); newparamList.Add("state", this.comboBox1.SelectedItem.ToString()); } else { newparamList.Add("state", ""); } string tagName = HttpUtility.UrlEncode("tag_name"); string tags = ""; for (int i = 0; i < selectedTag.Count; i++) { tags += selectedTag[i].ToString() + ","; } if (selectedTag.Count > 0) { tags = tags.Remove(tags.LastIndexOf(",")); } newparamList.Add(tagName, tags); tags = ""; newparamList.Add("Submit", "Submit"); try { string target_url = "http://sgcsoft.net/work/commoncause/admin/save-content.php"; HttpWebRequest webRequest = newRi.CreateSubmitRequest(target_url, newparamList); string str = newRi.GetResponse(webRequest); //MessageBox.Show(str); string successMessage = ""; if (str.Contains("200:OK")) { successMessage += "!! BookMark Saved Successfully !!" + "\n"; successMessage += "\n" + "Saved Info: " + "\n" + "=========" + "\n"; successMessage += "Url: " + lblBrowserURL.Text + "\n"; successMessage += "Title: " + txtTitle.Text + "\n"; successMessage += "Notes: " + txtNotes.Text + "\n"; successMessage += "State: " + selectedState + "\n"; successMessage += "Tag(s): "; for (int i = 0; i < selectedTagName.Count; i++) { successMessage += "\t" + selectedTagName[i] + "\n"; } MessageBox.Show(successMessage, "Status", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); this.Dispose(); } else { MessageBox.Show("Failure: bookmark cannot be saved", "Failure", MessageBoxButtons.OK, MessageBoxIcon.Error); } //MessageBox.Show("Save Button clicked"); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void SaveBookmarkForm_Load(object sender, EventArgs e) { this.txtTitle.TabIndex = 0; RestImpl ri = new RestImpl(); IDictionary <String, String> paramList = new Dictionary <String, String>(); //MessageBox.Show(strResponse); try { string target_url = "http://sgcsoft.net/work/commoncause/admin/commoncause_xml.php"; HttpWebRequest webRequest = ri.CreateRequest(target_url, paramList); strResponse = ri.GetXMLResponse(webRequest); alertlist = strResponse.GetElementsByTagName("tag"); foreach (XmlElement element in alertlist) { tagid.Add(element.GetAttribute("id")); } //tagid.ToArray(); int i; int total_count = alertlist.Count; int LeftX = 86; int LeftY = 185; int RightX = 300; int RightY = 185; CheckBox ch = null; CheckBox lastCheckBox = null; for (i = 0; i < total_count; i++) { if (i == 0) { ch = checkbox1; ch.Text = alertlist.Item(i).InnerText; } else if (i == 1) { ch = checkbox2; ch.Text = alertlist.Item(i).InnerText; } else if (i == 2) { ch = checkbox3; ch.Text = alertlist.Item(i).InnerText; } else if (i == 3) { ch = checkbox4; ch.Text = alertlist.Item(i).InnerText; } else if (i == 4) { ch = checkbox5; ch.Text = alertlist.Item(i).InnerText; } else if (i == 5) { ch = checkbox6; ch.Text = alertlist.Item(i).InnerText; } else if (i == 6) { ch = checkbox7; ch.Text = alertlist.Item(i).InnerText; } else if (i == 7) { ch = checkbox8; ch.Text = alertlist.Item(i).InnerText; } else if (i == 8) { ch = checkbox9; ch.Text = alertlist.Item(i).InnerText; } else if (i == 9) { ch = checkbox10; ch.Text = alertlist.Item(i).InnerText; } else if (i == 10) { ch = checkbox11; ch.Text = alertlist.Item(i).InnerText; } else if (i == 11) { ch = checkbox12; ch.Text = alertlist.Item(i).InnerText; } else if (i == 12) { ch = checkbox13; ch.Text = alertlist.Item(i).InnerText; } else if (i == 13) { ch = checkbox14; ch.Text = alertlist.Item(i).InnerText; } else if (i == 14) { ch = checkbox15; ch.Text = alertlist.Item(i).InnerText; } else if (i == 15) { ch = checkbox16; ch.Text = alertlist.Item(i).InnerText; } else if (i == 16) { ch = checkbox17; ch.Text = alertlist.Item(i).InnerText; } else if (i == 17) { ch = checkbox18; ch.Text = alertlist.Item(i).InnerText; } else if (i == 18) { ch = checkbox19; ch.Text = alertlist.Item(i).InnerText; } else if (i == 19) { ch = checkbox20; ch.Text = alertlist.Item(i).InnerText; } if (i % 2 == 0) { //LeftY += (i + 1) * 30; if (i > 0) { LeftY += 20; } ch.Location = new System.Drawing.Point(LeftX, LeftY); } else { //RightY += (i + 1) * 30; if (i > 1) { RightY += 20; } ch.Location = new System.Drawing.Point(RightX, RightY); } this.Controls.Add(ch); lastCheckBox = ch; } this.BtnSave.Location = new Point(400, lastCheckBox.Location.Y + 100); this.BtnCancel.Location = new Point(500, lastCheckBox.Location.Y + 100); this.Controls.Add(BtnSave); this.Controls.Add(BtnCancel); /*load the state combo box here*/ target_url = "http://sgcsoft.net/work/commoncause/admin/state_xml.php"; HttpWebRequest webRequest2 = ri.CreateRequest(target_url, paramList); strResponse = ri.GetXMLResponse(webRequest2); XmlNodeList stateList = strResponse.GetElementsByTagName("state_name"); for (int j = 0; j < stateList.Count; j++) { this.comboBox1.Items.Add(stateList.Item(j).InnerText); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void CommonCause_Load(object sender, EventArgs e) { previousURL = Explorer.LocationURL; MessageBox.Show(previousURL); if (previousURL != String.Empty) { try { ri = new RestImpl(); string target_url = "http://sgcsoft.net/work/commoncause/admin/tag_counter.php"; webRequest = ri.CreateRequestForTagCount(target_url, previousURL); string response = ri.GetResponse(webRequest); MessageBox.Show(response); this.lblTags.Text = ""; if (Int32.Parse(response) > 0) { this.lblTags.Text = "Add (" + response + ")"; } else { this.lblTags.Text = "Add (" + response + ")"; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } timer2.Start(); timer2.Tick += new EventHandler(timer2_Tick); //MessageBox.Show("Hi ! iam changing how r u????????"); ri = new RestImpl(); IDictionary <String, String> paramList = new Dictionary <String, String>(); //MessageBox.Show(strResponse); try { string target_url = "http://sgcsoft.net/work/commoncause/admin/commoncause_xml.php"; webRequest = ri.CreateRequest(target_url, paramList); strResponse = ri.GetXMLResponse(webRequest); /*get the deley counter*/ XmlNodeList list = strResponse.GetElementsByTagName("alerts"); XmlElement element = (XmlElement)list.Item(0); Int32 deleyTime = Int32.Parse(element.GetAttribute("delay")); //MessageBox.Show("DELAY TIME IS : " + deleyTime.ToString()); //MessageBox.Show(element.InnerText); /*get the alert messages*/ alertlist = strResponse.GetElementsByTagName("alert"); counter = 0; srchLbl.Text = ""; srchLbl.Text = alertlist.Item(counter).InnerText; timer1.Start(); timer1.Interval = deleyTime * 1000; timer1.Tick += new EventHandler(timer1_Tick); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { } this.imgbtn.Location = new System.Drawing.Point(Screen.PrimaryScreen.Bounds.Width - 200, 0); this.Controls.Add(this.imgbtn); }