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(); }