private async Task ConnectAsync() { try { var configuration = new RegistryClientConfiguration(Registry); AuthenticationProvider authenticationProvider; if (IsAnonymous) { authenticationProvider = new AnonymousOAuthAuthenticationProvider(); } else { authenticationProvider = new PasswordOAuthAuthenticationProvider(Username, Password); } var client = configuration.CreateClient(authenticationProvider); await client.System.PingAsync(); var connection = new RegistryConnection(client, Registry, IsAnonymous, Username, Password); Connection = connection; //Save the connections! Save(); RequestClose(true); } catch (Exception ex) { MessageBox.Show(ex.Message, "Unable to connect"); } }
public RegistryExplorerViewModel(RegistryConnection connection) { _connection = connection ?? throw new ArgumentNullException(nameof(connection)); DeleteCommand = new RelayCommand(Delete, CanDelete); RefreshCommand = new RelayCommand(Refresh, CanRefresh); LoadRepositoryCommand = new RelayCommand(LoadRepository, CanLoadRepository); CopyCommand = new RelayCommand(Copy, CanCopy); }
public static AuthConfig GetAuthConfig(this RegistryConnection registryConnection) { if (registryConnection.IsAnonymous) { return(new AuthConfig()); } return(new AuthConfig() { Username = registryConnection.Username, Password = registryConnection.Password }); }
public RegistryCopyViewModel(RegistryConnection sourceRegistryConnection, TagModel[] tags) { _sourceRegistryConnection = sourceRegistryConnection; Tags = new TagViewModel[] {}; CopyCommand = new RelayCommand(Copy, CanCopy); ChooseDockerConnectionCommand = new RelayCommand(() => ChooseDockerConnectionAsync().IgnoreAsync()); ChooseTargetRegistryConnectionCommand = new RelayCommand(() => ChooseTargetRegistryConnectionAsync().IgnoreAsync()); Tags = tags .Select(t => new TagViewModel(t)) .ToArray(); }
public RepositoryViewModel(RegistryConnection connection, string name) { _connection = connection; Name = name; }