private void BracketSynchro() { BracketApi api = Activator.CreateInstance(Configuration.Instance.Bracket.Api, Configuration.Instance.Bracket) as BracketApi; List <Player> list = api.GetAllEntrants(); foreach (Player player in list) { PlayerDatabase.UpdateOrAddPlayer(player); } }
private void RefreshApiLink() { try { _api = Activator.CreateInstance(Configuration.Instance.Bracket.Api, Configuration.Instance.Bracket) as BracketApi; } catch (Exception e) { // api not set } }
private void InitializeBracketApiList() { Type[] apis = Assembly.GetExecutingAssembly().GetTypes().Where((t) => t.IsSubclassOf(typeof(BracketApi))).ToArray(); ApiList = new ObservableCollection <string>(); foreach (var type in apis) { BracketSettings s = new BracketSettings(); BracketApi a = Activator.CreateInstance(type, s) as BracketApi; ApiList.Add(a.ApiName); if (type == Configuration.Instance.Stream?.GetType()) { SelectedApi = ApiList.Count - 1; } } }
private void InitializeApiLink() { try { _refreshInfo.Stop(); IsInitialized = false; _apiLink = Activator.CreateInstance(Configuration.Instance.Bracket.Api, Configuration.Instance.Bracket) as BracketApi; Log.Trace("API Link succesfully created"); IsConfigured = true; _refreshInfo.Start(); } catch { Log.Warn("API Link not created. Probably wrong configuration"); IsConfigured = false; } }