Example #1
0
        //HOPE WPF HANDLE PERFOMANCE WELL
        public void Refresh(string propertyName, ObservableCollectionExt <SnipePokemonViewModel> list)
        {
            list.RemoveAll(x => x.RemainTimes < 0);

            foreach (var item in list)
            {
                item.RaisePropertyChanged("RemainTimes");
            }
            RaisePropertyChanged(propertyName);
        }
Example #2
0
        internal void OnSnipeData(EncounteredEvent e)
        {
            var session = TinyIoCContainer.Current.Resolve <ISession>();

            if (!e.IsRecievedFromSocket)
            {
                return;
            }
            lock (pending)
            {
                pending.Add(e);

                if (lastUpdateTime > DateTime.Now.AddSeconds(-session.LogicSettings.UIConfig.SnipeListRefreshInterval))
                {
                    return;
                }

                foreach (var item in pending)
                {
                    var         model = new SnipePokemonViewModel(item);
                    var         grade = PokemonGradeHelper.GetPokemonGrade(model.PokemonId);
                    PokemonData best  = null;

                    if (bestPokemons != null)
                    {
                        best = bestPokemons.FirstOrDefault(x => x.PokemonId == model.PokemonId);
                    }

                    if (best == null || PokemonInfo.CalculatePokemonPerfection(best) < model.IV)
                    {
                        model.Recommend = true;
                    }
                    if (model.IV >= 100)
                    {
                        Handle100IV(model);
                    }
                    else
                    if (grade == PokemonGrades.Legendary ||
                        grade == PokemonGrades.VeryRare ||
                        grade == PokemonGrades.Epic ||
                        grade == PokemonGrades.Rare)
                    {
                        HandleRarePokemon(model);
                    }
                    else
                    {
                        HandleOthers(model);
                    }

                    HandlePokedex(model);
                }
                pending.RemoveAll(x => true);
                lastUpdateTime = DateTime.Now;
            }
        }