Esempio n. 1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            MyHide();
            UpdateDevice(AudioController.DefaultCaptureDevice);
            AudioController.AudioDeviceChanged.Subscribe(OnNextDevice);

            var timer = new Timer()
            {
                Interval = 500, Enabled = true
            };

            timer.Tick += Timer_Tick;

            timer.Start();


            var hotkeyValue = registryKey.GetValue(registryKeyName);

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

            //AudioController.AudioDeviceChanged.Subscribe(x =>
            //{
            //    Debug.WriteLine("{ 0} - {1}", x.Device.Name, x.ChangedType.ToString());
            //});
        }
Esempio n. 2
0
 private void BindUniversalHotKey()
 {
     _hotKeyBinder.Bind(Modifiers.Shift ^ Modifiers.Win, Keys.D).To(() =>
     {
         if (!IsVisible || _initFlag)
         {
             Show();
         }
         else
         {
             Hide();
         }
     });
 }
Esempio n. 3
0
 private void InitializeHotkeyBinder()
 {
     try //In case another application already uses the hotkey (In my case ShareX)
     {
         _hotkeyBinder.Bind(Modifiers.Control | Modifiers.Alt, Keys.Z).To(CaptureRegion);
         _hotkeyBinder.Bind(Modifiers.None, Keys.PrintScreen).To(CaptureFullScreen);
     }
     catch (Exception e)
     {
         MessageBox.Show(
             "The Application was unable to bind the Shortcuts" + Environment.NewLine +
             "This normally happens when another application is already using the Hotkey:" + Environment.NewLine +
             "\"PRINTSCREEN\"", "Unable to bind the hotkey", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 4
0
        public void BindKeywords()
        {
            var toggleModifier1 = Helper.ParseModifier(IniFile.IniReadValue(Consts.ToggleHotkeySectionName,
                                                                            Consts.ModifierKeyName));
            var toggleKey = Helper.ParseKey(IniFile.IniReadValue(Consts.ToggleHotkeySectionName,
                                                                 Consts.KeyKeyName));

            var saveModifier1 = Helper.ParseModifier(IniFile.IniReadValue(Consts.SaveHotkeySectionName,
                                                                          Consts.ModifierKeyName));
            var saveKey = Helper.ParseKey(IniFile.IniReadValue(Consts.SaveHotkeySectionName,
                                                               Consts.KeyKeyName));

            if (saveModifier1 != Modifiers.None && saveKey != Keys.None)
            {
                SaveHotKey = new Hotkey(saveModifier1, saveKey);
                HotkeyBinder.Bind(SaveHotKey).To(HotkeyCallback);
            }
            if (toggleModifier1 != Modifiers.None && toggleKey != Keys.None)
            {
                ToggleHotKey = new Hotkey(toggleModifier1, toggleKey);
                HotkeyBinder.Bind(ToggleHotKey).To(ToggleTheWindow);
            }

            HotkeyBinder.Bind(Modifiers.None, Keys.Down).To(FoucsToListViewAndDown);
            HotkeyBinder.Bind(Modifiers.None, Keys.Up).To(FoucsToListViewAndUp);
        }
Esempio n. 5
0
        private static void Main()
        {
            System.Console.WriteLine("Run this application and press Ctrl + F");
            _hotkeyBinder.Bind(Modifiers.Control, Keys.F).To(HotkeyCallback);

            // Calling Run is the key to using Shortcut with console applications.
            //
            Application.Run();
        }
Esempio n. 6
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. 7
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. 8
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());
            //});
        }
Esempio n. 9
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            try {
                hotkey = new Hotkey(Modifiers.Control, Keys.A);
                hotkeyBinder.Bind(hotkey).To(ToggleMicStatus);
            } catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
            var device = AudioController.DefaultCaptureDevice;

            //проверяем доступность микрофона при старте
            if (device.IsMuted)
            {
                MicOFF();
                micMuteStatus = true;
            }
            else
            {
                MicON();
                micMuteStatus = false;
            }
            UpdateDevice(AudioController.DefaultCaptureDevice);
            AudioController.AudioDeviceChanged.Subscribe(OnNextDevice);
        }
Esempio n. 10
0
 private void InitialzeHotkeyBindings()
 {
     _hotkeyBinder.Bind(Modifiers.Control, Keys.F).To(HotkeyCallback);
 }
Esempio n. 11
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. 12
0
 private void Window_Initialized(object sender, EventArgs e)
 {
     _hotkeyBinder.Bind(Modifiers.Control, Keys.F).To(HotkeyCallback);
 }
Esempio n. 13
0
 private void InitializeHotkeyBinder()
 {
     hotkeyBinder.Bind(Settings.Default.CaptureAreaHotkey).To(CaptureArea);
     hotkeyBinder.Bind(Settings.Default.CaptureFullscreenHotkey).To(CaptureFullscreen);
     hotkeyBinder.Bind(Settings.Default.CaptureActiveWindowHotkey).To(CaptureActiveWindow);
 }