public override Task SaveCommandToSettings(CommandModelBase command) { GameCommandModelBase c = (GameCommandModelBase)command; ChannelSession.Services.Command.GameCommands.Remove(c); ChannelSession.Services.Command.GameCommands.Add(c); ChannelSession.Services.Chat.RebuildCommandTriggers(); return(Task.FromResult(0)); }
private void CommandButtons_EditClicked(object sender, RoutedEventArgs e) { GameCommandModelBase command = ((CommandListingButtonsControl)sender).GetCommandFromCommandButtons <GameCommandModelBase>(); if (command != null) { GameCommandEditorWindow window = new GameCommandEditorWindow(command); window.Closed += Window_Closed; window.Show(); } }
private async void CommandButtons_DeleteClicked(object sender, RoutedEventArgs e) { await this.Window.RunAsyncOperation(async() => { GameCommandModelBase command = ((CommandListingButtonsControl)sender).GetCommandFromCommandButtons <GameCommandModelBase>(); if (command != null) { ChannelSession.GameCommands.Remove(command); ChannelSession.Settings.RemoveCommand(command); ChannelSession.Services.Chat.RebuildCommandTriggers(); this.viewModel.Refresh(); await ChannelSession.SaveSettings(); } }); }
public GameCommandEditorWindowViewModelBase(GameCommandModelBase existingCommand) : base(existingCommand) { this.SetUICommands(); }
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(); }; }