Beispiel #1
0
        public GameCommandEditorWindow(GameCommandModelBase existingCommand)
            : this()
        {
            switch (existingCommand.GameType)
            {
            case GameCommandTypeEnum.Bet:
                this.editorDetailsControl = new BetGameCommandEditorDetailsControl();
                this.viewModel            = new BetGameCommandEditorWindowViewModel((BetGameCommandModel)existingCommand);
                break;

            case GameCommandTypeEnum.Bid:
                this.editorDetailsControl = new BidGameCommandEditorDetailsControl();
                this.viewModel            = new BidGameCommandEditorWindowViewModel((BidGameCommandModel)existingCommand);
                break;

            case GameCommandTypeEnum.CoinPusher:
                this.editorDetailsControl = new CoinPusherGameCommandEditorDetailsControl();
                this.viewModel            = new CoinPusherGameCommandEditorWindowViewModel((CoinPusherGameCommandModel)existingCommand);
                break;

            case GameCommandTypeEnum.Duel:
                this.editorDetailsControl = new DuelGameCommandEditorDetailsControl();
                this.viewModel            = new DuelGameCommandEditorWindowViewModel((DuelGameCommandModel)existingCommand);
                break;

            case GameCommandTypeEnum.Hangman:
                this.editorDetailsControl = new HangmanGameCommandEditorDetailsControl();
                this.viewModel            = new HangmanGameCommandEditorWindowViewModel((HangmanGameCommandModel)existingCommand);
                break;

            case GameCommandTypeEnum.Heist:
                this.editorDetailsControl = new HeistGameCommandEditorDetailsControl();
                this.viewModel            = new HeistGameCommandEditorWindowViewModel((HeistGameCommandModel)existingCommand);
                break;

            case GameCommandTypeEnum.Hitman:
                this.editorDetailsControl = new HitmanGameCommandEditorDetailsControl();
                this.viewModel            = new HitmanGameCommandEditorWindowViewModel((HitmanGameCommandModel)existingCommand);
                break;

            case GameCommandTypeEnum.HotPotato:
                this.editorDetailsControl = new HotPotatoGameCommandEditorDetailsControl();
                this.viewModel            = new HotPotatoGameCommandEditorWindowViewModel((HotPotatoGameCommandModel)existingCommand);
                break;

            case GameCommandTypeEnum.LockBox:
                this.editorDetailsControl = new LockBoxGameCommandEditorDetailsControl();
                this.viewModel            = new LockBoxGameCommandEditorWindowViewModel((LockBoxGameCommandModel)existingCommand);
                break;

            case GameCommandTypeEnum.Roulette:
                this.editorDetailsControl = new RouletteGameCommandEditorDetailsControl();
                this.viewModel            = new RouletteGameCommandEditorWindowViewModel((RouletteGameCommandModel)existingCommand);
                break;

            case GameCommandTypeEnum.RussianRoulette:
                this.editorDetailsControl = new RussianRouletteGameCommandEditorDetailsControl();
                this.viewModel            = new RussianRouletteGameCommandEditorWindowViewModel((RussianRouletteGameCommandModel)existingCommand);
                break;

            case GameCommandTypeEnum.SlotMachine:
                this.editorDetailsControl = new SlotMachineGameCommandEditorDetailsControl();
                this.viewModel            = new SlotMachineGameCommandEditorWindowViewModel((SlotMachineGameCommandModel)existingCommand);
                break;

            case GameCommandTypeEnum.Spin:
                this.editorDetailsControl = new SpinGameCommandEditorDetailsControl();
                this.viewModel            = new SpinGameCommandEditorWindowViewModel((SpinGameCommandModel)existingCommand);
                break;

            case GameCommandTypeEnum.Steal:
                this.editorDetailsControl = new StealGameCommandEditorDetailsControl();
                this.viewModel            = new StealGameCommandEditorWindowViewModel((StealGameCommandModel)existingCommand);
                break;

            case GameCommandTypeEnum.TreasureDefense:
                this.editorDetailsControl = new TreasureDefenseGameCommandEditorDetailsControl();
                this.viewModel            = new TreasureDefenseGameCommandEditorWindowViewModel((TreasureDefenseGameCommandModel)existingCommand);
                break;

            case GameCommandTypeEnum.Trivia:
                this.editorDetailsControl = new TriviaGameCommandEditorDetailsControl();
                this.viewModel            = new TriviaGameCommandEditorWindowViewModel((TriviaGameCommandModel)existingCommand);
                break;

            case GameCommandTypeEnum.Volcano:
                this.editorDetailsControl = new VolcanoGameCommandEditorDetailsControl();
                this.viewModel            = new VolcanoGameCommandEditorWindowViewModel((VolcanoGameCommandModel)existingCommand);
                break;

            case GameCommandTypeEnum.WordScramble:
                this.editorDetailsControl = new WordScrambleGameCommandEditorDetailsControl();
                this.viewModel            = new WordScrambleGameCommandEditorWindowViewModel((WordScrambleGameCommandModel)existingCommand);
                break;
            }

            this.DataContext = this.ViewModel = this.viewModel;
            this.ViewModel.StartLoadingOperationOccurred += (sender, eventArgs) => { this.StartLoadingOperation(); };
            this.ViewModel.EndLoadingOperationOccurred   += (sender, eventArgs) => { this.EndLoadingOperation(); };
        }
        protected void DeleteOutcomeButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            GameCommandEditorWindowViewModelBase viewModel = (GameCommandEditorWindowViewModelBase)this.DataContext;

            viewModel.DeleteOutcomeCommand.Execute(FrameworkElementHelpers.GetDataContext <GameOutcomeViewModel>(sender));
        }