Example #1
0
 private void SwitchWoWPlugin()
 {
     buttonStartStopPlugin.Enabled = false;
     if (PluginManager.ActivePlugin == null)
     {
         if (comboBoxWowPlugins.SelectedIndex != -1)
         {
             if (WoWManager.Hooked || WoWManager.HookWoWAndNotifyUserIfError())
             {
                 if (WoWManager.WoWProcess.IsInGame)
                 {
                     PluginManager.StartPlugin(PluginManager.Plugins.First(i => i.Name == comboBoxWowPlugins.Text));
                 }
                 else
                 {
                     Utils.NotifyUser("Plugin error", "Player isn't logged in", NotifyUserType.Error, true);
                 }
             }
         }
         else
         {
             Utils.NotifyUser("Plugin error", "You didn't select valid plugin", NotifyUserType.Error, true);
         }
     }
     else
     {
         try
         {
             PluginManager.StopPlugin();
             //GC.Collect();
         }
         catch
         {
             Log.Print("Plugin task failed to cancel", true);
             Utils.NotifyUser("Plugin error", "Fatal error: please restart AxTools", NotifyUserType.Error, true);
         }
     }
     buttonStartStopPlugin.Enabled = true;
 }
Example #2
0
 private static void StartWoWModule <T>() where T : Form, IWoWModule, new()
 {
     if (!WoWManager.Hooked)
     {
         if (WoWManager.HookWoWAndNotifyUserIfError())
         {
             new T().Show();
         }
     }
     else
     {
         T form = Utils.FindForm <T>();
         if (form != null)
         {
             form.Activate();
         }
         else
         {
             new T().Show();
         }
     }
 }