Exemplo n.º 1
0
        public EditGameFlyoutViewModel(
            IDialogManager dialogManager,
            IEventAggregator events,
            IRepository <ArenaSession> arenaRepository,
            IRepository <GameResult> gameRepository,
            IDeckManager deckManager,
            GameManager.GameManager gameManager)
        {
            this.dialogManager   = dialogManager;
            this.events          = events;
            this.arenaRepository = arenaRepository;
            this.gameRepository  = gameRepository;
            this.deckManager     = deckManager;
            this.gameManager     = gameManager;
            Name   = Flyouts.EditGame;
            Header = displayName_new;
            SetPosition(Position.Right);
            heroes = new BindableCollection <Hero>();
            events.Subscribe(this);

            GameMode         = GameMode.Practice;
            StartTime        = DateTime.Now;
            EndTime          = DateTime.Now;
            PropertyChanged += OnPropertyChanged;
            lastIsOpen       = IsOpen;

            // yeah lol :p
            gameModes.Remove(GameMode.Arena);
            selectedServer = servers.Default;
            Busy           = new BusyWatcher();
        }
        public DeckSettingsViewModel(
            IEventAggregator events,
            IDeckManager deckManager)
        {
            this.events      = events;
            this.deckManager = deckManager;

            SetPosition(Position.Left);
            Name   = Flyouts.Decks;
            Header = DisplayName = "Decks:";
            // note the setting of backing field instead of property, to not trigger deck refreshing yet.
            selectedServer = servers.Default ?? servers.First();
            events.Subscribe(this);
            CanTakeScreenshot = true;
        }
Exemplo n.º 3
0
        private void SetMissingServer(ServerItemModel selectedServer)
        {
            if (selectedServer == null)
            {
                return;
            }
            var serverName = selectedServer.Name;

            using (var context = dbContext())
            {
                context.Database.ExecuteSqlCommand("UPDATE GameResults SET Server = @p0 WHERE Server IS NULL OR Server = ''", serverName);
                context.Database.ExecuteSqlCommand("UPDATE ArenaSessions SET Server = @p0 WHERE Server IS NULL OR Server = ''", serverName);
            }

            events.PublishOnBackgroundThread(new RefreshAll());
        }
Exemplo n.º 4
0
 public ServerChanged(ServerItemModel server)
 {
     this.Server = server;
 }
Exemplo n.º 5
0
 public void ChangeServer(ServerItemModel server)
 {
     servers.Default  = server;
     server.IsChecked = true;
 }
Exemplo n.º 6
0
 public ServerChanged(ServerItemModel server)
 {
     this.Server = server;
 }