Exemple #1
0
 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;
         });
     }
 }
Exemple #2
0
 private void refreshPools()
 {
     try {
         this.Dispatcher.BeginInvoke(
             System.Windows.Threading.DispatcherPriority.Normal,
             (UpdateTheUI) delegate()
         {
             contentPanel.IsEnabled = false;
         });
         GetPoolResult res = serverChannel.getPoosWithAuth(ServerIP, UserName, Password, domainID);
         this.Dispatcher.BeginInvoke(
             System.Windows.Threading.DispatcherPriority.Normal,
             (UpdateTheUI) delegate()
         {
             if (res == null)
             {
                 logger.Error("刷新桌面池时验证失败,即用户名或密码不正确");
                 String errorText     = "验证失败,请检查用户是否已经被撤销,或者密码有无被更改,并尝试重新登录!";
                 MessageBoxButton btn = MessageBoxButton.OK;
                 MessageBoxImage img  = MessageBoxImage.Error;
                 System.Windows.MessageBox.Show(errorText, "验证失败", btn, img);
             }
             else
             {
                 poolListBox.ItemsSource = res.getPoolList().getPools();
             }
         });
     }
     catch (Exception ex)
     {
         logger.Error("更新桌面池信息时产生错误:" + ex.Message);
         String           errorText = "更新桌面池超时或者产生错误,请确保网络连通,或联系网络管理员。";
         MessageBoxButton btn       = MessageBoxButton.OK;
         MessageBoxImage  img       = MessageBoxImage.Error;
         System.Windows.MessageBox.Show(errorText, "网络异常", btn, img);
     }
     finally
     {
         this.Dispatcher.BeginInvoke(
             System.Windows.Threading.DispatcherPriority.Normal,
             (UpdateTheUI) delegate()
         {
             contentPanel.IsEnabled = true;
             this.Cursor            = System.Windows.Input.Cursors.Arrow;
         });
     }
 }