Esempio n. 1
0
        public Plugin()
        {
            this._watcher = new PackWatcher();
            this._updater = new Updater();

            try
            {
                this._history           = this._historyStorage.Fetch();
                this._averageCollection = new View.AverageCollection(this._history);
            }
            catch
            {
                this._history = new History();
            }

            try
            {
                this._settings = this._settingsStorage.Fetch();
            }
            catch
            {
                this._settings = new Settings();
            }

            this._pityTimers = new View.Cache.PityTimerRepository(this._history);

            //watcher
            this._watcher.PackOpened += (sender, e) =>
            {
                this._history.Add(e.Pack);
                this._historyStorage.Store(this._history.Ascending);

                if (this._settings.Spoil)
                {
                    var Average = this._averageCollection.FindForPackId(e.Pack.Id);
                    ToastManager.ShowCustomToast(new Controls.Toast(e.Pack, Average));
                }
            };

            this._watcher.PackScreenEntered += (sender, e) => { if (this._settings.PityOverlay)
                                                                {
                                                                    this._windows.ShowPityTimerOverlay(this._history, this._pityTimers);
                                                                }
            };
            this._watcher.PackScreenLeft += (sender, e) => this._windows.ClosePityTimerOverlay();
        }
 public void Show(UserControl toast)
 {
     ToastManager.ShowCustomToast(toast);
 }