internal static void ReloadFrames(Object proObj) { Professions professions = (Professions)proObj; InterfaceHelper.ReloadFrames(); Thread.Sleep(2000); ClickHooked("SpellbookMicroButton"); ClickHooked("SpellBookFrameTabButton2"); List <Frame> mainFrames = new List <Frame>(); List <Frame> statusFrames = new List <Frame>(); mainFrames.Add(ClickHooked("PrimaryProfession1")); mainFrames.Add(ClickHooked("PrimaryProfession2")); mainFrames.Add(ClickHooked("SecondaryProfession1")); mainFrames.Add(ClickHooked("SecondaryProfession2")); mainFrames.Add(ClickHooked("SecondaryProfession3")); mainFrames.Add(ClickHooked("SecondaryProfession4")); //foreach(Frame frame in InterfaceHelper.GetFrames) //{ // Debug.WriteLine(frame.GetName); //} statusFrames.Add(ClickHooked("PrimaryProfession1StatusBar")); statusFrames.Add(ClickHooked("PrimaryProfession2StatusBar")); statusFrames.Add(ClickHooked("SecondaryProfession1StatusBar")); statusFrames.Add(ClickHooked("SecondaryProfession2StatusBar")); statusFrames.Add(ClickHooked("SecondaryProfession3StatusBar")); statusFrames.Add(ClickHooked("SecondaryProfession4StatusBar")); int x = 0; foreach (Frame frame in mainFrames) { List <Frame> frameChildren = frame.GetChilds; Profession profession = new Profession(); profession.Name = frameChildren.ElementAt(0).GetText; int p = x > 1 ? 1 : 3; profession.Rank = RankFactory.getRank(frameChildren.ElementAt(p).GetText); Frame statusFrame = statusFrames.ElementAt(x); List <Frame> statusChildren = statusFrame.GetChilds; String[] levels = statusChildren.ElementAt(0).GetText.Split('/'); profession.Level = int.Parse(levels[0]); professions.addProfession(profession, professions); x++; } //ClickHooked("PrimaryProfession1"); //ClickHooked("PrimaryProfession1StatusBar"); //ClickHooked("ArchaeologyFrameSummaryPageRace4"); professions.parseProfession(); Thread.Sleep(1000); CloseFrames(); Thread.Sleep(1000); professions.callback(); }
/** * Call back function for when the professions class has been populated **/ public static void professionsReady(Professions p) { //setting the professions to the form settingsForm.Professions = p; //telling the form to change the labels to the returned results settingsForm.createDisplay(); //creating a local reference to the professions professions = p; professionsLoaded = true; //start live updating if (!workerThread.IsAlive) { workerThread.Start(); } }
public static void getProfessions() { //creates a callback function to return professions when it is finished Action<Professions> callback = delegate(Professions p) { professionsReady(p); }; //the constructor on Professions with automatically populate itself Professions professions = new Professions(callback); }
internal void addProfession(Profession profession, Professions professions) { if (profession.Name != "") { switch (profession.Name) { case "Mining": professions.addPProfession(profession); break; case "Skinning": professions.addPProfession(profession); break; case "Herbalism": professions.addPProfession(profession); break; case "Alchemy": professions.addPProfession(profession); break; case "Blacksmithing": professions.addPProfession(profession); break; case "Engineering": professions.addPProfession(profession); break; case "Enchanting": professions.addPProfession(profession); break; case "Inscription": professions.addPProfession(profession); break; case "Jewelcrafting": professions.addPProfession(profession); break; case "Leatherworking": professions.addPProfession(profession); break; case "Tailoring": professions.addPProfession(profession); break; case "Cooking": professions.Secondary3 = profession; break; case "Archaeology": professions.Secondary1 = profession; break; case "First Aid": professions.Secondary4 = profession; break; case "Fishing": professions.Secondary2 = profession; break; } } }