void FormSelectMeetingMember_Load(object sender, EventArgs e)
        {

            Pub._pageControl._rowCount = 5;
            Pub._pageControl._columnCount = 4;
            Pub._pageControl.GetSingleControlSize();
            #region 手动增加空闲的手柄进待选的成员里

            //从原有的里面删除
            SingleUserControl scA = Pub._pageControl._lstBtn.Find(p => p.Number == _frmMain.cLeft.Number);
            if (scA != null)
            {
                Pub._pageControl._lstBtn.Remove(scA);
            }

            SingleUserControl scB = Pub._pageControl._lstBtn.Find(p => p.Number == _frmMain.cRight.Number);
            if (scB != null)
            {
                Pub._pageControl._lstBtn.Remove(scB);
            }

            if (_isRunning == true )
            {
              

                if (_frmMain.cLeft.UserLineStatus == TalkControl.EnumUserLineStatus.Idle)
                {
                    SingleUserControl sc = new SingleUserControl();
                    sc.CanSelect = true;
                    sc.Number = _frmMain.cLeft.Number;
                    sc.MemberName = _frmMain.cLeft.MemberName;

                    sc.UserLineStatus = TalkControl.EnumUserLineStatus.Idle;
                    sc.TellType = CommControl.PublicEnums.EnumTelType.固话;
                    sc.Click += new EventHandler(_frmMain.single_Click);

                    if (Pub._pageControl._lstBtn.Exists(p => p.Number == sc.Number) == false)
                    {
                        Pub._pageControl._lstBtn.Insert(0, sc);
                        Pub._pageControl.Init(Pub._pageControl._lstBtn);
                        sc.UserLineStatus = TalkControl.EnumUserLineStatus.Idle;
                    }
                }

               

                if (_frmMain.cRight.UserLineStatus == TalkControl.EnumUserLineStatus.Idle)
                {
                    SingleUserControl sc = new SingleUserControl();
                    sc.CanSelect = true;
                    sc.Number = _frmMain.cRight.Number;
                    sc.MemberName = _frmMain.cRight.MemberName;
                    sc.Click += new EventHandler(_frmMain.single_Click);
                    sc.UserLineStatus = TalkControl.EnumUserLineStatus.Idle;
                    sc.TellType = CommControl.PublicEnums.EnumTelType.固话;
                    if (Pub._pageControl._lstBtn.Exists(p => p.Number == sc.Number) == false)
                    {
                        Pub._pageControl._lstBtn.Insert(0, sc);
                        Pub._pageControl.Init(Pub._pageControl._lstBtn);
                        sc.UserLineStatus = TalkControl.EnumUserLineStatus.Idle;
                    }
                }
            }

            Pub._pageControl.FilterMemberForMeeting(EnumFilterType.CanMakeCall);
            #endregion

            if (Pub._pageControl.GetVisibleTrueCount() <= 0)
            {
                CommControl.MessageBoxEx.MessageBoxEx.Show("没有可选用户", "选择会议成员");
                this.DialogResult = System.Windows.Forms.DialogResult.No;
                this.Close();
            }
        }
        /// <summary>常规调度Trap消息使用</summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        public void UpdateState(object obj, TalkControl.UserStateArgs e)
        {
            foreach (NormalGroupModel item in _lstGroup)
            {
                _tempSingleControl = item.lstControl.Find(delegate(SingleUserControl p) { return p.Number == e.UserNumber; });
                if (_tempSingleControl != null)
                {
                    _tempSingleControl.UserLineStatus = e.UserLineStatus;
                    _tempSingleControl.UserRecordStatus = e.RecordStatus;
                    if (_tempSingleControl.UserRecordStatus == TalkControl.EnumRecordStatus.ON && e.PeerPartNumber == 0)//会议中的录音不更新对放名称
                    {
                        //
                    }
                    else
                    {
                        _tempSingleControl.PeerNumber = e.PeerPartNumber.ToString();
                    }
                    Pub.UpdateSingleUserContorlFont(_tempSingleControl);
                    if (_tempSingleControl.IsDispatch)
                    {
                        try
                        {
                            SingleUserControl scu = GetSingleControl(Convert.ToInt32(_tempSingleControl.PeerNumber));
                            if (scu != null)
                            {
                                _tempSingleControl.lblPeerNumberName.Text = scu.MemberName;
                            }
                            else
                            {
                                _tempSingleControl.lblPeerNumberName.Text = "";
                            }

                        }
                        catch (Exception)
                        {

                            //throw;
                        }
                    }
                    else
                    {
                        _tempSingleControl.lblPeerNumberName.Text = "";
                    }

                }
            }
        }
        /// <summary>加载用户</summary>
        /// <param name="frm"></param>
        private void LoadMember()
        {
            //2014-11-11修改i_Dispatch=0,只显示正常号码,调度号和视频调度号不显示
            List<DB_Talk.Model.m_Member> lstMember = new DB_Talk.BLL.m_Member().GetModelList(string.Format("i_Flag=0 and i_IsDispatch=0 and BoxID={0} order by id",Pub.manageModel.BoxID.Value));

            //if (lstMember.Count == 0)
            //{
            //    CommControl.MessageBoxEx.MessageBoxEx.Show("请先到网管软件增加用户","提示");
            //    Application.Exit();
            //}

            PageControl pControl = new PageControl();
            _mainForm.superTabControlPanel5.Controls.Add(pControl);
            
            NormalGroupModel gModel = new NormalGroupModel();
            _lstGroup.Add(gModel);
            foreach (DB_Talk.Model.m_Member item in lstMember)
            {
                SingleUserControl s = new SingleUserControl();
                if (item.vc_Name!=null)
                {
                    s.MemberName = item.vc_Name.ToString();    
                }
                
                s.Number = item.i_Number.Value;
                s.ID = item.ID;
                if (item.LevelID!=null)
                {
                    s.MemberLevel = item.LevelID.Value;    
                }
                if (item.DepartmentID!=null)
                {
                    s.DepartmentID = item.DepartmentID.Value;
                }

                if (item.i_TellType != null )
                {
                    s.TellType = (CommControl.PublicEnums.EnumTelType)item.i_TellType.Value;
                }

                s.BackColor = Color.BlueViolet;
                if (s.Number != Pub.manageModel.LeftDispatchNumber.Value && s.Number != Pub.manageModel.RightDispatchNumber.Value)
                {
                    gModel.lstControl.Add(s);
                    s.Click += new EventHandler(_mainForm.single_Click);
                }
                else
                {

                }
            }

            gModel.PageControl = pControl;
            pControl.Init(gModel.lstControl);
            pControl.Dock = DockStyle.Fill;

            NormalGroupModel dispatchsModel = new NormalGroupModel();
            _lstGroup.Add(dispatchsModel);
            if (Pub.manageModel.LeftDispatchNumber!=null)
            {
                _mainForm.cLeft.Number = Pub.manageModel.LeftDispatchNumber.Value;
                _mainForm.cLeft.UserLineStatus = TalkControl.EnumUserLineStatus.Offline;
            }
            
            //_mainForm.cLeft.Name = "左席";
            _mainForm.cLeft.MemberName = Pub.manageModel.LeftDispatchName;
            _mainForm.cLeft.IsDispatch = true;

            dispatchsModel.lstControl.Add(_mainForm.cLeft);

            if (Pub.manageModel.RightDispatchNumber!=null)
            {
                _mainForm.cRight.Number = Pub.manageModel.RightDispatchNumber.Value;
                _mainForm.cRight.UserLineStatus = TalkControl.EnumUserLineStatus.Offline;
            }
            
            //_mainForm.cRight.Name = "右席";
            _mainForm.cRight.MemberName = Pub.manageModel.RightDispatchName;
            _mainForm.cRight.IsDispatch = true;
            dispatchsModel.lstControl.Add(_mainForm.cRight);
            Pub.SetSupperTabColor(_mainForm.stiAllMember);
        }
        /// <summary>加载分组用户</summary>
        private void LoadGroupMember()
        {
            List<DB_Talk.Model.m_Group> lstGroup = new DB_Talk.BLL.m_Group().GetModelList(string.Format("i_Flag=0 and groupTypeID={0} and BoxID={1}", PublicEnums.EnumGroupType.Normal.GetHashCode(),Pub.manageModel.BoxID.Value));
            int index = 1;//因为前面已加过两个了
            foreach (DB_Talk.Model.m_Group item in lstGroup)
            {
                index++;
                 NormalGroupModel gModel = new NormalGroupModel();
                 _lstGroup.Add(gModel);
                SuperTabItem a = new SuperTabItem();
                a.Text = item.vc_Name;
                a.SelectedTabFont = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Bold);
                superTabLinearGradientColorTable1.Colors = new System.Drawing.Color[] {
        System.Drawing.Color.FromArgb(((int)(((byte)(36)))), ((int)(((byte)(41)))), ((int)(((byte)(48))))),
        System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(113)))), ((int)(((byte)(130)))))};
                superTabItemStateColorTable1.Background = superTabLinearGradientColorTable1;
                superTabColorStates1.Selected = superTabItemStateColorTable1;
                superTabItemColorTable1.Bottom = superTabColorStates1;
                a.TabColor = superTabItemColorTable1;
                a.Tag = index;
                a.Click += new EventHandler(_mainForm.MemberTabItem_Click);

                Pub.SetSupperTabColor(a);

                _mainForm.superTabControlDispatch.Tabs.Add(a);


                SuperTabControlPanel sp = new SuperTabControlPanel();
                _mainForm.superTabControlDispatch.Controls.Add(sp);
                a.AttachedControl = sp;
                

                PageControl fp = new PageControl();
                sp.Controls.Add(fp);
                fp.Dock = DockStyle.Fill;

                gModel.PageControl = fp;
                List<DB_Talk.Model.v_GroupMembers> lstGroupMember = new DB_Talk.BLL.v_GroupMembers().GetModelList("groupid=" + item.ID);
                foreach (DB_Talk.Model.v_GroupMembers gItem in lstGroupMember)
                {
                    if (gItem.i_Number.Value != Pub.manageModel.LeftDispatchNumber.Value && gItem.i_Number.Value != Pub.manageModel.RightDispatchNumber.Value )
                    {
                        SingleUserControl sc = new SingleUserControl();
                        sc.MemberName = gItem.vc_Name;
                        sc.Number = gItem.i_Number.Value;
                        sc.ID = gItem.MemberID.Value;
                        if (gItem.DepartmentID!=null)
                        {
                            sc.DepartmentID = gItem.DepartmentID.Value;    
                        }

                        if (gItem.i_TellType != null)
                        {
                            sc.TellType = (CommControl.PublicEnums.EnumTelType)gItem.i_TellType.Value;
                        }

                        gModel.lstControl.Add(sc);
                        sc.Click += new EventHandler(_mainForm.single_Click);
                    }
                }
                fp.Init(gModel.lstControl);
            }
        }
