Ejemplo n.º 1
0
        /// <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;
        }
Ejemplo n.º 2
0
        /// <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;
                    }
                }
            });
        }
Ejemplo n.º 3
0
        /// <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;
        }
Ejemplo n.º 5
0
        /// <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);
                }
            });
        }