Example #1
0
        private static void OnNewProfile(BotEvents.Profile.NewProfileLoadedEventArgs args)
        {
            var title   = FormatIt("New Profile Loaded: {0}", args.NewProfile.Name);
            var message = FormatIt("Your Honorbuddy instance has changed profile from {1} to {0}.", args.OldProfile.Name, args.NewProfile.Name);

            SendNotification(message, title);
        }
Example #2
0
 private void ProfileOnOnNewOuterProfileLoaded(BotEvents.Profile.NewProfileLoadedEventArgs args)
 {
     if (Util.IsProfessionbuddyProfile(args.NewProfile.XmlElement))
     {
         DoCleanup();
     }
 }
 void Profile_OnNewOuterProfileLoaded(BotEvents.Profile.NewProfileLoadedEventArgs args)
 {
     try
     {
         LoadWayPoints(ProfileManager.CurrentProfile);
     }
     catch (Exception ex) { Logging.WriteException(ex); }
 }
        private static void Profile_OnNewOuterProfileLoaded(BotEvents.Profile.NewProfileLoadedEventArgs args)
        {
            var xmlElement = args.NewProfile.XmlElement;

            if (!Util.IsProfessionbuddyProfile(xmlElement))
            {
                return;
            }

            // prevents HB from reloading current profile when bot is started.
            if (!Instance.IsRunning && ProfileManager.XmlLocation == Instance.CurrentProfile.XmlPath)
            {
                return;
            }

            if (_init)
            {
                var loadProfile = new Action(
                    () =>
                {
                    LoadPBProfile(ProfileManager.XmlLocation, args.NewProfile.XmlElement);
                    if (MainForm.IsValid)
                    {
                        MainForm.Instance.ActionTree.SuspendLayout();
                        if (Instance.ProfileSettings.SettingsDictionary.Count > 0)
                        {
                            MainForm.Instance.AddProfileSettingsTab();
                        }
                        else
                        {
                            MainForm.Instance.RemoveProfileSettingsTab();
                        }
                        MainForm.Instance.ActionTree.ResumeLayout();
                    }
                });

                if (Instance.IsRunning && TreeRoot.IsRunning)
                {
                    Util.ExecuteActionWhileBotIsStopped(loadProfile,
                                                        "Changing profiles (Profile_OnNewOuterProfileLoaded)");
                }
                else
                {
                    loadProfile();
                }
            }
            else
            {
                _profileToLoad = ProfileManager.XmlLocation;
            }
        }
Example #5
0
 private void Profile_OnNewOuterProfileLoaded(BotEvents.Profile.NewProfileLoadedEventArgs args)
 {
     try
     {
         Profile = new AutoAnglerProfile(args.NewProfile, _pathingType, _poolsToFish);
         if (!string.IsNullOrEmpty(ProfileManager.XmlLocation))
         {
             AutoAnglerSettings.Instance.LastLoadedProfile = ProfileManager.XmlLocation;
             AutoAnglerSettings.Instance.Save();
         }
     }
     catch (Exception ex)
     {
         Logging.WriteException(ex);
     }
 }
Example #6
0
        //private static bool _botIsStartingUp;

        private static void Profile_OnNewOuterProfileLoaded(BotEvents.Profile.NewProfileLoadedEventArgs args)
        {
            if (args.NewProfile.XmlElement.Name == "Professionbuddy")
            {
                // prevents HB from reloading current profile when bot is started.
                if (!Instance.IsRunning && ProfileManager.XmlLocation == Instance.CurrentProfile.XmlPath)
                {
                    return;
                }
                if (_init)
                {
                    if (_isChangingBot)
                    {
                        return;
                    }
                    if (Instance.IsRunning)
                    {
                        try
                        {
                            Application.Current.Dispatcher.Invoke(
                                new Action(() =>
                            {
                                TreeRoot.Stop();
                                LoadPBProfile(ProfileManager.XmlLocation);
                                if (MainForm.IsValid)
                                {
                                    if (Instance.ProfileSettings.SettingsDictionary.Count > 0)
                                    {
                                        MainForm.Instance.AddProfileSettingsTab();
                                    }
                                    else
                                    {
                                        MainForm.Instance.RemoveProfileSettingsTab();
                                    }
                                }
                                TreeRoot.Start();
                            }
                                           ));
                        }
                        catch
                        {
                        }
                    }
                    else
                    {
                        LoadPBProfile(ProfileManager.XmlLocation);
                        if (MainForm.IsValid)
                        {
                            if (Instance.ProfileSettings.SettingsDictionary.Count > 0)
                            {
                                MainForm.Instance.AddProfileSettingsTab();
                            }
                            else
                            {
                                MainForm.Instance.RemoveProfileSettingsTab();
                            }
                        }
                    }
                    LastProfileIsHBProfile = false;
                }
                else
                {
                    _profileToLoad = ProfileManager.XmlLocation;
                }
            }
            else if (args.NewProfile.XmlElement.Name == "HBProfile")
            {
                LastProfileIsHBProfile = true;
                _lastProfilePath       = ProfileManager.XmlLocation;
            }
        }
Example #7
0
 private void Profile_OnNewProfileLoaded(BotEvents.Profile.NewProfileLoadedEventArgs args)
 {
     RemoveHook();
 }
 static void Profile_OnNewOuterProfileLoaded(BotEvents.Profile.NewProfileLoadedEventArgs args)
 {
     if (args.NewProfile.XmlElement.Name == "Professionbuddy")
     {
         if (_init)
         {
             if (_isChangingBot)
             {
                 return;
             }
             if (Instance.IsRunning)
             {
                 try
                 {
                     System.Windows.Application.Current.Dispatcher.Invoke(
                         new System.Action(() =>
                     {
                         TreeRoot.Stop();
                         LoadProfile(ProfileManager.XmlLocation);
                         if (MainForm.IsValid)
                         {
                             if (Instance.ProfileSettings.Settings.Count > 0)
                             {
                                 MainForm.Instance.AddProfileSettingsTab();
                             }
                             else
                             {
                                 MainForm.Instance.RemoveProfileSettingsTab();
                             }
                         }
                         if (ProfileManager.CurrentProfile == null || string.IsNullOrEmpty(ProfileManager.XmlLocation))
                         {
                             ProfileManager.LoadEmpty();
                         }
                         TreeRoot.Start();
                     }
                                           ));
                 }
                 catch
                 {
                 }
             }
             else
             {
                 LoadProfile(ProfileManager.XmlLocation);
                 if (MainForm.IsValid)
                 {
                     if (Instance.ProfileSettings.Settings.Count > 0)
                     {
                         MainForm.Instance.AddProfileSettingsTab();
                     }
                     else
                     {
                         MainForm.Instance.RemoveProfileSettingsTab();
                     }
                 }
                 if (ProfileManager.CurrentProfile == null || string.IsNullOrEmpty(ProfileManager.XmlLocation))
                 {
                     ProfileManager.LoadEmpty();
                 }
             }
         }
         else
         {
             _profileToLoad = ProfileManager.XmlLocation;
         }
     }
 }