コード例 #1
0
ファイル: StockNews.cs プロジェクト: stonezhu870/istock
        /// <summary>
        /// 获取单个证券的信息
        /// </summary>
        /// <param name="codes"></param>
        /// <returns></returns>
        public static List <SingleInfo> GetSingleInfos(String codes)
        {
            StringBuilder sb  = new StringBuilder(102400);
            int           len = GetNews(codes, sb);
            String        str = sb.ToString();

            String[]          strs     = str.Split(new String[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
            int               strsSize = strs.Length;
            List <SingleInfo> infos    = new List <SingleInfo>();

            for (int i = 0; i < strsSize; i++)
            {
                String     strInfo    = strs[i];
                SingleInfo singleInfo = new SingleInfo();
                int        index      = strInfo.IndexOf(",");
                singleInfo.Date     = strInfo.Substring(0, index);
                strInfo             = strInfo.Substring(index + 1);
                index               = strInfo.IndexOf(",");
                singleInfo.Time     = strInfo.Substring(0, index);
                strInfo             = strInfo.Substring(index + 1);
                index               = strInfo.IndexOf(",");
                singleInfo.Type     = strInfo.Substring(0, index);
                strInfo             = strInfo.Substring(index + 1);
                index               = strInfo.IndexOf(",");
                singleInfo.InfoCode = strInfo.Substring(0, index);
                singleInfo.Title    = strInfo.Substring(index + 1);
                infos.Add(singleInfo);
            }
            return(infos);
        }
コード例 #2
0
ファイル: StockNews.cs プロジェクト: stonezhu870/istock
 /// <summary>
 /// 单元格双击事件
 /// </summary>
 /// <param name="sender">调用者</param>
 /// <param name="cell">单元格</param>
 /// <param name="mp">坐标</param>
 /// <param name="button">按钮</param>
 /// <param name="clicks">点击次数</param>
 /// <param name="delta">滚轮值</param>
 private void GridCellClick(object sender, GridCell cell, POINT mp, MouseButtonsA button, int clicks, int delta)
 {
     if (clicks == 2)
     {
         SingleInfo singleInfo = cell.Row.Tag as SingleInfo;
         String     type       = singleInfo.Type;
         String     infoCode   = singleInfo.InfoCode;
         String     url        = "";
         if (type == "1")
         {
             url = "http://app.jg.eastmoney.com/html_News/DetailOnly.html?infoCode=" + infoCode;
         }
         else if (type == "2")
         {
             url = "http://pdf.dfcfw.com/pdf/H2_" + infoCode + "_1.pdf";
         }
         else if (type == "3")
         {
             url = "http://pdf.dfcfw.com/pdf/H301_" + infoCode + "_1.pdf";
         }
         Process.Start(url);
         //String text = "";
         //if (type == "1")
         //{
         //    text = StockNewsDataHelper.GetRealTimeInfoByCode(infoCode);
         //}
         //else if (type == "2")
         //{
         //    text = NoticeDataHelper.GetRealTimeInfoByCode(infoCode);
         //}
         //else if (type == "3")
         //{
         //    text = ReportDataHelper.GetRealTimeInfoByCode(infoCode);
         //}
         //m_mainFrame.ShowMessageBox(text, "提示", 0);
     }
 }