Beispiel #1
0
        static void Main()
        {
            TryCreateDirectory(BotsPath    = Path.Combine(Application.StartupPath, "Bots"));
            TryCreateDirectory(PluginsPath = Path.Combine(Application.StartupPath, "Plugins"));

            if (FindAvailablePort(out int port))
            {
                Proxy.Instance.ListenerPort = port;
            }
            else
            {
                return;
            }

            HotkeysManager = new HotkeyManager(new KeyboardHook());
            HotkeysManager.LoadHotkeys();

            PluginsManager = new PluginManager();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            /* Plugins most likely add an item to the MainForm menustrip,
             * let the form load before loading any plugins */
            MainForm.Instance.Load += OnMainFormLoaded;
            Application.Run(MainForm.Instance);

            HotkeysManager.Dispose();
            PluginsManager.UnloadAll();
            Proxy.Instance.Stop();
        }
Beispiel #2
0
 protected override void Dispose(bool disposing)
 {
     git?.Dispose();
     icon?.Dispose();
     hotkeys?.Dispose();
     base.Dispose(disposing);
 }
 protected virtual void Dispose(bool disposing)
 {
     if (!_disposed)
     {
         if (disposing)
         {
             if (_hotkeyHandle != 0)
             {
                 _hotkeyManager.UnregisterHotkey(_hotkeyHandle);
             }
             _hotkeyManager.Dispose();
             _disposed = true;
         }
     }
 }
Beispiel #4
0
        private void InitializeHotKeys()
        {
            if (_hotkeyManager != null)
            {
                _hotkeyManager.Dispose();
            }

            _hotkeyManager = new HotkeyManager(this);

            var m = HotKeyModifierKeys.None;

            if (Settings1.Default.HotKeyAlt)
            {
                m |= HotKeyModifierKeys.Alt;
            }
            if (Settings1.Default.HotKeyShift)
            {
                m |= HotKeyModifierKeys.Shift;
            }
            if (Settings1.Default.HotKeyCtrl)
            {
                m |= HotKeyModifierKeys.Control;
            }

            // In case we run for the first time and there is no config save
            if (m == HotKeyModifierKeys.None)
            {
                m |= HotKeyModifierKeys.Control;
            }

            _hotkeyManager.RegisterHotKey(m, Keys.D1);
            _hotkeyManager.RegisterHotKey(m, Keys.D2);
            _hotkeyManager.RegisterHotKey(m, Keys.D3);
            _hotkeyManager.RegisterHotKey(m, Keys.D4);
            _hotkeyManager.RegisterHotKey(m, Keys.D0);
        }
Beispiel #5
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    if (_hotkeyHandle != 0)
                    {
                        HotkeyManager?.UnregisterHotkey(_hotkeyHandle);
                    }

                    HotkeyManager?.Dispose();
                    _updateSource?.Dispose();
                    _disposed = true;
                }
            }
        }
 public void Dispose()
 {
     _hotkeyManager.Dispose();
     _hotkeyManager = null;
     _container     = null;
 }
Beispiel #7
0
 public void Dispose()
 {
     git?.Dispose();
     notificationService?.Dispose();
     hotkeys?.Dispose();
 }