예제 #1
0
파일: Excavate_From.cs 프로젝트: aimerpc/-
        private void DataRead()
        {
            string KeyWord = this.txt_KeyWord.Text;
            string url     = "https://data.chinaz.com/keyword/allindex/" + KeyWord;
            string html    = GetHttpWebRequest(url);

            //MessageBox.Show(html);
            fileCRUD.Write("InNetwork.html", html);
            //WebBrowser br = new WebBrowser();
            //br.Navigate("about:blank");
            //br.ScriptErrorsSuppressed = true;
            //HtmlDocument document = br.Document.OpenNew(true);
            //document.Write(html);
            // this.ItHtml(document);
            HtmlAgilityPack.HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument();
            htmlDocument.LoadHtml(html);
            for (int i = 1; i <= 50; i++)
            {
                string       Xpath_Title         = "//*[@id='pagedivid']/ul[" + i + "]/li[2]/a";
                string       Xpath_SearchNumber  = "//*[@id='pagedivid']/ul[" + i + "]/li[9]";
                string       Search_Title        = htmlDocument.DocumentNode.SelectSingleNode(Xpath_Title).Attributes["title"].Value;
                string       Search_SearchNumber = htmlDocument.DocumentNode.SelectSingleNode(Xpath_SearchNumber).InnerText;
                ListViewItem lv = new ListViewItem(i.ToString());
                lv.SubItems.Add(Search_Title);
                lv.SubItems.Add(Search_SearchNumber);
                ListViewAdd(lv);
            }
        }
        private void Multi_Device_Form_Load(object sender, EventArgs e)
        {
            ComboBox_StartSeting(SerialPort1_ComboBox);
            ComboBox_StartSeting(SerialPort2_ComboBox);
            ComboBox_StartSeting(SerialPort3_ComboBox);
            ComboBox_StartSeting(SerialPort4_ComboBox);
            ComboBox_StartSeting(SerialPort5_ComboBox);
            if (!File.Exists(Xml_Path))
            {
                Protocols protocols = new Protocols();

                protocols.Protocolist.Add(new ProtocolSingle("超声波", "01 03 00 10 00 0A C4 08", "02 03 00 10 00 0A C4 3B", "03 03 00 10 00 0A C5 EA", "04 03 00 10 00 0A C4 5D", "05 03 00 10 00 0A C5 8C"));
                protocols.Protocolist.Add(new ProtocolSingle("特高频", "01 03 00 1A 00 0A E4 0A", "02 03 00 1A 00 0A E4 39", "03 03 00 1A 00 0A E5 E8", "04 03 00 1A 00 0A E4 5F", "05 03 00 1A 00 0A E5 8E"));
                protocols.Protocolist.Add(new ProtocolSingle("高频电流", "01 03 00 24 00 0A 85 C6", "02 03 00 24 00 0A 85 F5", "03 03 00 24 00 0A 84 24", "04 03 00 24 00 0A 85 93", "05 03 00 24 00 0A 84 42"));
                protocols.Protocolist.Add(new ProtocolSingle("低压故障电弧", "01 03 00 2E 00 0A A5 C4", "02 03 00 2E 00 0A A5 F7", "03 03 00 2E 00 0A A4 26", "04 03 00 2E 00 0A A5 91", "05 03 00 2E 00 0A A4 40"));
                protocols.Protocolist.Add(new ProtocolSingle("二合一", "01 03 00 10 00 0F 04 0B", "02 03 00 10 00 0F 04 38", "03 03 00 10 00 0F 05 E9", "04 03 00 10 00 0F 04 5E", "05 03 00 10 00 0F 05 8F"));
                protocols.Protocolist.Add(new ProtocolSingle("基站局放检测", "01 03 00 10 00 14 44 00", "02 03 00 10 00 14 44 33", "03 03 00 10 00 0F 05 E9", "04 03 00 10 00 0F 04 5E", "05 03 00 10 00 0F 05 8F"));
                //protocols.Protocolist.Add(new ProtocolSingle("1号传感器", "01 03 00 10 00 0A C4 08","","","",""));
                //protocols.Protocolist.Add(new ProtocolSingle("2号传感器", "01 03 00 1A 00 0A E4 0A","","","",""));
                protocols_GURD.Protocol_Save(protocols, Xml_Path);
            }
            if (File.Exists(Txt_Path))
            {
                this.Text = fileCRUD.Read(Txt_Path, Encoding.UTF8);
            }
            else
            {
                fileCRUD.Write(Txt_Path, "");
            }

            protocols = protocols_GURD.Load(Xml_Path);
            foreach (ProtocolSingle protocol in protocols.Protocolist)
            {
                Protocol_TitleName_ComboBox.Items.Add(protocol.ProtocolName);
            }
            cartogramPaint.CartogramInitialized(ref c1Chart1, ref arrHistory1);
            cartogramPaint.CartogramInitialized(ref c1Chart2, ref arrHistory2);
            cartogramPaint.CartogramInitialized(ref c1Chart3, ref arrHistory3);
            cartogramPaint.CartogramInitialized(ref c1Chart4, ref arrHistory4);
            cartogramPaint.CartogramInitialized(ref c1Chart5, ref arrHistory5);
            cartogramPaint.CartogramInitialized(ref c1Chart6, ref arrHistory6);
            cartogramPaint.CartogramInitialized(ref c1Chart7, ref arrHistory7);
        }