Example #1
0
        public PartyControllViewModel(PartyManegementModel partyManegementModel)
        {
            _partyManegementModel = partyManegementModel;

            // ポケモンIdの変更
            PokemonImage0 = _partyManegementModel
                            .ObserveProperty(m => m.PokemonId0)
                            .Select(x => ImageFactoryModel.CreatePokemonImage(x)).ToReactiveProperty();

            PokemonImage1 = _partyManegementModel
                            .ObserveProperty(m => m.PokemonId1)
                            .Select(x => ImageFactoryModel.CreatePokemonImage(x)).ToReactiveProperty();

            PokemonImage2 = _partyManegementModel
                            .ObserveProperty(m => m.PokemonId2)
                            .Select(x => ImageFactoryModel.CreatePokemonImage(x)).ToReactiveProperty();

            PokemonImage3 = _partyManegementModel
                            .ObserveProperty(m => m.PokemonId3)
                            .Select(x => ImageFactoryModel.CreatePokemonImage(x)).ToReactiveProperty();

            PokemonImage4 = _partyManegementModel
                            .ObserveProperty(m => m.PokemonId4)
                            .Select(x => ImageFactoryModel.CreatePokemonImage(x)).ToReactiveProperty();

            PokemonImage5 = _partyManegementModel
                            .ObserveProperty(m => m.PokemonId5)
                            .Select(x => ImageFactoryModel.CreatePokemonImage(x)).ToReactiveProperty();

            // コマンド
            ShowPokemonSearchWindowCommand = new DelegateCommand <object>(ShowPokemonSearchWindow);
        }
        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();
        }