Beispiel #1
0
        internal RewardSetViewModel(ITrackerFactory trackerFactory)
        {
            this.trackerFactory = trackerFactory;
            tracker             = trackerFactory.GetTracker();


            CommandDoneButtonPressed = new RelayCommand(new Action <object>(DoneClicked), new Func <object, bool>(CanExecuteDone));
            CommandEditReward        = new RelayCommand(new Action <object>(EditReward));
            CommandDeleteReward      = new RelayCommand(new Action <object>(DeleteReward));

            rewards       = new PropertiesObservableCollection <Reward>(new List <Reward>(), Rewards_CollectionChanged);
            RewardsEditor = new PropertiesObservableCollection <AddSingleRewardViewModel>(new List <AddSingleRewardViewModel>(), Rewards_CollectionChanged);
        }
Beispiel #2
0
        internal EditGameViewModel(ITrackerFactory trackerFactory)
        {
            this.trackerFactory = trackerFactory;

            messanger             = trackerFactory.GetMessanger();
            tracker               = trackerFactory.GetTracker();
            Game.PropertyChanged += Game_PropertyChanged;
            messanger.Register <ActiveDeckChanged>(this, ActiveDeckChanged);
            messanger.Register <EditGame>(this, EditGameStart, Utils.Messages.EditGame.Context.StartEdit);

            this.settings = trackerFactory.GetService <ISettings>();

            this.BeginEdit();
        }
Beispiel #3
0
        public DeckStatsViewModel(ITrackerFactory trackerFactory)
        {
            this.messanger = trackerFactory.GetMessanger();
            tracker        = trackerFactory.GetTracker();

            if (tracker.ActiveDeck != null)
            {
                //load data for active deck from settigs
                RefreshData();
            }

            messanger.Register <EditDeck>(this, GameAdded, EditDeck.Context.StatsUpdated);
            messanger.Register <ActiveDeckChanged>(this, ActiveDeckChanged);
        }
        internal EditGameViewModel(ITrackerFactory trackerFactory)
        {
            this.trackerFactory = trackerFactory;

            messanger             = trackerFactory.GetService <IMessenger>();
            tracker               = trackerFactory.GetTracker();
            Game.PropertyChanged += Game_PropertyChanged;
            messanger.Register <ActiveDeckChanged>(this, ActiveDeckChanged);
            messanger.Register <EditGame>(this, EditGameStart, Utils.Messages.EditGame.Context.StartEdit);
            messanger.Register <NewDeckTagCreated>(this, RefreshTagsList);
            this.settings = trackerFactory.GetService <ISettings>();
            this.winApi   = trackerFactory.GetService <IWinAPI>();

            this.BeginEdit();
        }
Beispiel #5
0
        public void DoneClicked(object param)
        {
            var newRewards = Rewards.Where(r => !tracker.Rewards.Contains(r));
            //fix up excaly same date
            DateTime date = trackerFactory.GetDateTimeNow();

            foreach (Reward r in newRewards)
            {
                r.Date = date;
            }
            trackerFactory.GetTracker().Rewards.AddRange(newRewards);
            trackerFactory.GetFileManager().SaveDatabase();
            Rewards.Clear();
            RewardReason = null;
        }
        public DeckListViewModel(ITrackerFactory factory)
        {
            this.messanger = factory.GetService <IMessenger>();
            messanger.Register <DeckListFilterChanged>(this, DeckFilterChanged, ControlMessangerContext.DeckList_DeckFilterControl);
            messanger.Register <EditDeck>(this, EditDeckFinished, Utils.Messages.EditDeck.Context.EditFinished);
            messanger.Register <EditDeck>(this, CommandHideDeckExecute, Utils.Messages.EditDeck.Context.Hide);
            messanger.Register <EditDeck>(this, CommandUnHideDeckExecute, Utils.Messages.EditDeck.Context.UnHide);
            messanger.Register <EditDeck>(this, CommandDeleteDeckExecute, Utils.Messages.EditDeck.Context.Delete);

            this.trackerFactory = factory;
            this.tracker        = factory.GetTracker();
            FilteredDecks       = new ObservableCollection <Deck>(tracker.Decks);

            deckService = trackerFactory.GetService <IDeckService>();
            settings    = trackerFactory.GetService <ISettings>();
        }
        public string GetScreenShotName(ScreenShotType type, string nameTemplate)
        {
            switch (type)
            {
            case ScreenShotType.Regular:
                nameTemplate = nameTemplate.Replace("{d", "{0");
                return(string.Format(nameTemplate, trackerFactory.GetDateTimeNow()));

            case ScreenShotType.Pack:
                nameTemplate = nameTemplate.Replace("{d", "{0").Replace("{n", "{1");
                return(string.Format(nameTemplate, trackerFactory.GetDateTimeNow(), trackerFactory.GetTracker().Packs.Count));

            default:
                throw new NotImplementedException("Unknown screenshot type" + type);
            }
        }
