Ejemplo n.º 1
0
        public AccountModel()
        {
            _pricesUpdater          = new PricesUpdater();
            _updater                = new AccountUpdater(this, _pricesUpdater);
            _idler                  = new IdleManager(this);
            _showcaseManager        = new ShowcaseManager();
            _updater.BadgeListSync += SyncShowcases;

            AllBadges       = new ObservableCollection <BadgeModel>();
            IdleQueueBadges = new ObservableCollection <BadgeModel>();
            Games           = new ObservableCollection <BadgeModel> {
                new BadgeModel("-1", "new", "0", "0")
            };
            AllShowcases = new ObservableCollection <BadgeShowcase>();

            #region Commands
            LoginCmd  = new BaseCommand(_ => Login());
            LogoutCmd = new BaseCommand(_ => Logout());

            StartBadgeIdleCmd = new BaseCommand(StartBadgeIdle, CanStartBadgeIdle);
            StopBadgeIdleCmd  = new BaseCommand(StopBadgeIdle, CanStopBadgeIdle);
            BlacklistBadgeCmd = new BaseCommand(BlacklistBadge);
            ForceSyncCmd      = new BaseCommand(ForceSync);

            EnqueueAllCmd        = new BaseCommand(EnqueueAll);
            DequeueAllCmd        = new BaseCommand(_ => DequeueAll());
            SetHigherPriorityCmd = new BaseCommand(SetHigherPriority, CanSetHigherPriority);
            SetLowerPriorityCmd  = new BaseCommand(SetLowerPriority, CanSetLowerPriority);

            EnqueueBadgeHighCmd = new BaseCommand(EnqueueBadgeHigh, CanEnqueueBadge);
            EnqueueBadgeLowCmd  = new BaseCommand(EnqueueBadgeLow, CanEnqueueBadge);
            DequeueBadgeCmd     = new BaseCommand(DequeueBadge, b => !CanEnqueueBadge(b));

            IdleCmd = new BaseCommand(Idle, CanIdle);

            AddGameCmd    = new BaseCommand(o => AddGame());
            RemoveGameCmd = new BaseCommand(RemoveGame);

            BookmarkShowcaseCmd = new BaseCommand(BookmarkShowcase);
            #endregion

            _badges = CollectionViewSource.GetDefaultView(AllBadges);
            var quick = (ICollectionViewLiveShaping)_badges;
            quick.LiveFilteringProperties.Add("IsBlacklisted");
            quick.LiveFilteringProperties.Add("HasTrial");
            quick.LiveFilteringProperties.Add("CardIdleActive");
            quick.LiveFilteringProperties.Add("IsInQueue");
            quick.IsLiveFiltering = true;

            BadgePropertiesFilters = FilterStatesCollection.Create <BadgeProperty>().SetNotifier(SetFilter);

            _showcases = CollectionViewSource.GetDefaultView(AllShowcases);
            quick      = (ICollectionViewLiveShaping)_showcases;
            quick.LiveFilteringProperties.Add("IsCompleted");
            quick.LiveFilteringProperties.Add("IsBookmarked");
            quick.IsLiveFiltering = true;

            ShowcasePropertiesFilters = FilterStatesCollection.Create <ShowcaseProperty>().SetNotifier(SetShowcaseFilter);
        }
Ejemplo n.º 2
0
        public AccountUpdater(AccountModel account, PricesUpdater pricesUpdater)
        {
            _account       = account;
            _pricesUpdater = pricesUpdater;

            _tmSync       = new DispatcherTimer();
            _tmSync.Tick += SyncBanges;
            Interval      = new TimeSpan(0, 5, 0);

            _tmCounter          = new DispatcherTimer();
            _tmCounter.Tick    += UpdateSecondCounter;
            _tmCounter.Interval = new TimeSpan(0, 0, 1);
        }
Ejemplo n.º 3
0
        public AccountModel()
        {
            _pricesUpdater          = new PricesUpdater();
            _updater                = new AccountUpdater(this, _pricesUpdater);
            _idler                  = new IdleManager();
            _showcaseManager        = new ShowcaseManager(_pricesUpdater);
            _updater.BadgeListSync += SyncShowcases;

            AllBadges = new ObservableCollection <BadgeModel>();
            Games     = new ObservableCollection <BadgeModel>();

            #region Commands
            LoginCmd  = new BaseCommand(_ => Login());
            LogoutCmd = new BaseCommand(_ => Logout());

            StartBadgeIdleCmd = new BaseCommand(StartBadgeIdle, CanStartBadgeIdle);
            StopBadgeIdleCmd  = new BaseCommand(StopBadgeIdle, CanStopBadgeIdle);
            BlacklistBadgeCmd = new BaseCommand(BlacklistBadge);
            ForceSyncCmd      = new BaseCommand(ForceSync);

            EnqueueAllCmd        = new BaseCommand(EnqueueAll);
            DequeueAllCmd        = new BaseCommand(_ => DequeueAll());
            SetHigherPriorityCmd = new BaseCommand(SetHigherPriority, CanSetHigherPriority);
            SetLowerPriorityCmd  = new BaseCommand(SetLowerPriority, CanSetLowerPriority);

            EnqueueBadgeHighCmd = new BaseCommand(EnqueueBadgeHigh, CanEnqueueBadge);
            EnqueueBadgeLowCmd  = new BaseCommand(EnqueueBadgeLow, CanEnqueueBadge);
            DequeueBadgeCmd     = new BaseCommand(DequeueBadge, b => !CanEnqueueBadge(b));

            IdleCmd = new BaseCommand(Idle, CanIdle);

            AddGameCmd    = new BaseCommand(AddGame);
            RemoveGameCmd = new BaseCommand(RemoveGame);

            BookmarkShowcaseCmd = new BaseCommand(BookmarkShowcase);

            ShowSettingsFileCmd = new BaseCommand(ShowSettingsFile);
            #endregion

            BadgePropertiesFilters = FilterStatesCollection.Create <BadgeProperty>().SetNotifier(SetFilter);

            ShowcasePropertiesFilters = FilterStatesCollection.Create <ShowcaseProperty>().SetNotifier(SetShowcaseFilter);
        }
Ejemplo n.º 4
0
 public ShowcaseManager(PricesUpdater pricesUpdater)
 {
     _pricesUpdater = pricesUpdater;
 }