Beispiel #1
0
        /// <summary>
        /// 加载XML
        /// </summary>
        /// <param name="xmlPath">XML路径</param>
        public override void Load(String xmlPath)
        {
            LoadFile(xmlPath, null);
            DataCenter.MainUI = this;
            ControlA control = Native.GetControls()[0];

            control.BackColor = COLOR.CONTROL;
            RegisterEvents(control);
            m_jiras.Clear();
            //从服务端拿取数据
            m_jiras             = XmlHandle.GetJiras();
            this.m_gridDgvTable = GetGrid("dgvTable");

            //注册事件,这样可以在一个自定义方法里监听
            m_gridDgvTable.RegisterEvent(new ControlTimerEvent(TimerEvent), EVENTID.TIMER);
            m_timerID = ControlA.GetNewTimerID();
            m_gridDgvTable.StartTimer(m_timerID, 1000);
            int size = m_jiras.Count;

            for (int i = 0; i < size; i++)
            {
                Jira jira = m_jiras[i];
                AddOrUpdate(jira);//添加一行
            }
            //刷新界面
            m_gridDgvTable.Invalidate();
        }
Beispiel #2
0
 /// <summary>
 /// 添加控件方法
 /// </summary>
 public override void OnLoad()
 {
     base.OnLoad();
     if (m_grid == null)
     {
         m_grid = new GridA();
         m_grid.AutoEllipsis  = true;
         m_grid.GridLineColor = COLOR.EMPTY;
         m_grid.Size          = new SIZE(240, 200);
         m_grid.RegisterEvent(m_gridCellClickEvent, EVENTID.GRIDCELLCLICK);
         m_grid.RegisterEvent(m_gridKeyDownEvent, EVENTID.KEYDOWN);
         AddControl(m_grid);
         m_grid.BeginUpdate();
         //添加列
         GridColumn securityCodeColumn = new GridColumn("股票代码");
         securityCodeColumn.BackColor   = CDraw.PCOLORS_BACKCOLOR;
         securityCodeColumn.BorderColor = COLOR.EMPTY;
         securityCodeColumn.Font        = new FONT("Simsun", 14, true, false, false);
         securityCodeColumn.ForeColor   = CDraw.PCOLORS_FORECOLOR;
         securityCodeColumn.TextAlign   = ContentAlignmentA.MiddleLeft;
         securityCodeColumn.Width       = 120;
         m_grid.AddColumn(securityCodeColumn);
         GridColumn securityNameColumn = new GridColumn("股票名称");
         securityNameColumn.BackColor   = CDraw.PCOLORS_BACKCOLOR;
         securityNameColumn.BorderColor = COLOR.EMPTY;
         securityNameColumn.Font        = new FONT("Simsun", 14, true, false, false);
         securityNameColumn.ForeColor   = CDraw.PCOLORS_FORECOLOR;
         securityNameColumn.TextAlign   = ContentAlignmentA.MiddleLeft;
         securityNameColumn.Width       = 110;
         m_grid.AddColumn(securityNameColumn);
         m_grid.EndUpdate();
     }
     if (m_searchTextBox == null)
     {
         m_searchTextBox          = new TextBoxA();
         m_searchTextBox.Location = new POINT(0, 200);
         m_searchTextBox.Size     = new SIZE(240, 20);
         m_searchTextBox.Font     = new FONT("SimSun", 16, true, false, false);
         m_searchTextBox.RegisterEvent(m_textBoxInputChangedEvent, EVENTID.TEXTCHANGED);
         m_searchTextBox.RegisterEvent(m_textBoxKeyDownEvent, EVENTID.KEYDOWN);
         AddControl(m_searchTextBox);
     }
 }
Beispiel #3
0
        public static extern bool SetForegroundWindow(IntPtr hWnd);//设置此窗体为活动窗体

        /// <summary>
        /// 加载XML
        /// </summary>
        /// <param name="xmlPath">XML路径</param>
        public override void Load(String xmlPath)
        {
            LoadFile(xmlPath, null);
            DataCenter.MainUI   = this;
            m_mainDiv           = Native.GetControls()[0] as DivA;
            m_mainDiv.BackColor = COLOR.CONTROL;
            ControlPaintEvent paintLayoutEvent = new ControlPaintEvent(PaintLayoutDiv);

            m_mainDiv.RegisterEvent(paintLayoutEvent, EVENTID.PAINT);
            m_mainDiv.RegisterEvent(new ControlInvokeEvent(Invoke), EVENTID.INVOKE);
            DataCenter.ServerChatService.RegisterListener(DataCenter.ChatRequestID, new ListenerMessageCallBack(ChatMessageCallBack));
            m_gridHosts = GetGrid("gridHosts");
            m_gridHosts.GridLineColor = COLOR.CONTROLBORDER;
            GridRowStyle rowStyle = new GridRowStyle();

            rowStyle.HoveredBackColor  = CDraw.PCOLORS_HOVEREDROWCOLOR;
            rowStyle.SelectedBackColor = CDraw.PCOLORS_SELECTEDROWCOLOR;
            rowStyle.SelectedForeColor = CDraw.PCOLORS_FORECOLOR4;
            rowStyle.Font        = new FONT("微软雅黑", 12, false, false, false);
            m_gridHosts.RowStyle = rowStyle;
            GridRowStyle alternateRowStyle = new GridRowStyle();

            alternateRowStyle.BackColor         = CDraw.PCOLORS_ALTERNATEROWCOLOR;
            alternateRowStyle.HoveredBackColor  = CDraw.PCOLORS_HOVEREDROWCOLOR;
            alternateRowStyle.SelectedBackColor = CDraw.PCOLORS_SELECTEDROWCOLOR;
            alternateRowStyle.SelectedForeColor = CDraw.PCOLORS_FORECOLOR4;
            alternateRowStyle.Font        = new FONT("微软雅黑", 12, false, false, false);
            m_gridHosts.AlternateRowStyle = alternateRowStyle;
            m_gridGroups                   = GetGrid("gridGroups");
            m_gridGroups.RowStyle          = rowStyle;
            m_gridGroups.AlternateRowStyle = alternateRowStyle;
            m_gridGroups.RegisterEvent(new GridCellMouseEvent(GridCellClick), EVENTID.GRIDCELLCLICK);
            RegisterEvents(m_mainDiv);
            //全节点服务器
            if (DataCenter.IsFull)
            {
                DataCenter.UserID   = DataCenter.HostInfo.m_localHost + ":" + CStr.ConvertIntToStr(DataCenter.HostInfo.m_localPort);
                DataCenter.UserName = DataCenter.UserID;
                Thread thread = new Thread(new ThreadStart(StartConnect));
                thread.Start();
            }
            else
            {
                UserCookie cookie = new UserCookie();
                if (DataCenter.UserCookieService.GetCookie("USERINFO2", ref cookie) > 0)
                {
                    String[] strs = cookie.m_value.Split(new String[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    GetTextBox("txtPhone").Text    = strs[0];
                    GetTextBox("txtUserName").Text = strs[1];
                    GetTextBox("txtPort").Text     = strs[2];
                }
            }
            m_chatGroups = ChatGroup.ReadGroups();
            BindGroups();
        }