Beispiel #1
0
        /// <summary>
        /// 添加类别到表格中
        /// </summary>
        /// <param name="categories">类别</param>
        public void LoadCategoriesToCategoryGrid(List <UserSecurityCategory> categories)
        {
            m_gridCategory.BeginUpdate();
            int categoriesSize = categories.Count;

            for (int i = 0; i < categoriesSize; i++)
            {
                UserSecurityCategory category = categories[i];
                GridRow row = new GridRow();
                row.Grid = m_gridCategory;
                GridStringCell idCell = new GridStringCell();
                idCell.Grid   = m_gridCategory;
                idCell.Column = m_gridCategory.GetColumn(0);
                idCell.Text   = category.m_categoryID;
                row.AddCell(0, idCell);
                GridStringCell textCell = new GridStringCell();
                textCell.Grid      = m_gridCategory;
                textCell.Column    = m_gridCategory.GetColumn(0);
                textCell.AllowEdit = true;
                textCell.Text      = category.m_name;
                row.AddCell(1, textCell);
                m_gridCategory.AddRow(row);
            }
            m_gridCategory.EndUpdate();
            m_gridCategory.Invalidate();
        }
Beispiel #2
0
        /// <summary>
        /// 添加模板到表格控件中
        /// </summary>
        /// <param name="serverInfos">服务器信息</param>
        private void AddServersToGrid(List <ServerInfo> serverInfos)
        {
            m_gridServers.BeginUpdate();
            int     serversInfosSize = serverInfos.Count;
            GridRow selectedRow      = null;

            for (int i = 0; i < serversInfosSize; i++)
            {
                ServerInfo serverInfo = serverInfos[i];
                GridRow    row        = new GridRow();
                row.Grid = m_gridServers;
                GridStringCell idCell = new GridStringCell();
                idCell.Grid   = m_gridServers;
                idCell.Column = m_gridServers.GetColumn(0);
                idCell.Text   = serverInfo.m_id;
                row.AddCell(0, idCell);
                GridStringCell ipCell = new GridStringCell();
                ipCell.Grid   = m_gridServers;
                ipCell.Column = m_gridServers.GetColumn(1);
                ipCell.Text   = serverInfo.m_ip;
                row.AddCell(1, ipCell);
                GridStringCell portCell = new GridStringCell();
                portCell.Grid   = m_gridServers;
                portCell.Column = m_gridServers.GetColumn(2);
                portCell.Text   = serverInfo.m_port.ToString();
                row.AddCell(2, portCell);
                GridStringCell typeCell = new GridStringCell();
                typeCell.Grid   = m_gridServers;
                typeCell.Column = m_gridServers.GetColumn(3);
                typeCell.Text   = serverInfo.m_type;
                row.AddCell(3, typeCell);
                m_gridServers.AddRow(row);
                selectedRow = row;
            }
            //选中行
            if (selectedRow != null)
            {
                List <GridRow> selectedRows = new List <GridRow>();
                selectedRows.Add(selectedRow);
                m_gridServers.SelectedRows = selectedRows;
            }
            m_gridServers.EndUpdate();
            m_gridServers.VScrollBar.ScrollToEnd();
        }
Beispiel #3
0
        /// <summary>
        /// 添加模板到表格控件中
        /// </summary>
        /// <param name="templates">模板列表</param>
        private void AddTemplatesToGrid(List <SecurityFilterTemplate> templates)
        {
            m_gridTemplate.BeginUpdate();
            int templatesSize = templates.Count;

            for (int i = 0; i < templatesSize; i++)
            {
                SecurityFilterTemplate template = templates[i];
                GridRow row = new GridRow();
                row.Grid = m_gridTemplate;
                GridStringCell idCell = new GridStringCell();
                idCell.Grid   = m_gridTemplate;
                idCell.Column = m_gridTemplate.GetColumn(0);
                idCell.Text   = template.m_templateID;
                row.AddCell(0, idCell);
                GridStringCell textCell = new GridStringCell();
                textCell.Grid   = m_gridTemplate;
                textCell.Column = m_gridTemplate.GetColumn(1);
                textCell.Text   = template.m_name;
                row.AddCell(1, textCell);
                m_gridTemplate.AddRow(row);
            }
            m_gridTemplate.EndUpdate();
        }
Beispiel #4
0
        /// <summary>
        /// 添加布局到表格控件中
        /// </summary>
        /// <param name="layouts">布局列表</param>
        private void AddLayoutsToGrid(List <IndicatorLayout> layouts)
        {
            m_gridLayouts.BeginUpdate();
            int layoutsSize = layouts.Count;

            for (int i = 0; i < layoutsSize; i++)
            {
                IndicatorLayout layout = layouts[i];
                GridRow         row    = new GridRow();
                row.Grid = m_gridLayouts;
                GridStringCell idCell = new GridStringCell();
                idCell.Grid   = m_gridLayouts;
                idCell.Column = m_gridLayouts.GetColumn(0);
                idCell.Text   = layout.m_layoutID;
                row.AddCell(0, idCell);
                GridStringCell textCell = new GridStringCell();
                textCell.Grid   = m_gridLayouts;
                textCell.Column = m_gridLayouts.GetColumn(1);
                textCell.Text   = layout.m_name;
                row.AddCell(1, textCell);
                m_gridLayouts.AddRow(row);
            }
            m_gridLayouts.EndUpdate();
        }
