コード例 #1
0
ファイル: MainForm.cs プロジェクト: Fry2412/MicMute
        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());
            //});
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: Anc813/MicMute
        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());
            //});
        }
コード例 #3
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();
            }
        }