コード例 #1
0
        public static void Init(ShadowsocksController controller)
        {
            _hotKeyManager             = new HotKeyManager();
            _hotKeyManager.KeyPressed += HotKeyManagerPressed;

            HotkeyCallbacks.InitInstance(controller);
        }
コード例 #2
0
        public static void InitInstance(ShadowsocksController controller)
        {
            if (Instance != null)
            {
                return;
            }

            Instance = new HotkeyCallbacks(controller);
        }
コード例 #3
0
        public static void InitInstance()
        {
            if (Instance != null)
            {
                return;
            }

            Instance = new HotkeyCallbacks();
        }
コード例 #4
0
        public static void InitInstance(ShadowsocksController controller)
        {
            if (Instance != null)
            {
                return;
            }

            Instance = new HotkeyCallbacks(controller);
        }
コード例 #5
0
 public static void Destroy()
 {
     if (Instance == null)
     {
         return;
     }
     Instance = new HotkeyCallbacks(false);
     Instance = null;
 }
コード例 #6
0
        public static void InitInstance(ShadowsocksController controller, View.MenuViewController menu)
        {
            if (Instance != null)
            {
                return;
            }

            Instance = new HotkeyCallbacks(controller, menu);
        }
コード例 #7
0
 public static void Destroy()
 {
     if (_hotKeyManager != null)
     {
         _hotKeyManager.KeyPressed -= HotKeyManagerPressed;
         _hotKeyManager.Dispose();
         _hotKeyManager = null;
     }
     HotkeyCallbacks.Destroy();
     IshotKeyManagerRunning = false;
 }
コード例 #8
0
        public static void Init()
        {
            IshotKeyManagerRunning = true;
            if (_hotKeyManager == null)
            {
                _hotKeyManager = new HotKeyManager();
            }
            _hotKeyManager.KeyPressed += HotKeyManagerPressed;

            HotkeyCallbacks.InitInstance();
        }
コード例 #9
0
        public static void Init(ShadowsocksController controller, View.MenuViewController menu)
        {
            _hotKeyManager             = new HotKeyManager();
            _hotKeyManager.KeyPressed += HotKeyManagerPressed;

            HotkeyCallbacks.InitInstance(controller, menu);

            var keys = controller.GetConfigurationCopy()?.hotkey ?? new HotkeyConfig();

            LoadConfiguration(keys);
        }
コード例 #10
0
 private static void LoadConfiguration(HotkeyConfig config)
 {
     foreach (var pi in config.GetType().GetProperties())
     {
         var pv = pi.GetValue(config, null);
         if (pv is string str)
         {
             var hotkey = Str2HotKey(str);
             if (hotkey != null)
             {
                 var callbackName = pi.Name + "Callback";
                 if (HotkeyCallbacks.GetCallback(callbackName) is HotKeyCallBackHandler callback)
                 {
                     if (IsCallbackExists(callback, out var prevHotKey))
                     {
                         UnRegist(prevHotKey);
                     }
                     var regResult = Regist(hotkey, callback);
                     Logging.Info($"Reg {str} to {pi.Name}{(regResult ? "Successful" : "Fail")}");
                 }
             }
         }
     }
 }