public async Task <bool> AuthenticateAsync(string userName, string password) { var result = await UserDatabaseClient.AuthenticateUserAsync(userName, password); if (result != null) { UserCredential = result; IsAuthenticated = true; return(true); } else { UserCredential = new NetworkCredential(); IsAuthenticated = false; return(false); } }
//private ObservableCollection<SessionBase> sessions; //public ReadOnlyObservableCollection<SessionBase> Sessions => new ReadOnlyObservableCollection<SessionBase>(sessions); //private List<Season> ActiveSeasons { get; } = new List<Season>(); //private List<Schedule> ActiveSchedules { get; } = new List<Schedule>(); //private List<SessionBase> ActiveSessions { get; } = new List<SessionBase>(); public LeagueContext() : base() { var apiAddress = GetApiAddress(); var modelCache = new ModelCache(); var databaseStatusService = new DatabaseStatusService() { BaseUri = new Uri(apiAddress) }; var userDatabase = new UserDatabaseClient(new Uri(apiAddress)) { DatabaseStatusService = databaseStatusService }; UserCredentialsManager = new UserCredentialsManager(userDatabase); userDatabase.SetCredentials(UserCredentialsManager); MapperProfile = new ModelMapperProfile(modelCache); //DbContext = new DbLeagueServiceClient(new WCFLeagueDbClientWrapper()); //DbContext.OpenConnection(); //DbContext.SetDatabaseName(DatabaseName); LocationMapperProfile = new LocationMapperProfile(LocationCollection); MapperProfile.LeagueContext = this; memberList = new ObservableCollection <LeagueMember>(); MapperConfiguration = new MapperConfiguration(cfg => { cfg.AddProfile(MapperProfile); cfg.AddProfile(LocationMapperProfile); cfg.AddCollectionMappers(); }); seasons = new ObservableCollection <SeasonModel>(); ModelDatabase = new ASPRestAPIClientWrapper(new Uri(apiAddress), LeagueName, UserCredentialsManager) { DatabaseStatusService = databaseStatusService }; LeagueDataProvider = (ILeagueDataProvider)ModelDatabase; ModelContext = ModelDatabase; ModelManager = new ModelManager(modelCache, ModelContext, MapperConfiguration); UserManager = new UserManager(modelCache, UserCredentialsManager, userDatabase); TracksDataProvider = (ITracksDataProvider)ModelDatabase; //_ = UpdateMemberList(); }