Пример #1
0
        /// <summary>
        /// Called when activating.
        /// </summary>
        protected override void OnActivate()
        {
            this.HasCustomTradeSound = this._soundService.HasCustomTradeAlert();
            this.HasCustomItemSound  = this._soundService.HasCustomItemAlert();
            this.BuildManager.PopulateBuilds(this.SyncBuild);
            this._activateTask = Task.Run(async() =>
            {
                using (var service = new 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.ItemAlertVolume   = (int)(this._settingService.ItemAlertVolume * 100);
            this.JoinHideoutVolume = (int)(this._settingService.JoinHideoutVolume * 100);
            this.CheckForUpdate();
            base.OnActivate();

            this._activated = true;
        }
Пример #2
0
        /// <summary>
        /// Starts the trial.
        /// </summary>
        public async void StartTrial()
        {
            await this.ShowProgress("Hold on", "Preparing the trial...", async() =>
            {
                using (var service = new 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", SentryLevel.Info);
                }
            });
        }