Example #1
0
        private static List <string> kyungbuk()
        {
            List <string> result2 = new List <string>();

            String      strUrl = "http://www.kma.go.kr/weather/forecast/mid-term-rss3.jsp?stnId=143";
            XmlDocument xdoc   = new XmlDocument();

            xdoc.Load(strUrl);

            XmlNode     cnode      = xdoc.SelectSingleNode("rss");
            XmlNode     ccnode     = cnode.SelectSingleNode("channel");
            XmlNode     cccnode    = ccnode.SelectSingleNode("item");
            XmlNode     ccccnode   = cccnode.SelectSingleNode("description");
            XmlNode     cccccnode  = ccccnode.SelectSingleNode("body");
            XmlNode     ccccccnode = cccccnode.SelectSingleNode("location");
            XmlNodeList xnl        = ccccccnode.SelectNodes("data");

            foreach (XmlNode xn in xnl)
            {
                string         tmn    = xn.SelectSingleNode("tmn").InnerText;
                string         tmx    = xn.SelectSingleNode("tmx").InnerText;
                int            tem    = int.Parse(tmx);
                WeatherManager wm     = new WeatherManager();
                string         result = wm.method(tem, 0.5);

                result2.Add(tmn);
                result2.Add(tmx);
                result2.Add(result);
            }
            return(result2);
        }
Example #2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            String strUrl = "http://www.kma.go.kr/weather/forecast/mid-term-rss3.jsp?stnId=109";

            XmlDocument xdoc = new XmlDocument();

            xdoc.Load(strUrl);

            XmlNode     cnode      = xdoc.SelectSingleNode("rss");
            XmlNode     ccnode     = cnode.SelectSingleNode("channel");
            XmlNode     cccnode    = ccnode.SelectSingleNode("item");
            XmlNode     ccccnode   = cccnode.SelectSingleNode("description");
            XmlNode     cccccnode  = ccccnode.SelectSingleNode("body");
            XmlNode     ccccccnode = cccccnode.SelectSingleNode("location");
            XmlNodeList xnl        = ccccccnode.SelectNodes("data");

            foreach (XmlNode xn in xnl)
            {
                textBox1.Text = xn.SelectSingleNode("tmn").InnerText;
                textBox2.Text = xn.SelectSingleNode("tmx").InnerText;
                int            tem = int.Parse(textBox1.Text);
                WeatherManager wm  = new WeatherManager();
                textBox3.Text = wm.method(tem, 0.5);
            }
        }
Example #3
0
        public int tembase()
        {
            String strUrl = "http://www.kma.go.kr/weather/forecast/mid-term-rss3.jsp?stnId=109";

            XmlDocument xdoc = new XmlDocument();

            xdoc.Load(strUrl);

            XmlNode     cnode      = xdoc.SelectSingleNode("rss");
            XmlNode     ccnode     = cnode.SelectSingleNode("channel");
            XmlNode     cccnode    = ccnode.SelectSingleNode("item");
            XmlNode     ccccnode   = cccnode.SelectSingleNode("description");
            XmlNode     cccccnode  = ccccnode.SelectSingleNode("body");
            XmlNode     ccccccnode = cccccnode.SelectSingleNode("location");
            XmlNodeList xnl        = ccccccnode.SelectNodes("data");

            int num = 0;

            foreach (XmlNode xn in xnl)
            {
                string tmn = xn.SelectSingleNode("tmn").InnerText;
                // string tmx = xn.SelectSingleNode("tmx").InnerText;
                //int tem = int.Parse(textBox1.Text);
                string         tem_result;
                WeatherManager wm = new WeatherManager();
                tem_result = wm.method(Convert.ToDouble(tmn), 0.5);
                //불쾌지수 70 이상 가벼운 긴팔 추천
                if (Convert.ToDouble(tem_result) > 70)
                {
                    num = 1;
                }
                //불쾌지수 80이상 반팔 반바지 추천
                else if (Convert.ToDouble(tem_result) > 80)
                {
                    num = 2;
                }
            }
            return(num);
        }