Beispiel #1
0
        public void Step_ReadAmedasInformation()
        {
            try
            {
                HtmlDocument doc = wb.Document;
                string tableId = "tbl_list";
                HtmlElement tbl_list = doc.GetElementById(tableId);

                if (tbl_list == null)
                {
                    // = "Can not find table list";
                    return;
                }

                HtmlElementCollection trs = tbl_list.GetElementsByTagName("tr");
                HtmlElementCollection time = trs[1].GetElementsByTagName("td");

                tableIndexNum = LI.returnTableIndex(SelectedLocal);

                xobj = new AmedasXml[trs.Count];

                for (int i = 0; i < trs.Count; i++)
                {
                    xobj[i] = new AmedasXml();

                    for (int j = 0; j < tableIndexNum; j++)
                    {

                        //--여름하고 겨울에는 교토의 환경변수 개수가 변한다--//
                        switch (j)
                        {
                            case 0:
                                xobj[i].ClockTime = trs[i].GetElementsByTagName("td")[j].InnerText;
                                break;

                            case 1:
                                xobj[i].Temperature = trs[i].GetElementsByTagName("td")[j].InnerText;
                                break;

                            case 2:
                                xobj[i].PrecipitationAmount = trs[i].GetElementsByTagName("td")[j].InnerText;
                                break;

                            case 3:
                                xobj[i].WindDirection = trs[i].GetElementsByTagName("td")[j].InnerText;
                                break;

                            case 4:
                                xobj[i].WindSpeed = trs[i].GetElementsByTagName("td")[j].InnerText;
                                break;

                            case 5:
                                xobj[i].SunshineHours = trs[i].GetElementsByTagName("td")[j].InnerText;
                                break;

                            //case 6:
                            //    xobj[i].DepthOfSnow = trs[i].GetElementsByTagName("td")[j].InnerText;
                            //    break;

                            case 6:
                                xobj[i].Humidity = trs[i].GetElementsByTagName("td")[j].InnerText;
                                break;

                            case 7:
                                xobj[i].Atmosphere = trs[i].GetElementsByTagName("td")[j].InnerText;
                                break;

                        }
                    }
                }

                this.SaveXmlFile();
            }
            catch (Exception err)
            {
                string error = err.Message + "\n" + err.Source;
            }
        }
        public void Step_ReadAmedasInformation()
        {
            try
            {
                HtmlDocument doc      = wb.Document;
                string       tableId  = "tbl_list";
                HtmlElement  tbl_list = doc.GetElementById(tableId);

                if (tbl_list == null)
                {
                    // = "Can not find table list";
                    return;
                }

                HtmlElementCollection trs  = tbl_list.GetElementsByTagName("tr");
                HtmlElementCollection time = trs[1].GetElementsByTagName("td");

                tableIndexNum = LI.returnTableIndex(SelectedLocal);

                xobj = new AmedasXml[trs.Count];

                for (int i = 0; i < trs.Count; i++)
                {
                    xobj[i] = new AmedasXml();

                    for (int j = 0; j < tableIndexNum; j++)
                    {
                        //--여름하고 겨울에는 교토의 환경변수 개수가 변한다--//
                        switch (j)
                        {
                        case 0:
                            xobj[i].ClockTime = trs[i].GetElementsByTagName("td")[j].InnerText;
                            break;

                        case 1:
                            xobj[i].Temperature = trs[i].GetElementsByTagName("td")[j].InnerText;
                            break;

                        case 2:
                            xobj[i].PrecipitationAmount = trs[i].GetElementsByTagName("td")[j].InnerText;
                            break;

                        case 3:
                            xobj[i].WindDirection = trs[i].GetElementsByTagName("td")[j].InnerText;
                            break;

                        case 4:
                            xobj[i].WindSpeed = trs[i].GetElementsByTagName("td")[j].InnerText;
                            break;

                        case 5:
                            xobj[i].SunshineHours = trs[i].GetElementsByTagName("td")[j].InnerText;
                            break;

                        //case 6:
                        //    xobj[i].DepthOfSnow = trs[i].GetElementsByTagName("td")[j].InnerText;
                        //    break;

                        case 6:
                            xobj[i].Humidity = trs[i].GetElementsByTagName("td")[j].InnerText;
                            break;

                        case 7:
                            xobj[i].Atmosphere = trs[i].GetElementsByTagName("td")[j].InnerText;
                            break;
                        }
                    }
                }

                this.SaveXmlFile();
            }
            catch (Exception err)
            {
                string error = err.Message + "\n" + err.Source;
            }
        }