コード例 #1
0
ファイル: User.xaml.cs プロジェクト: kongzhp/VDIUI
 private void connectServer()
 {
     try
     {
         this.Dispatcher.BeginInvoke(
             System.Windows.Threading.DispatcherPriority.Normal,
             (UpdateTheUI) delegate()
         {
             contentPanel.IsEnabled = false;
         });
         GetPoolResult res = serverChannel.getPoosWithAuth(IP, userName, pwd, domainID);
         this.Dispatcher.BeginInvoke(
             System.Windows.Threading.DispatcherPriority.Normal,
             (UpdateTheUI) delegate()
         {
             if (res == null)
             {
                 warningBlock.Text  = "* 账号或密码错误。";
                 warningBlock.Style = (Style)this.Resources["warningBoxStyle"];
             }
             else
             {
                 UserID = res.getUserId();
                 Plist  = res.getPoolList();
                 DesktopPools dpools = new DesktopPools(IP, UserID, userName, pwd, Plist, domainName, domainID);
                 this.NavigationService.Navigate(dpools);
             }
         });
     }
     catch (Exception ex)
     {
         logger.Error("为用户" + userName + "从" + IP + "处获取桌面池信息时产生错误:" + ex.Message);
         String           errorText = "登录超时或者产生错误,请确保网络连通,或联系网络管理员。";
         MessageBoxButton btn       = MessageBoxButton.OK;
         MessageBoxImage  img       = MessageBoxImage.Error;
         MessageBox.Show(errorText, "网络异常", btn, img);
     }
     finally
     {
         this.Dispatcher.BeginInvoke(
             System.Windows.Threading.DispatcherPriority.Normal,
             (UpdateTheUI) delegate()
         {
             contentPanel.IsEnabled = true;
             this.Cursor            = Cursors.Arrow;
         });
     }
 }
コード例 #2
0
ファイル: User.xaml.cs プロジェクト: kongzhp/VDIUI
        private void connectServer()
        {
            try
            {
                this.Dispatcher.BeginInvoke(
                    System.Windows.Threading.DispatcherPriority.Normal,
                    (UpdateTheUI)delegate()
                    {
                        contentPanel.IsEnabled = false;
                    });
                GetPoolResult res = serverChannel.getPoosWithAuth(IP, userName, pwd, domainID);
                this.Dispatcher.BeginInvoke(
                    System.Windows.Threading.DispatcherPriority.Normal,
                    (UpdateTheUI)delegate()
                    {
                        if (res == null)
                        {
                            warningBlock.Text = "* 账号或密码错误。";
                            warningBlock.Style = (Style)this.Resources["warningBoxStyle"];
                        }
                        else
                        {

                            UserID = res.getUserId();
                            Plist = res.getPoolList();
                            DesktopPools dpools = new DesktopPools(IP, UserID, userName, pwd, Plist, domainName, domainID);
                            this.NavigationService.Navigate(dpools);
                        }
                  });
            }
            catch (Exception ex)
            {
                logger.Error("为用户" + userName + "从" + IP + "处获取桌面池信息时产生错误:" + ex.Message);
                String errorText = "登录超时或者产生错误,请确保网络连通,或联系网络管理员。";
                MessageBoxButton btn = MessageBoxButton.OK;
                MessageBoxImage img = MessageBoxImage.Error;
                MessageBox.Show(errorText, "网络异常", btn, img);
            }
            finally
            {
                this.Dispatcher.BeginInvoke(
                    System.Windows.Threading.DispatcherPriority.Normal,
                    (UpdateTheUI)delegate()
                    {
                        contentPanel.IsEnabled = true;
                        this.Cursor = Cursors.Arrow;
                    });
            }
        }