示例#1
0
 /// <summary>
 /// To be called when the login dialog is closed after inputing login and password
 /// </summary>
 /// <param name="login">Login put by user</param>
 /// <param name="password">Password put by user</param>
 public void closeLoginDialog(string address, string login, string password, bool persist)
 {
     //Do something with credentials
     try
     {
         Config.Config config = Config.Config.getConfig();
         Config.Server server = new Config.Server(address, login, password, persist);
         _servers.Add(server);
         cbServers.ItemsSource   = null;
         cbServers.ItemsSource   = _servers;
         cbServers.SelectedIndex = _servers.Count - 1;
     } catch (FileNotFoundException ex)
     {
         MessageBox.Show("Há arquivos necessários faltando.", "Erro");
         openLoginDialog(this);
         if (_servers.Count == 0)
         {
             return;
         }
     } catch (WebException ex)
     {
         MessageBox.Show("Falha: " + ex.Message);
         openLoginDialog(this);
         if (_servers.Count == 0)
         {
             return;
         }
     } catch (Exceptions.InvalidLoginPasswordCombinationException ex)
     {
         MessageBox.Show(ex.Message);
         openLoginDialog(this);
         if (_servers.Count == 0)
         {
             return;
         }
     } catch (Exceptions.RedmineServerInaccessibleException ex)
     {
         MessageBox.Show(ex.Message);
         if (_servers.Count == 0)
         {
             return;
         }
     }
     //Shake me down. Not a lot of people left around.
     this.Show();
     _auth.Hide();
     reloadPage();
 }