예제 #1
0
 public void DisableDevicesSimple()
 {
     // Mute the microphone.
     try
     {
         WindowsMicrophoneMuteLibrary.WindowsMicMute micMute = new WindowsMicMute();
         micMute.MuteMic();
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Couldn't mute mic " + ex.Message);
     }
     this.devcon.StartInfo.Arguments = "disable =Image";
     this.devcon.Start();
     while (!this.devcon.StandardOutput.EndOfStream)
     {
         string line = this.devcon.StandardOutput.ReadLine();
         Debug.WriteLine(line);
     }
     this.devcon.StartInfo.Arguments = "disable =MEDIA";
     this.devcon.Start();
     while (!this.devcon.StandardOutput.EndOfStream)
     {
         string line = this.devcon.StandardOutput.ReadLine();
         Debug.WriteLine(line);
     }
 }
예제 #2
0
        private static void Main()
        {
            var micMute = new WindowsMicMute();

            if (micMute.IsMicMuted)
            {
                micMute.UnMuteMic();
            }
            else
            {
                micMute.MuteMic();
            }

            var micStatus = (micMute.IsMicMuted ? string.Empty : "un") + "muted";

            try
            {
                CueSettingsSdk(micMute.IsMicMuted);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }

            ToastNotification("Mic is " + micStatus, micStatus);
        }
예제 #3
0
 private void Mute()
 {
     if (!muted)
     {
         muted = true;
         theMic.MuteMic();
         notifyIcon1.Icon = Properties.Resources.muted;
     }
 }
예제 #4
0
 public void DisableDevices(List <string> deviceNames = null)
 {
     // Mute the microphone.
     try
     {
         WindowsMicrophoneMuteLibrary.WindowsMicMute micMute = new WindowsMicMute();
         micMute.MuteMic();
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Couldn't mute mic " + ex.Message);
     }
     if (deviceNames == null)
     {
         AddDefaultDevicesToDisable();
     }
     else
     {
         KeyValuePair <string, string> deviceTemp;
         foreach (string name in deviceNames)
         {
             deviceTemp = FindDeviceByString(name);
             if (!deviceTemp.Equals(default(KeyValuePair <string, string>)))
             {
                 AddDeviceToDisable(deviceTemp);
             }
         }
     }
     // Loops through the list of devices to disable, and disable with devcon.
     foreach (string deviceID in DisabledDeviceIDsToList())
     {
         Debug.WriteLine("Attempting to disable " + deviceID);
         if (DisableDeviceByString(deviceID))
         {
             Debug.WriteLine("Device disabled : " + deviceID);
             currentlyDisabledDeviceDictionary.Add(deviceID, FindDeviceNameByString(deviceID));
         }
         else
         {
             Debug.WriteLine("Unable to disable device by string : " + deviceID);
         }
     }
 }
예제 #5
0
 public void Speak(string s)
 {
     mute.MuteMic();
     speech.SpeakAsync(s);
 }