예제 #1
0
        /// <summary>
        /// Bindings the property.
        /// </summary>
        public void BindingProperty()
        {
            UpgradeSetting setting = PropertyService.Get <UpgradeSetting>(UIExtensionSiteNames.Shell_Property_Upgrade, new UpgradeSetting());

            txtUpgradeUrl.Text       = setting.UpgradeUrl;
            chkReciveMessage.Checked = setting.ReciveUpgradeMessage;
            chkCheckUpgrade.Checked  = setting.CheckInterval > 0;
            txtCheckInterval.Value   = setting.CheckInterval;
        }
예제 #2
0
        public void OnUpgradeProjectCreated(object sender, EventArgs <UpgradeProject> e)
        {
            UpgradeSetting setting = GetSetting();

            if (setting != null && setting.ReciveUpgradeMessage)
            {
                UpgradeNotify(e.Data);
            }
        }
예제 #3
0
        public MethodResult <List <PokemonData> > GetPokemonToUpgrade()
        {
            if (!UserSettings.UpgradePokemon)
            {
                LogCaller(new LoggerEventArgs("Upgrade disabled", LoggerTypes.Debug));

                return(new MethodResult <List <PokemonData> >
                {
                    Data = new List <PokemonData>(),
                    Message = "Upgrade disabled",
                    Success = true
                });
            }

            if (!Pokemon.Any())
            {
                LogCaller(new LoggerEventArgs("You have no pokemon", LoggerTypes.Info));

                return(new MethodResult <List <PokemonData> >
                {
                    Message = "You have no pokemon"
                });
            }

            var pokemonToUpgrade = new List <PokemonData>();

            IEnumerable <IGrouping <PokemonId, PokemonData> > groupedPokemon = Pokemon.GroupBy(x => x.PokemonId);

            foreach (IGrouping <PokemonId, PokemonData> group in groupedPokemon)
            {
                UpgradeSetting settings = UserSettings.UpgradeSettings.FirstOrDefault(x => x.Id == group.Key);

                if (settings == null)
                {
                    LogCaller(new LoggerEventArgs(String.Format("Failed to find upgrade settings for pokemon {0}", group.Key), LoggerTypes.Warning));

                    continue;
                }

                if (!settings.Upgrade)
                {
                    continue;
                }

                pokemonToUpgrade.AddRange(group.ToList());
            }

            return(new MethodResult <List <PokemonData> >
            {
                Data = pokemonToUpgrade,
                Message = String.Format("Found {0} pokemon to upgrade", pokemonToUpgrade.Count),
                Success = true
            });
        }
예제 #4
0
        /// <summary>
        /// Saves this instance.
        /// </summary>
        public void Save()
        {
            UpgradeSetting setting = new UpgradeSetting {
                CheckInterval        = (int)txtCheckInterval.Value,
                ReciveUpgradeMessage = chkReciveMessage.Checked,
                UpgradeUrl           = txtUpgradeUrl.Text
            };

            property.Current = setting;
            PropertyService.Set <UpgradeSetting>(UIExtensionSiteNames.Shell_Property_Upgrade, setting);
            if (SettingChanged != null)
            {
                SettingChanged(this, new EventArgs <object>(setting)); // ´¥·¢Ê¼þ
            }
        }
예제 #5
0
        public LiveUpgradeService([ServiceDependency] WorkItem workItem, [ServiceDependency] IPropertyService propertyService)
        {
            this.workItem        = workItem;
            this.propertyService = propertyService;

            LiveUpgradeConfigurationSection cs = ConfigurationManager.GetSection(LIVEUPGRADE_SECTION) as LiveUpgradeConfigurationSection;
            UpgradeSetting setting             = GetSetting();

            if (cs != null && setting != null)
            {
                detecter = new UpgradeDetecter(this);
                if (setting.CheckInterval > 0)
                {
                    detecter.CheckInterval = setting.CheckInterval;
                    detecter.Start();
                }
            }
        }
예제 #6
0
        public void LoadUpgradeSettings()
        {
            UpgradeSettings = new List <UpgradeSetting>();

            foreach (PokemonId pokemon in Enum.GetValues(typeof(PokemonId)))
            {
                if (pokemon == PokemonId.Missingno)
                {
                    continue;
                }

                var setting = new UpgradeSetting
                {
                    Id = pokemon,
                    //Upgrade = true
                };

                UpgradeSettings.Add(setting);
            }
        }
예제 #7
0
        public void OnUpgradeSettingChanged(object sender, Uniframework.SmartClient.PropertyChangedEventArgs e)
        {
            UpgradeSetting setting = e.Property.Current as UpgradeSetting;

            if (setting != null && detecter != null)
            {
                if (setting.CheckInterval > 0)
                {
                    detecter.CheckInterval = setting.CheckInterval;
                    if (detecter.IsRun != true)
                    {
                        detecter.Start();
                    }
                }
                else
                {
                    detecter.Stop();
                }
            }
        }