Beispiel #5
0
        /// <summary>
        /// 更新控件的字体大小,行间距
        /// </summary>
        /// <param name="sc"></param>
        public static void UpdateSingleUserContorlFont(SingleUserControl sc)
        {
            if (Pub.CanSetFontConfig)
            {
                sc.lblSelfName.AutoSize = true;
                sc.lblSelfName.BringToFront();
                sc.Top = Pub.LableFontConfig.NumberNameTop;
                sc.lblSelfName.Font = new System.Drawing.Font("宋体", Pub.LableFontConfig.NumberNameFontSize, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));// new Font("宋体", fontSize, FontStyle.Bold);
                if (sc.lblSelfName.Width > sc.Width)
                {
                    sc.lblSelfName.Left = 0;
                }
                else
                {
                    //居中显示 
                    sc.lblSelfName.Left = (sc.Width - sc.lblSelfName.Width) / 2;
                }

                sc.lblSelfNumber.AutoSize = true;
                sc.lblSelfNumber.Font = new System.Drawing.Font("宋体", Pub.LableFontConfig.NumberNameFontSize, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));// new Font("宋体", fontSize, FontStyle.Bold);
                sc.lblSelfNumber.Top = sc.lblSelfName.Top + sc.lblSelfName.Height + Pub.LableFontConfig.NumberNameInteval;
                sc.lblSelfNumber.Left = (sc.Width - sc.lblSelfNumber.Width) / 2;

                sc.lblPeerNumber.AutoSize = true;
                // _lstBtn[i].lblPeerNumber.SendToBack();
                sc.lblPeerNumber.Font = new System.Drawing.Font("宋体", Pub.LableFontConfig.NumberNameFontSize, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));// new Font("宋体", fontSize, FontStyle.Bold);
                sc.lblPeerNumber.Top = sc.lblSelfNumber.Top + sc.lblSelfNumber.Height + Pub.LableFontConfig.NumberNameInteval;
                sc.lblPeerNumber.Left = (sc.Width - sc.lblPeerNumber.Width) / 2;

                if (sc.IsDispatch)
                {
                    sc.lblSelfName.AutoSize = true;
                    sc.lblSelfName.Font = new System.Drawing.Font("宋体", 15, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));// new Font("宋体", fontSize, FontStyle.Bold);
                    sc.lblSelfName.Left = (sc.Width - sc.lblSelfName.Width) - 6;


                    sc.lblPeerNumber.AutoSize = true;
                    sc.lblPeerNumber.Font = new System.Drawing.Font("宋体", 14, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));// new Font("宋体", fontSize, FontStyle.Bold);
                    sc.lblPeerNumber.Left = (sc.Width - sc.lblPeerNumber.Width) - 6;
                    sc.lblPeerNumber.Top = sc.lblSelfName.Top + sc.lblSelfName.Height + 3;

                    sc.lblPeerNumberName.AutoSize = true;
                    sc.lblPeerNumberName.Font = new System.Drawing.Font("宋体", 14, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));// new Font("宋体", fontSize, FontStyle.Bold);
                    sc.lblPeerNumberName.Left = (sc.Width - sc.lblPeerNumberName.Width) - 6;
                    sc.lblPeerNumberName.Top = sc.lblPeerNumber.Top + sc.lblPeerNumber.Height + 3;
                }
            }
        }
        /// <summary>增加会议分组</summary>
        public void AddMeetingGroup(MeetingGroupModel.EnumMeetingState meetingState, DispatchPlatform.MeetingGroupModel.EnumMeetingType meetingType, int groupID, int meetingID, string meetingGroupName, List<DB_Talk.Model.m_Member> lstMembers, long dispatchNumber, bool tabVisible)
        {
            foreach (SuperTabItem item in _mainForm.superTabControlMeeting.Tabs)
            {
                MeetingGroupModel model = (MeetingGroupModel)item.Tag;
                if (model.GroupName == meetingGroupName || lstMembers.Count==0)
                {
                    return;
                }
            }


            SuperTabItem tabItem = new SuperTabItem();
            
            tabItem.GlobalItem = false;
            tabItem.SelectedTabFont = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold);
            superTabLinearGradientColorTable1.Colors = new System.Drawing.Color[] {
        System.Drawing.Color.FromArgb(((int)(((byte)(36)))), ((int)(((byte)(41)))), ((int)(((byte)(48))))),
        System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(113)))), ((int)(((byte)(130)))))};
            superTabItemStateColorTable1.Background = superTabLinearGradientColorTable1;
            superTabColorStates1.Selected = superTabItemStateColorTable1;
            superTabItemColorTable1.Bottom = superTabColorStates1;
            tabItem.TabColor = superTabItemColorTable1;
            
            tabItem.Text = meetingGroupName;


            Pub.SetSupperTabColor(tabItem);

            tabItem.Click += new EventHandler(_mainForm.MeetingTabItem_Click);

            MeetingGroupModel mModel = new MeetingGroupModel();
            
            mModel.MeetingState = meetingState;
            mModel.MeetingID = meetingID;
            mModel.GroupID = groupID;
            mModel.GroupName = meetingGroupName;
            mModel.MeetingType = meetingType;
            mModel.DispatchNumber = dispatchNumber;
            tabItem.Tag = mModel;

            _lstGroup.Add(mModel);

           
            _mainForm.superTabControlMeeting.Tabs.Add(tabItem);

            _mainForm.superTabControlMeeting.SelectedTab = tabItem;
            SuperTabControlPanel sp = new SuperTabControlPanel();

            tabItem.Visible = tabVisible;

            _mainForm.superTabControlMeeting.Controls.Add(sp);
            tabItem.AttachedControl = sp;

            //_lstGroup.Add(mModel);
            PageControl pControl = new PageControl();
            mModel.pageControl = pControl;
            pControl.Dock = DockStyle.Fill;
            sp.Controls.Add(pControl);
            
            foreach (DB_Talk.Model.m_Member item in lstMembers)
            {
                if (item.i_Number != Pub.manageModel.LeftDispatchNumber.Value && item.i_Number != Pub.manageModel.RightDispatchNumber.Value)
                {
                    SingleUserControl sc = new SingleUserControl();

                    sc.Number = item.i_Number.Value;
                    sc.MemberName = item.vc_Name;
                    sc.ID = item.ID;
                    if (item.DepartmentID!=null)
                    {
                        sc.DepartmentID = item.DepartmentID.Value;    
                    }

                    if (item.i_TellType != null)
                    {
                        sc.TellType = (CommControl.PublicEnums.EnumTelType)item.i_TellType.Value;
                        if (item.i_TellType.Value==0)
                        {
                            sc.TellType = PublicEnums.EnumTelType.WiFi手机;
                        }
                    }
                    else
                    {
                        sc.TellType = PublicEnums.EnumTelType.WiFi手机;
                    }

                    if (meetingType == MeetingGroupModel.EnumMeetingType.Temp)
                    {
                        sc.PeerNumber = meetingGroupName;
                        sc.UserLineStatus = Pub._memberManage.GetMemberState(item.i_Number.Value);
                    }

                    mModel.lstControl.Add(sc);
                    sc.Click += new EventHandler(_mainForm.single_Click);
                }
            }
            if (meetingType == MeetingGroupModel.EnumMeetingType.Temp)
            {
                mModel.DispatchNumber = dispatchNumber;
                tabItem.RaiseClick();
            }
            pControl.Init(mModel.lstControl);
        }
 /// <summary>增加会议成员</summary>
 public void AddMeetingMember(int meetingDBID, int meetingID, long memberID,string groupName)
 {
     foreach (SuperTabItem item in _mainForm.superTabControlMeeting.Tabs)
     {
         MeetingGroupModel model = (MeetingGroupModel)item.Tag;
         //if (model.GroupID == meetingDBID || model.MeetingID == meetingID)
         if ( model.MeetingID == meetingID && model.GroupName==groupName)
         {
             SingleUserControl ss = new SingleUserControl();
             SingleUserControl sc = Pub._memberManage.GetSingleControl(memberID);
             if (sc != null)
             {
                 ss.Number = sc.Number;
                 ss.MemberName = sc.MemberName;
                 ss.TellType = sc.TellType;
                 ss.UserLineStatus = sc.UserLineStatus;
                 
                 if (model.MeetingState== MeetingGroupModel.EnumMeetingState.Running)
                 {
                   //  ss.PeerNumber = groupName;    
                 }
                 ss.DepartmentID = sc.DepartmentID;
                 if (model.lstControl.Exists(delegate(SingleUserControl c) { return c.Number == sc.Number; }) == false)
                 {
                     model.lstControl.Add(ss);
                 }
                 ss.Click += new EventHandler(_mainForm.single_Click);
                 Pub.CanDestroyControl = false;
                 model.pageControl.Init(model.lstControl);
                 Pub.CanDestroyControl = true;
             }
             
             _mainForm.superTabControlMeeting.SelectedTab = item;
            
             break;
         }
     }
 }
        /// <summary>更新会议成员状态</summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        public void UpdateMeeting(object obj, TalkControl.UserStateArgs e)
        {
            for (int i = 0; i < _lstGroup.Count; i++)
            {
                
            //}
            //foreach (MeetingGroupModel item in _lstGroup)
            //{
                _tempSingleControl = _lstGroup[i].lstControl.Find(delegate(SingleUserControl p) { return p.Number == e.UserNumber; });
                if (_tempSingleControl != null)
                {
                    _tempSingleControl.UserLineStatus = e.UserLineStatus;

                    _tempSingleControl.UserRecordStatus = e.RecordStatus;
                    if (_tempSingleControl.UserRecordStatus == TalkControl.EnumRecordStatus.ON && e.PeerPartNumber == 0)//会议中的录音不更新对放名称
                    {
                        //
                    }
                    else
                    {
                        _tempSingleControl.PeerNumber = e.PeerPartNumber.ToString();
                    }
                    Pub.UpdateSingleUserContorlFont(_tempSingleControl);
                }
            }
        }