Ejemplo n.º 1
0
        private void list()
        {
            try
            {
                txtPageNow.Text = pageNow.ToString();

                string start = pageNow > 1 ? ((pageNow - 1) * interval).ToString() : "0";
                string url   = getUrl(curcol, start);

                string s;
                using (System.Net.WebClient wc = new System.Net.WebClient())
                {
                    Byte[] pageData = wc.DownloadData(url);

                    s = System.Text.Encoding.GetEncoding("GBK").GetString(pageData);
                    //Stream stream = new System.IO.MemoryStream(Encoding.Convert(Encoding.GetEncoding("GBK"), Encoding.UTF8, pageData));
                    //s = System.Text.Encoding.UTF8.GetString(pageData);去除中文乱码

                    s += @"
    function getstring(){
        var s=serv_loadColumnNews();
        return  JSON.stringify(s);
    }
";
                    var eng = new Jurassic.ScriptEngine();
                    eng.Evaluate(s);
                    var b = eng.CallGlobalFunction <string>(@"getstring");

                    m = JsonConvert.DeserializeObject <oainfo>(b);
                }
                pagesAll        = m.total / interval + (m.total % interval == 0 ? 0 : 1);
                labPageAll.Text = pagesAll.ToString();

                listDoc.Items.Clear();
                foreach (var v in m.informations)
                {
                    ListViewItem lvi = new ListViewItem();
                    lvi = listDoc.Items.Add(v.id);
                    lvi.SubItems.Add(v.bt);
                    lvi.SubItems.Add(v.time);
                    lvi.SubItems.Add(v.mc);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
Ejemplo n.º 2
0
        private void list()
        {
            try
            {
                txtPageNow.Text = pageNow.ToString();

                string start = pageNow > 1 ? ((pageNow - 1) * interval).ToString() : "0";
                string url = getUrl(curcol, start);

                string s;
                using (System.Net.WebClient wc = new System.Net.WebClient())
                {
                    Byte[] pageData = wc.DownloadData(url);

                    s = System.Text.Encoding.GetEncoding("GBK").GetString(pageData);
                    //Stream stream = new System.IO.MemoryStream(Encoding.Convert(Encoding.GetEncoding("GBK"), Encoding.UTF8, pageData));
                    //s = System.Text.Encoding.UTF8.GetString(pageData);去除中文乱码

                    s += @"
            function getstring(){
            var s=serv_loadColumnNews();
            return  JSON.stringify(s);
            }
            ";
                    var eng = new Jurassic.ScriptEngine();
                    eng.Evaluate(s);
                    var b = eng.CallGlobalFunction<string>(@"getstring");

                    m = JsonConvert.DeserializeObject<oainfo>(b);
                }
                pagesAll = m.total / interval + (m.total % interval == 0 ? 0 : 1);
                labPageAll.Text = pagesAll.ToString();

                listDoc.Items.Clear();
                foreach (var v in m.informations)
                {
                    ListViewItem lvi = new ListViewItem();
                    lvi = listDoc.Items.Add(v.id);
                    lvi.SubItems.Add(v.bt);
                    lvi.SubItems.Add(v.time);
                    lvi.SubItems.Add(v.mc);
                }

            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }