Beispiel #1
0
        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());
            }
        }
Beispiel #2
0
        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());
                }
            }
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
        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());
            }
        }
Beispiel #7
0
        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);
        }