Beispiel #8
0
        internal MainWindowViewModel(TrackerFactory trackerFactory)
        {
            this.trackerFactory = trackerFactory;
            tracker             = trackerFactory.GetTracker();
            messanger           = trackerFactory.GetMessanger();
            messanger.Register <Utils.Messages.EditDeck>(this, EditDeckStart, Utils.Messages.EditDeck.Context.StartEdit);
            messanger.Register <Utils.Messages.EditDeck>(this, EditDeckFinished, Utils.Messages.EditDeck.Context.EditFinished);
            messanger.Register <Utils.Messages.EditGame>(this, EditGameStart, Utils.Messages.EditGame.Context.StartEdit);
            messanger.Register <Utils.Messages.EditGame>(this, EditGameFinished, Utils.Messages.EditGame.Context.EditFinished);
            messanger.Register <Utils.Messages.EditSettings>(this, EditSettingsFinished, Utils.Messages.EditSettings.Context.EditFinished);

            deckService = trackerFactory.GetService <IDeckService>();
            settings    = trackerFactory.GetService <ISettings>();

            this.OverlayWindows.Add(new OverlayToolbar());
            this.OverlayWindows.Add(new DeckOverlay());
            this.OverlayWindows.CollectionChanged += (s, e) => RaisePropertyChangedEvent(nameof(OverlayWindows));
        }
        public void DoneClicked(object param)
        {
            var newRewards = RewardsAdded.Where(r => !tracker.Rewards.Contains(r));
            //fix up excaly same date
            DateTime date = trackerFactory.GetDateTimeNow();

            foreach (Reward r in newRewards)
            {
                r.Date      = date;
                r.ArenaDeck = ArenaDeck;
            }
            trackerFactory.GetTracker().Rewards.AddRange(newRewards);
            trackerFactory.GetFileManager().SaveDatabase();

            rewards.Clear();
            rewards      = new PropertiesObservableCollection <Reward>(CreateEmptySet(), Rewards_CollectionChanged);
            RewardReason = null;
            RefreshRewardLists();
        }
 public virtual IEnumerable <Game> GetDeckGames(Deck deck)
 {
     return(trackerFactory.GetTracker().Games.Where(g => g.Deck.DeckId == deck.DeckId));
 }
Beispiel #11
0
 public ChangeGameDeckViewModel(ITrackerFactory trackerFactory)
 {
     this.tarckerFactory = trackerFactory;
     this.tracker        = tarckerFactory.GetTracker();
 }
Beispiel #12
0
 public IEnumerable <Reward> GetArenaRewards()
 {
     return(trackerFactory.GetTracker().Rewards
            .Where(r => r.ArenaDeckId == DeckId));
 }
Beispiel #13
0
 internal RewardSetViewModel(ITrackerFactory trackerFactory)
 {
     this.trackerFactory = trackerFactory;
     tracker             = trackerFactory.GetTracker();
     Rewards             = new ObservableCollection <Reward>();
 }
 public void SaveDatabase()
 {
     SaveDatabase <Tracker>(
         FullDataFilePath,
         trackerfactory.GetTracker() as Tracker);
 }
 internal RewardSetViewModel(ITrackerFactory trackerFactory)
 {
     this.trackerFactory = trackerFactory;
     tracker             = trackerFactory.GetTracker();
     rewards             = new PropertiesObservableCollection <Reward>(CreateEmptySet(), Rewards_CollectionChanged);
 }
 public DeckPreviewViewModel(ITrackerFactory trackerFactory)
 {
     this.trackerFactory = trackerFactory;
     this.messanger      = trackerFactory.GetService <IMessenger>();
     this.tracker        = trackerFactory.GetTracker();
 }