public void LoadTradeSkills()
 {
     try
     {
         lock (TradeSkillList)
         {
             TradeSkillList.Clear();
             foreach (WoWSkill skill in SupportedTradeSkills)
             {
                 Log("Adding TradeSkill {0}", skill.Name);
                 TradeSkill ts = TradeSkillFrame.Instance.GetTradeSkill((SkillLine)skill.Id, true);
                 if (ts != null)
                 {
                     TradeSkillList.Add(ts);
                 }
                 else
                 {
                     IsTradeSkillsLoaded = false;
                     Log("Unable to load tradeskill {0}", (SkillLine)skill.Id);
                     return;
                 }
             }
         }
         IsTradeSkillsLoaded = true;
         if (OnTradeSkillsLoaded != null)
         {
             OnTradeSkillsLoaded(this, null);
         }
     }
     catch (Exception ex) { Logging.Write(System.Drawing.Color.Red, ex.ToString()); }
 }
Exemple #2
0
        public void LoadTradeSkills()
        {
            new Timer(state =>
            {
                try
                {
                    lock (TradeSkillList)
                    {
                        TradeSkillList.Clear();
                        //IEnumerable<WoWSkill> skillList = from skill in TradeSkill.SupportedSkills
                        //                                  select Me.GetSkill(skill);

                        //foreach (WoWSkill skill in skillList)
                        //{
                        //    Log("Adding TradeSkill {0}", skill.Name);
                        //    TradeSkill ts = TradeSkill.GetTradeSkill((SkillLine)skill.Id);
                        //    if (ts != null)
                        //    {
                        //        TradeSkillList.Add(ts);
                        //    }
                        //    else
                        //    {
                        //        IsTradeSkillsLoaded = false;
                        //        Log("Unable to load tradeskill {0}", (SkillLine)skill.Id);
                        //        return;
                        //    }
                        //}
                        foreach (WoWSkill skill in SupportedTradeSkills)
                        {
                            Log("Adding TradeSkill {0}", skill.Name);
                            TradeSkill ts = TradeSkill.GetTradeSkill((SkillLine)skill.Id);
                            if (ts != null)
                            {
                                TradeSkillList.Add(ts);
                            }
                            else
                            {
                                IsTradeSkillsLoaded = false;
                                Log("Unable to load tradeskill {0}", (SkillLine)skill.Id);
                                return;
                            }
                        }
                    }
                    Log("Done Loading Tradeskills.");
                    IsTradeSkillsLoaded = true;
                    if (OnTradeSkillsLoaded != null)
                    {
                        OnTradeSkillsLoaded(this, null);
                    }
                }
                catch (Exception ex)
                {
                    Logging.Write(Color.Red, ex.ToString());
                }
            }, null, 0, Timeout.Infinite);
        }