Example #1
0
        private void GetOnLineState()
        {
            if (!this.Visible)
            {
                return;
            }

            if (!this.FormLoaded || (this.Busyness))
            {
                return;
            }

            if (this.tvOrganize.InvokeRequired)
            {
                SetGetOnLineState onLineState = this.GetOnLineState;
                this.Invoke(onLineState);
            }
            else
            {
                try
                {
                    var serviceInstance = new RDIFrameworkService();
                    var dataTable       = serviceInstance.MessageService.GetOnLineState(this.UserInfo);
                    CloseCommunicationObject(serviceInstance.MessageService);
                    if (this.tcMsg.SelectedTab == this.tpOrganize)
                    {
                        this.SetTreeViewOnLineState(dataTable, this.tvOrganize);
                    }
                    if (this.tcMsg.SelectedTab == this.tpRole)
                    {
                        this.SetTreeViewOnLineState(dataTable, this.tvRole);
                    }
                }
                catch (System.Exception ex)
                {
                    // 在本地记录异常
                    FileHelper.WriteException(UserInfo, ex);
                }
            }
        }
Example #2
0
 private void GetOnLineState()
 {
     if (!this.Visible)
     {
         return;
     }
     if (this.FormLoaded && (!this.Busyness))
     {
         if (this.tvOrganize.InvokeRequired)
         {
             SetGetOnLineState onLineState = new SetGetOnLineState(this.GetOnLineState);
             this.Invoke(onLineState);
         }
         else
         {
             try
             {
                 // DataTable dataTable = DotNetService.Instance.MessageService.GetOnLineState(UserInfo);
                 DotNetService dotNetService = new DotNetService();
                 DataTable dataTable = dotNetService.MessageService.GetOnLineState(this.UserInfo);
                 if (dotNetService.MessageService is ICommunicationObject)
                 {
                     ((ICommunicationObject)dotNetService.MessageService).Close();
                 }
                 if (this.tcMessage.SelectedTab == this.tpOrganize)
                 {
                     this.SetTreeViewOnLineState(dataTable, this.tvOrganize);
                 }
                 if (this.tcMessage.SelectedTab == this.tpApplicationRole)
                 {
                     this.SetTreeViewOnLineState(dataTable, this.tvApplicationRole);
                 }
                 if (this.tcMessage.SelectedTab == this.tpUserGroup)
                 {
                     this.SetTreeViewOnLineState(dataTable, this.tvUserGroup);
                 }
             }
             catch (System.Exception ex)
             {
                 // 在本地记录异常
                 FileUtil.WriteException(UserInfo, ex);
             }
         }
     }
 }