Esempio n. 1
0
 public LoginViewModel(
     ServerCredentialsModel serverCredentials,
     Action connectCallback)
 {
     this.serverCredentials = serverCredentials;
     serverCredentials.PropertyChanged += ServerCredentialsPropertyChanged;
     connectCommand = new DelegateCommand(
         connectCallback,
         serverCredentials.IsValid);
     connectCommandViewModel = new CommandViewModel("_Login", connectCommand);
 }
 public MainWindowViewModel()
 {
     List<ServerCredentialsModel> credentials = null;
     if (File.Exists(ServerFile))
     {
         credentials = new Serializer<List<ServerCredentialsModel>>().Load(ServerFile);
     }
     if (credentials == null || credentials.Count == 0)
     {
         // if no servers have been saved, create some default setting
         var newCredentials = new ServerCredentialsModel
         {
             Url = "teamcity.codebetter.com",
             Guest = true
         };
         Activity = new LoginViewModel(newCredentials, ConnectExecuted);
     }
     else
     {
         ShowServerOverview(credentials[0]);
     }
 }
 private void ShowServerOverview(ServerCredentialsModel credentials)
 {
     artifactDownloader = new InteractiveArtifactDownloader(
         credentials.CreateClient(), worker);
     Activity = new ServerOverviewViewModel(
         new DataProvider(
             credentials.CreateClient(),
             worker),
         artifactDownloader,
         folderSelector);
 }