Esempio n. 1
0
 private void BindHotkeys()
 {
     hotkeyBinder.Bind(Modifiers.None, Keys.Space).To(KeyboardSplit);
     hotkeyBinder.Bind(Modifiers.None, Keys.Multiply).To(KeyboardReset);
     hotkeyBinder.Bind(Modifiers.None, Keys.Subtract).To(KeyboardUnsplit);
     hotkeyBinder.Bind(Modifiers.None, Keys.Divide).To(KeyboardSkip);
     hotkeyBinder.Bind(Modifiers.None, Keys.Decimal).To(KeyboardPause);
     if (!hotkeyBinder.IsHotkeyAlreadyBound(hotkeyTrigger))
     {
         hotkeyBinder.Bind(hotkeyTrigger).To(ToggleGlobalHotkeys);
     }
 }
Esempio n. 2
0
        public void Init(IntPtr owner)
        {
            _owner = owner;

            _hotkeyCombination = new Hotkey(Modifiers.Control | Modifiers.Shift, Keys.C);

            if (_hotkeyBinder.IsHotkeyAlreadyBound(_hotkeyCombination))
            {
                return;
            }

            _hotkeyBinder.Bind(_hotkeyCombination).To(HotkeyCallback);
            Application.ApplicationExit += Application_ApplicationExit;
        }
Esempio n. 3
0
        private void UnBindHotKey()
        {
            if (_hotKeyBinder.IsHotkeyAlreadyBound(new Hotkey(Modifiers.None, Keys.Escape)))
            {
                _hotKeyBinder.Unbind(Modifiers.None, Keys.Escape);
            }

            if (_hotKeyBinder.IsHotkeyAlreadyBound(new Hotkey(Modifiers.None, Keys.Up)))
            {
                _hotKeyBinder.Unbind(Modifiers.None, Keys.Up);
            }
            if (_hotKeyBinder.IsHotkeyAlreadyBound(new Hotkey(Modifiers.None, Keys.Down)))
            {
                _hotKeyBinder.Unbind(Modifiers.None, Keys.Down);
            }

            foreach (var t in _digitHotkeys)
            {
                if (_hotKeyBinder.IsHotkeyAlreadyBound(t))
                {
                    _hotKeyBinder.Unbind(t);
                }
            }
        }
Esempio n. 4
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (MyVisible)
            {
                MyHide();
                e.Cancel = true;

                hotkey = hotkeyTextBox.Hotkey;

                if (hotkey == null)
                {
                    registryKey.DeleteValue(registryKeyName, false);
                }
                else
                {
                    if (!hotkeyBinder.IsHotkeyAlreadyBound(hotkey))
                    {
                        registryKey.SetValue(registryKeyName, hotkey);
                        hotkeyBinder.Bind(hotkey).To(ToggleMicStatus);
                    }
                }
            }
        }
Esempio n. 5
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            MyHide();
            selectedDeviceId   = (string)registryKey.GetValue(registryDeviceId) ?? "";
            selectedDeviceName = (string)registryKey.GetValue(registryDeviceName) ?? DEFAULT_RECORDING_DEVICE;

            UpdateSelectedDevice();
            AudioController.AudioDeviceChanged.Subscribe(OnNextDevice);

            // toggle
            var hotkeyValue = registryKey.GetValue(registryKeyName);

            if (hotkeyValue != null)
            {
                var converter = new Shortcut.Forms.HotkeyConverter();
                hotkey = (Hotkey)converter.ConvertFromString(hotkeyValue.ToString());
                if (!hotkeyBinder.IsHotkeyAlreadyBound(hotkey))
                {
                    hotkeyBinder.Bind(hotkey).To(ToggleMicStatus);
                }
            }

            // mute
            hotkeyValue = registryKey.GetValue(registryKeyMute);
            if (hotkeyValue != null)
            {
                var converter = new Shortcut.Forms.HotkeyConverter();
                muteHotkey = (Hotkey)converter.ConvertFromString(hotkeyValue.ToString());
                if (!hotkeyBinder.IsHotkeyAlreadyBound(muteHotkey))
                {
                    hotkeyBinder.Bind(muteHotkey).To(MuteMicStatus);
                }
            }

            // unmute
            hotkeyValue = registryKey.GetValue(registryKeyUnmute);
            if (hotkeyValue != null)
            {
                var converter = new Shortcut.Forms.HotkeyConverter();
                unMuteHotkey = (Hotkey)converter.ConvertFromString(hotkeyValue.ToString());
                if (!hotkeyBinder.IsHotkeyAlreadyBound(unMuteHotkey))
                {
                    hotkeyBinder.Bind(unMuteHotkey).To(UnMuteMicStatus);
                }
            }

            //AudioController.AudioDeviceChanged.Subscribe(x =>
            //{
            //    Debug.WriteLine("{0} - {1}", x.Device.Name, x.ChangedType.ToString());
            //});

            if (Properties.Settings.Default.EnableMicStatusOverlay)
            {
                this.chkShowMicStatus.Checked        = Properties.Settings.Default.EnableMicStatusOverlay;
                this.mnuItemMicStatusOverlay.Checked = true;
                this.trackBarTransparency.Value      = Properties.Settings.Default.MicStatusFormTranparency;
                this.labelBackgroundColor.BackColor  = Properties.Settings.Default.MicStatusFormBackground;
                this.colorDialog1.Color = Properties.Settings.Default.MicStatusFormBackground;
                ShowMicStatusOverlay();
            }
        }
Esempio n. 6
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            MyHide();
            selectedDeviceId   = (string)registryKey.GetValue(registryDeviceId) ?? "";
            selectedDeviceName = (string)registryKey.GetValue(registryDeviceName) ?? DEFAULT_RECORDING_DEVICE;

            UpdateSelectedDevice();
            AudioController.AudioDeviceChanged.Subscribe(OnNextDevice);

            // toggle
            var hotkeyValue = registryKey.GetValue(registryKeyName);

            if (hotkeyValue != null)
            {
                var converter = new Shortcut.Forms.HotkeyConverter();
                hotkey = (Hotkey)converter.ConvertFromString(hotkeyValue.ToString());
                if (!hotkeyBinder.IsHotkeyAlreadyBound(hotkey))
                {
                    hotkeyBinder.Bind(hotkey).To(ToggleMicStatus);
                }
            }

            // mute
            hotkeyValue = registryKey.GetValue(registryKeyMute);
            if (hotkeyValue != null)
            {
                var converter = new Shortcut.Forms.HotkeyConverter();
                muteHotkey = (Hotkey)converter.ConvertFromString(hotkeyValue.ToString());
                if (!hotkeyBinder.IsHotkeyAlreadyBound(muteHotkey))
                {
                    hotkeyBinder.Bind(muteHotkey).To(MuteMicStatus);
                }
            }

            // unmute
            hotkeyValue = registryKey.GetValue(registryKeyUnmute);
            if (hotkeyValue != null)
            {
                var converter = new Shortcut.Forms.HotkeyConverter();
                unMuteHotkey = (Hotkey)converter.ConvertFromString(hotkeyValue.ToString());
                if (!hotkeyBinder.IsHotkeyAlreadyBound(unMuteHotkey))
                {
                    hotkeyBinder.Bind(unMuteHotkey).To(UnMuteMicStatus);
                }
            }

            //AudioController.AudioDeviceChanged.Subscribe(x =>
            //{
            //    Debug.WriteLine("{0} - {1}", x.Device.Name, x.ChangedType.ToString());
            //});
        }