Example #1
0
 public void SetPrimarySpouse()
 {
     if (this._selectedHero == Hero.MainHero.Spouse)
     {
         return;
     }
     SpouseOperation.SetPrimarySpouse(this._selectedHero);
     this.IsNotPrimarySpouse = false;
     if (null != this._currentSpouseView)
     {
         this._currentSpouseView.RefreshValues();
     }
     if (null != this._lastPrimaryView)
     {
         this._lastPrimaryView.RefreshValues();
     }
     this._lastPrimaryView = this._currentSpouseView;
 }
Example #2
0
        public void RefreshSpouse()
        {
            this._spouses = new List <Hero>();
            if (null != this._spouseViews)
            {
                this._spouseViews.Clear();
            }
            this._spouseViews = new MBBindingList <SpouseItemVM>();

            if (null != Hero.MainHero.Spouse)
            {
                this._spouses.Add(Hero.MainHero.Spouse);
            }
            Hero.MainHero.ExSpouses.ToList().ForEach((obj) => {
                if (!this._spouses.Contains(obj))
                {
                    if (obj.IsAlive)
                    {
                        this._spouses.Add(obj);
                    }
                }
            });

            this._spouses.ForEach((obj) => {
                if (null != obj)
                {
                    SpouseItemVM vm = new SpouseItemVM(obj, OnSelectedSpouse);
                    this._spouseViews.Add(vm);
                    if (obj == Hero.MainHero.Spouse)
                    {
                        this._lastPrimaryView = vm;
                    }
                }
            });

            if (this._spouses.Count > 0)
            {
                this._selectedHero = this._spouses.First();
                OnSelectedSpouse(this._spouseViews.First());
            }
        }
Example #3
0
        public void OnSelectedSpouse(SpouseItemVM spouseItemVM)
        {
            if (spouseItemVM != this._currentSpouseView)
            {
                this._selectedHero = spouseItemVM.Hero;
                if (null == this.SelectedCharacter)
                {
                    this.SelectedCharacter = new SpouseViewModel(CharacterViewModel.StanceTypes.None);
                }
                this.SelectedCharacter.FillFrom(_selectedHero, -1);
                this.CanGetPregnancy    = !this._selectedHero.IsPregnant;
                this.IsNotPrimarySpouse = this._selectedHero != Hero.MainHero.Spouse;
                spouseItemVM.IsSelected = true;

                if (null != _currentSpouseView)
                {
                    this._currentSpouseView.IsSelected = false;
                }
                this._currentSpouseView = spouseItemVM;
            }
        }