public BattleHistoryWindowViewModel() : base(BattleHistoryWindowModel.GetInstance()) { // チェックボックス紐づけ IsChkTrainerChecked = ModelConnector.BattleHistoryWindow.ToReactivePropertyAsSynchronized(m => m.IsWhereTrainerId); IsChkBattleResultChecked = ModelConnector.BattleHistoryWindow.ToReactivePropertyAsSynchronized(m => m.IsWhereBattleResultId); // コンボボックスにアイテム設定 ModelConnector.BattleHistoryWindow.Trainers.ForEach(e => CmbTrainer.Add(e)); ModelConnector.BattleHistoryWindow.BattleResults.ForEach(e => CmbBattleResult.Add(e)); ModelConnector.BattleHistoryWindow.BattleRecordNumberList.ForEach(e => CmbBattleRecordNumber.Add(e)); // コンボボックス初期選択 SelectedTrainer.Value = CmbTrainer[0]; SelectedBattleResult.Value = CmbBattleResult[0]; SelectedBattleRecordNumber.Value = CmbBattleRecordNumber[0]; // コンボボックス選択時の処理 SelectedTrainer.Subscribe(x => ModelConnector.BattleHistoryWindow.TrainerId = x.TrainerId); SelectedBattleResult.Subscribe(x => ModelConnector.BattleHistoryWindow.BattleResultId = x.Id); SelectedBattleRecordNumber.Subscribe(x => ModelConnector.BattleHistoryWindow.BattleRecordNumber = x); // ウィンドウクローズ IsShowWindow.Where(x => !x).Subscribe(_ => CloseWindowRequest.Raise(new Notification())); // コマンド SearchCommand = new DelegateCommand(SearchBattleRecord); }
public PartyWindowViewModel( PartyWindowModel partyWindowModel, PartyManegementModel partyManegementModel, PartyWaitStateModel partyWaitStateModel ) : base(partyWindowModel) { // ウィンドウクローズ IsShowWindow.Where(x => !x).Subscribe(_ => CloseWindowRequest.Raise(new Notification())); // ウィンドウアクティブ紐づけ WindowEnabled = ModelConnector.Analysis.ObserveProperty(m => m.IsAnalyzing).Select(x => !x).ToReactiveProperty(); PokemonId0 = partyManegementModel.ObserveProperty(m => m.PokemonId0).ToReactiveProperty(); PokemonId1 = partyManegementModel.ObserveProperty(m => m.PokemonId1).ToReactiveProperty(); PokemonId2 = partyManegementModel.ObserveProperty(m => m.PokemonId2).ToReactiveProperty(); PokemonId3 = partyManegementModel.ObserveProperty(m => m.PokemonId3).ToReactiveProperty(); PokemonId4 = partyManegementModel.ObserveProperty(m => m.PokemonId4).ToReactiveProperty(); PokemonId5 = partyManegementModel.ObserveProperty(m => m.PokemonId5).ToReactiveProperty(); PokemonOrder0 = partyManegementModel.ObserveProperty(m => m.PokemonOrder0).ToReactiveProperty(); PokemonOrder1 = partyManegementModel.ObserveProperty(m => m.PokemonOrder1).ToReactiveProperty(); PokemonOrder2 = partyManegementModel.ObserveProperty(m => m.PokemonOrder2).ToReactiveProperty(); PokemonOrder3 = partyManegementModel.ObserveProperty(m => m.PokemonOrder3).ToReactiveProperty(); PokemonOrder4 = partyManegementModel.ObserveProperty(m => m.PokemonOrder4).ToReactiveProperty(); PokemonOrder5 = partyManegementModel.ObserveProperty(m => m.PokemonOrder5).ToReactiveProperty(); PokemonImage0 = PokemonId0 .CombineLatest(PokemonOrder0, (pokemonId, order) => ImageFactoryModel.CreatePokemonImage(pokemonId, order)).ToReactiveProperty(); PokemonImage1 = PokemonId1 .CombineLatest(PokemonOrder1, (pokemonId, order) => ImageFactoryModel.CreatePokemonImage(pokemonId, order)).ToReactiveProperty(); PokemonImage2 = PokemonId2 .CombineLatest(PokemonOrder2, (pokemonId, order) => ImageFactoryModel.CreatePokemonImage(pokemonId, order)).ToReactiveProperty(); PokemonImage3 = PokemonId3 .CombineLatest(PokemonOrder3, (pokemonId, order) => ImageFactoryModel.CreatePokemonImage(pokemonId, order)).ToReactiveProperty(); PokemonImage4 = PokemonId4 .CombineLatest(PokemonOrder4, (pokemonId, order) => ImageFactoryModel.CreatePokemonImage(pokemonId, order)).ToReactiveProperty(); PokemonImage5 = PokemonId5 .CombineLatest(PokemonOrder5, (pokemonId, order) => ImageFactoryModel.CreatePokemonImage(pokemonId, order)).ToReactiveProperty(); // 待機イメージ紐づけ WaitImage0 = partyWaitStateModel.ObserveProperty(m => m.WaitState0).Select(x => ImageFactoryModel.CreateWaitImage(x)).ToReactiveProperty(); WaitImage1 = partyWaitStateModel.ObserveProperty(m => m.WaitState1).Select(x => ImageFactoryModel.CreateWaitImage(x)).ToReactiveProperty(); WaitImage2 = partyWaitStateModel.ObserveProperty(m => m.WaitState2).Select(x => ImageFactoryModel.CreateWaitImage(x)).ToReactiveProperty(); WaitImage3 = partyWaitStateModel.ObserveProperty(m => m.WaitState3).Select(x => ImageFactoryModel.CreateWaitImage(x)).ToReactiveProperty(); WaitImage4 = partyWaitStateModel.ObserveProperty(m => m.WaitState4).Select(x => ImageFactoryModel.CreateWaitImage(x)).ToReactiveProperty(); WaitImage5 = partyWaitStateModel.ObserveProperty(m => m.WaitState5).Select(x => ImageFactoryModel.CreateWaitImage(x)).ToReactiveProperty(); }