private void MageViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == nameof(IMageKnightBattleViewModel.ActionMode))
            {
                try
                {
                    var m = sender as IMageKnightBattleViewModel;
                    this.activeMageKnights.Remove(this.activeMageKnights.FirstOrDefault(x => x.Name == "temp" + m.Model.InstantiatedId.ToString()));
                }
                catch
                {
                    ;
                }

                IMageKnightBattleViewModel data = sender as IMageKnightBattleViewModel;
                if (data.ActionMode == ActionMode.Move || data.ActionMode == ActionMode.MoveFormation)
                {
                    var boundry = new MageKnightBattleViewModel(data);
                    this.ActiveMageKnights.Add(boundry);
                }

                this.SyncBaseContactCollections();
            }

            if (e.PropertyName == nameof(IMageKnightBattleViewModel.IsSelected))
            {
                var mage = sender as IMageKnightBattleViewModel;
                if (mage.IsSelected)
                {
                    this.User1SelectedMageKnight = this.ActiveMageKnights.FirstOrDefault(x => x.Model.InstantiatedId == mage.Model.InstantiatedId);
                }
            }
        }
        public GameViewModel(IGameModel gameModel, IUserViewModel userViewModel, IUserCollection userCollection)
        {
            this.gameModel                  = gameModel;
            this.userViewModel              = userViewModel;
            this.userCollection             = userCollection;
            this.gameModel.PropertyChanged += GameModel_PropertyChanged;
            this.User1.PropertyChanged     += User1_PropertyChanged;
            this.User2.PropertyChanged     += User1_PropertyChanged;
            if (User1.Army.Count() != 0)
            {
                int i = 0;
                foreach (var mage in User1.Army)
                {
                    var mageViewModel = new MageKnightBattleViewModel(mage, this.User1);
                    mageViewModel.PropertyChanged += MageViewModel_PropertyChanged;
                    double range  = mageViewModel.Range;
                    double speed  = mageViewModel.Dial.Click.Speed.Value;
                    double max    = Math.Max(range, speed);
                    double height = max * 100;
                    double x      = height - 50 - 1100;
                    double y      = height - 50 - 200;

                    mageViewModel.XCord = -x + 100 * i;
                    mageViewModel.YCord = -y;
                    i++;
                    userViewModel.ArmyViewModels.Add(mageViewModel);
                    activeMageKnights.Add(mageViewModel);
                }
            }
            if (User2.Army.Count() != 0 && User2.Id != User1.Id)
            {
                int i = 0;
                foreach (var mage in User2.Army)
                {
                    var    mageViewModel = new MageKnightBattleViewModel(mage, this.User2);
                    double range         = mageViewModel.Range;
                    double speed         = mageViewModel.Dial.Click.Speed.Value;
                    double max           = Math.Max(range, speed);
                    double height        = max * 100;
                    double x             = height - 50 - 1100;
                    double y             = height - 50 - 3700;

                    mageViewModel.XCord = -x + 100 * i;
                    mageViewModel.YCord = -y;
                    i++;
                    mageViewModel.PropertyChanged += MageViewModel_PropertyChanged;
                    userViewModel.ArmyViewModels.Add(mageViewModel);
                    activeMageKnights.Add(mageViewModel);
                }
            }
        }
        private void GameModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == nameof(IGameModel.User1Id))
            {
                foreach (var mage in this.User1.Army)
                {
                    var mageViewModel = new MageKnightBattleViewModel(mage, this.User1);

                    mageViewModel.PropertyChanged += MageViewModel_PropertyChanged;
                    userViewModel.ArmyViewModels.Add(mageViewModel);
                    this.ActiveMageKnights.Add(mageViewModel);
                }
            }

            if (e.PropertyName == nameof(IGameModel.User2Id))
            {
                int i = 0;
                foreach (var mage in User2.Army)
                {
                    var    mageViewModel = new MageKnightBattleViewModel(mage, this.User2);
                    double range         = mageViewModel.Range;
                    double speed         = mageViewModel.Dial.Click.Speed.Value;
                    double max           = Math.Max(range, speed);
                    double height        = max * 100;
                    double x             = height - 50 - 1100;
                    double y             = height - 50 - 3700;

                    mageViewModel.XCord = -x + 100 * i;
                    mageViewModel.YCord = -y;
                    i++;
                    mageViewModel.PropertyChanged += MageViewModel_PropertyChanged;
                    userViewModel.ArmyViewModels.Add(mageViewModel);
                    activeMageKnights.Add(mageViewModel);
                }
            }
        }