Beispiel #5
0
        /// <summary>
        /// 添加宏到表格控件中
        /// </summary>
        /// <param name="macros">布局列表</param>
        private void AddMacrosToGrid(List <Macro> macros)
        {
            m_gridMacros.BeginUpdate();
            int macrosSize = macros.Count;

            for (int i = 0; i < macrosSize; i++)
            {
                Macro   macro = macros[i];
                GridRow row   = new GridRow();
                row.Grid = m_gridMacros;
                GridStringCell idCell = new GridStringCell();
                idCell.Grid   = m_gridMacros;
                idCell.Column = m_gridMacros.GetColumn(0);
                idCell.Text   = macro.m_macroID;
                row.AddCell(0, idCell);
                GridStringCell textCell = new GridStringCell();
                textCell.Grid   = m_gridMacros;
                textCell.Column = m_gridMacros.GetColumn(1);
                textCell.Text   = macro.m_name;
                row.AddCell(1, textCell);
                m_gridMacros.AddRow(row);
            }
            m_gridMacros.EndUpdate();
        }
Beispiel #6
0
 /// <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 (cell.Grid == m_tvIndicatorBrowser)
     {
         TreeNodeA tn = cell as TreeNodeA;
         if (tn.m_nodes.Count == 0)
         {
             NodeData nodeData = tn.Tag as NodeData;
             if (nodeData.IsCatalog)
             {
                 IndicatorLeafDataPacket leafPacket = new IndicatorLeafDataPacket(nodeData.Id);
                 ConnectManager.CreateInstance().Request(leafPacket);
                 int tick = 0;
                 while (leafPacket.ReserveFlag == 0 && tick < 50)
                 {
                     Thread.Sleep(100);
                     tick++;
                 }
                 if (leafPacket.LeafNodeList.Count > 0)
                 {
                     List <NodeData> nodes = leafPacket.LeafNodeList;
                     Dictionary <String, TreeNodeA> nodesMap = new Dictionary <String, TreeNodeA>();
                     int nodesSzie = nodes.Count;
                     for (int i = 0; i < nodesSzie; i++)
                     {
                         NodeData  node  = nodes[i];
                         TreeNodeA subTn = new TreeNodeA();
                         subTn.Text            = node.Name;
                         subTn.Style           = new GridCellStyle();
                         subTn.Style.ForeColor = COLOR.ARGB(255, 255, 80);
                         subTn.Style.Font      = new FONT("微软雅黑", 14, true, false, false);
                         subTn.Name            = node.Id;
                         subTn.Tag             = node;
                         if (nodesMap.ContainsKey(node.ParentId))
                         {
                             nodesMap[node.ParentId].AppendNode(subTn);
                             nodesMap[node.Id] = subTn;
                         }
                         else
                         {
                             tn.AppendNode(subTn);
                             nodesMap[node.Id] = subTn;
                         }
                         IndicatorEntityDataPacket entity = new IndicatorEntityDataPacket(node.Id);
                         ConnectManager.CreateInstance().Request(entity);
                     }
                     tn.ExpendAll();
                     m_tvIndicatorBrowser.Update();
                     m_tvIndicatorBrowser.Invalidate();
                 }
             }
             else
             {
                 StringBuilder     sb         = new StringBuilder();
                 CList <GSecurity> securities = SecurityService.FilterCode(m_txtIndicatorCode.Text);
                 int codesSize = securities.size();
                 for (int i = 0; i < codesSize; i++)
                 {
                     sb.Append(securities.get(i).m_code);
                     if (i != codesSize - 1)
                     {
                         sb.Append(",");
                     }
                 }
                 m_gridIndicatorBrowser.ClearRows();
                 IndicatorRootData data = GetIndicatorData(nodeData.Id, "Stock", sb.ToString());
                 m_gridIndicatorBrowser.GetColumn("colN3").Text = data.categoryName;
                 foreach (IndicatorItemData indicatorItem in data.items)
                 {
                     GridRow row = new GridRow();
                     m_gridIndicatorBrowser.AddRow(row);
                     GridStringCell codeCell = new GridStringCell(indicatorItem.code);
                     row.AddCell("colN1", codeCell);
                     GSecurity security = new GSecurity();
                     SecurityService.GetSecurityByCode(indicatorItem.code, ref security);
                     row.AddCell("colN2", new GridStringCell(security.m_name));
                     if (indicatorItem.type == 0)
                     {
                         GridStringCell valueCell = new GridStringCell(indicatorItem.text);
                         row.AddCell("colN3", valueCell);
                     }
                     else if (indicatorItem.type == 1)
                     {
                         GridDoubleCell valueCell = new GridDoubleCell(indicatorItem.num);
                         row.AddCell("colN3", valueCell);
                     }
                     row.GetCell("colN1").Style           = new GridCellStyle();
                     row.GetCell("colN1").Style.ForeColor = COLOR.ARGB(255, 255, 80);
                     row.GetCell("colN1").Style.Font      = new FONT("微软雅黑", 14, true, false, false);
                     row.GetCell("colN1").Style.Font      = new FONT("微软雅黑", 14, true, false, false);
                     row.GetCell("colN2").Style           = new GridCellStyle();
                     row.GetCell("colN2").Style.ForeColor = COLOR.ARGB(255, 80, 80);
                     row.GetCell("colN2").Style.Font      = new FONT("微软雅黑", 14, true, false, false);
                     row.GetCell("colN3").Style           = new GridCellStyle();
                     row.GetCell("colN3").Style.ForeColor = COLOR.ARGB(80, 255, 255);
                     row.GetCell("colN3").Style.Font      = new FONT("微软雅黑", 14, true, false, false);
                 }
                 m_gridIndicatorBrowser.Update();
                 m_gridIndicatorBrowser.Invalidate();
             }
         }
     }
     else if (cell.Grid == m_gridIndicatorBrowser)
     {
         if (clicks == 2)
         {
             m_mainFrame.SearchSecurity(cell.Row.GetCell("colN1").GetString());
         }
     }
 }