/// <summary> /// Logins to patreon. /// </summary> public async void LoginToPatreon() { if (this._currentPatreonService != null) { this._currentPatreonService.Cancel(); await Task.Delay(600); } try { using (this._currentPatreonService = new Patreon.PatreonService()) { if (!this._currentPatreonService.IsConnected) { await this._currentPatreonService.Login(); } this.Pledging = await this._currentPatreonService.IsPledging(); if (this.Pledging) { this.SearchEnabled = true; this.DashboardEnabled = true; } this.NotifyOfPropertyChange("NotConnected"); } } catch (AuthenticationException) { } }
/// <summary> /// Called when activating. /// </summary> protected async override void OnActivate() { if (!this.NotConnected) { try { using (var service = new Patreon.PatreonService()) { this.Pledging = await service.IsPledging(); } } catch { } } else { this.Pledging = false; } if (!this.Pledging) { this.SearchEnabled = false; this.DashboardEnabled = false; } this.AlertVolume = (int)(this._settingService.AlertVolume * 100); this.JoinHideoutVolume = (int)(this._settingService.JoinHideoutVolume * 100); this.CheckForUpdate(); base.OnActivate(); this._activated = true; }
/// <summary> /// Initializes a new instance of the <see cref="SplashscreenViewModel" /> class. /// </summary> /// <param name="settings">The settings.</param> /// <param name="eventAggregator">The event aggregator.</param> public SplashscreenViewModel(SettingsViewModel settings, IEventAggregator eventAggregator) { this._settings = settings; this._eventAggrator = eventAggregator; if (!AssetService.Exists(LottieFileName)) { AssetService.Create(LottieFileName, GetResourceContent(LottieFileName)); } Execute.OnUIThread(async() => { using (var service = new Patreon.PatreonService()) { var result = await service.IsPledging(); if (result) { return; } this.TrialAvailable = service.TrialAvailable; if (!this.TrialAvailable) { this.ShowPatreon = true; } } }); }
/// <summary> /// Called when activating. /// </summary> protected async override void OnActivate() { if (!this.NotConnected) { using (var service = new Patreon.PatreonService()) { this.Pledging = await service.IsPledging(); } } else { this.Pledging = false; } this.AlertVolume = (int)(this._settingService.AlertVolume * 100); this.CheckForUpdate(); base.OnActivate(); }
/// <summary> /// Called when activating. /// </summary> protected override void OnActivate() { this.HasCustomTradeSound = this._soundService.HasCustomTradeAlert(); this.BuildManager.PopulateBuilds(this.SyncBuild); this._activateTask = Task.Run(async() => { using (var service = new Patreon.PatreonService()) { this.Pledging = await service.IsPledging(); if (!this.Pledging) { this.TrialAvailable = service.TrialAvailable; this.SearchEnabled = false; this.DashboardEnabled = false; this.MapEnabled = false; } else { if (service.IsTrialValid()) { var time = service.GetTrialRemainingTime(); this.BlessingText = GetBlessingText(time); } else { this.BlessingText = "A blessing I can’t deny"; } } } }); this.AlertVolume = (int)(this._settingService.AlertVolume * 100); this.JoinHideoutVolume = (int)(this._settingService.JoinHideoutVolume * 100); this.CheckForUpdate(); base.OnActivate(); this._activated = true; }
/// <summary> /// Logins to patreon. /// </summary> public async void LoginToPatreon() { if (this._currentPatreonService != null) { this._currentPatreonService.Cancel(); await Task.Delay(600); } try { using (this._currentPatreonService = new Patreon.PatreonService()) { if (!this._currentPatreonService.IsConnected) { await this._currentPatreonService.Login(); } this.Pledging = await this._currentPatreonService.IsPledging(); if (this.Pledging) { this.TrialAvailable = false; var time = this._currentPatreonService.GetTrialRemainingTime(); this.BlessingText = GetBlessingText(time); this.SearchEnabled = true; this.MapEnabled = true; this.DashboardEnabled = true; } this.NotifyOfPropertyChange("NotConnected"); } } catch (AuthenticationException) { } }
/// <summary> /// Starts the trial. /// </summary> public async void StartTrial() { await this.ShowProgress("Hold on", "Preparing the trial...", async() => { using (var service = new Patreon.PatreonService()) { service.StartTrial(); var pledging = await service.IsPledging(); if (pledging) { this.SearchEnabled = true; this.DashboardEnabled = true; var time = service.GetTrialRemainingTime(); this.BlessingText = GetBlessingText(time); } this.TrialAvailable = false; this.Pledging = pledging; SentrySdk.CaptureMessage("New Trial", Sentry.Protocol.SentryLevel.Info); } }); }