public async Task <object> CommandRunGameExecute(object parameter)
        {
            startingGame = true;
            CommandManager.InvalidateRequerySuggested();
            IWinAPI winApi            = trackerFactory.GetWinAPI();
            bool    isLauncherRunning = winApi.IsLauncherProcessRunning();

            if (winApi.GetEslProcess() == null && !winApi.IsLauncherProcessRunning())
            {
                System.Diagnostics.Process.Start("bethesdanet://run/5");
                trackerFactory.GetMessanger().Send(new ApplicationShowBalloonTip("ESL Tracker", "Starting game..."));
                await Task.Delay(TimeSpan.FromSeconds(60)); //wait 10 sec

                if (winApi.GetEslProcess() == null)
                {
                    trackerFactory.GetMessanger().Send(new ApplicationShowBalloonTip("ESL Tracker", "There is probelm staring game, please check Bethesda.net Laucher."));
                }
            }
            else if (trackerFactory.GetWinAPI().IsLauncherProcessRunning())
            {
                trackerFactory.GetMessanger().Send(new ApplicationShowBalloonTip("ESL Tracker", "Bethesda.net Laucher is running - use it to start game."));
            }
            else
            {
                trackerFactory.GetMessanger().Send(new ApplicationShowBalloonTip("ESL Tracker", "Game is already running"));
            }
            startingGame = false;
            CommandManager.InvalidateRequerySuggested();
            return(null);
        }
Beispiel #2
0
        public DeckClassSelectorViewModel(ITrackerFactory factory)
        {
            messenger         = factory.GetMessanger();
            FilterButtonState = new Dictionary <DeckAttribute, bool>();
            foreach (DeckAttribute a in Enum.GetValues(typeof(DeckAttribute)))
            {
                FilterButtonState.Add(a, false);
            }

            FilteredClasses = new ObservableCollection <DeckClass>();
            FilterCombo();
        }
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);
        }
Beispiel #4
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();
        }
        public DeckTypeSelectorViewModel(ITrackerFactory trackerFactory)
        {
            this.trackerFactory = trackerFactory;
            messanger           = trackerFactory.GetMessanger();
            FilterButtonState   = new Dictionary <DeckType, bool>();
            foreach (DeckType a in Enum.GetValues(typeof(DeckType)))
            {
                FilterButtonState.Add(a, false);
            }
            messanger.Register <DeckListResetFilters>(this, ResetFilter, ControlMessangerContext.DeckList_DeckFilterControl);

            //init filters (so checkbox for hiding completed arena runs is applied
            messanger.Send(new DeckListFilterChanged(DeckListFilterChanged.Source.TypeFilter, FilteredTypes, showCompletedArenaRuns, showHiddenDecks, null, null), ControlMessangerContext.DeckList_DeckFilterControl);
        }
        public DeckListViewModel(ITrackerFactory factory)
        {
            this.messanger = factory.GetMessanger();
            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>();
        }
Beispiel #7
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));
        }
Beispiel #8
0
 public DeckEditViewModel(ITrackerFactory trackerFactory)
 {
     this.trackerFactory = trackerFactory;
     this.messanger      = trackerFactory.GetMessanger();
     messanger.Register <EditDeck>(this, EditDeckStart, EditDeck.Context.StartEdit);
 }
 public DeckPreviewViewModel(ITrackerFactory trackerFactory)
 {
     this.trackerFactory = trackerFactory;
     this.messanger      = trackerFactory.GetMessanger();
 }