Пример #1
0
 private void OnPluginStateChanged(PluginStateChanged state)
 {
     _synccontext?.Post(_ =>
     {
         switch (state)
         {
         case PluginStateChanged.CurrentHDRStateChanged:
             Repaint();
             break;
         }
     }, null);
 }
Пример #2
0
 internal static void RemovePluginFromRunning(IPlugin3 plugin)
 {
     lock (AddRemoveLock)
     {
         if (RunningPlugins.Contains(plugin))
         {
             try
             {
                 plugin.OnStop();
                 PluginWoW.Remove(plugin.Name);
                 log.Info($"[{plugin.Name}] Plug-in is stopped");
             }
             catch (Exception ex)
             {
                 log.Error($"Can't shutdown plug-in [{plugin.Name}]: {ex.Message}");
             }
             Notify.TrayPopup(nameof(AxTools), "Plug-in <" + plugin.Name + "> is stopped", NotifyUserType.Info, false, plugin.TrayIcon);
             _pluginContainers.First(l => l.Plugin.GetType() == plugin.GetType()).IsRunning = false;
             PluginStateChanged?.Invoke(plugin);
         }
     }
 }
Пример #3
0
 internal static void AddPluginToRunning(IPlugin3 plugin, WowProcess process)
 {
     lock (AddRemoveLock)
     {
         if (!RunningPlugins.Contains(plugin))
         {
             _pluginContainers.First(l => l.Plugin.GetType() == plugin.GetType()).IsRunning = true;
             try
             {
                 plugin.OnStart(new GameInterface(process));
                 PluginWoW[plugin.Name] = process.ProcessID;
                 PluginsUsageStats[plugin.Name].Add(DateTime.UtcNow);
                 SavePluginUsageStats();
                 log.Info($"{process} [{plugin.Name}] Plug-in is started");
             }
             catch (Exception ex)
             {
                 log.Error($"Plug-in OnStart error [{plugin.Name}]: {ex.Message}");
             }
             Notify.TrayPopup(nameof(AxTools), "Plug-in <" + plugin.Name + "> is started", NotifyUserType.Info, false, plugin.TrayIcon);
             PluginStateChanged?.Invoke(plugin);
         }
     }
 }