예제 #1
0
        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);
        }
예제 #2
0
        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());
            }
        }
예제 #3
0
파일: CommonCause.cs 프로젝트: Akmazad/BHO
        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);
        }