示例#1
0
 public int SetDefaultDevice(string deviceID)
 {
     _policyConfigVistaClient.SetDefaultEndpoint(deviceID, ERole.eConsole);
     _policyConfigVistaClient.SetDefaultEndpoint(deviceID, ERole.eMultimedia);
     _policyConfigVistaClient.SetDefaultEndpoint(deviceID, ERole.eCommunications);
     return(0);
 }
示例#2
0
        public static void SetDefaultEndpoint(string devId, ERole eRole)
        {
            object o = (object)null;

            try
            {
                o = GetPolicyConfig();
                IPolicyConfigX     policyConfigX     = o as IPolicyConfigX;
                IPolicyConfig      policyConfig      = o as IPolicyConfig;
                IPolicyConfigVista policyConfigVista = o as IPolicyConfigVista;
                if (policyConfig != null)
                {
                    policyConfig.SetDefaultEndpoint(devId, eRole);
                }
                else if (policyConfigVista != null)
                {
                    policyConfigVista.SetDefaultEndpoint(devId, eRole);
                }
                else
                {
                    policyConfigX?.SetDefaultEndpoint(devId, eRole);
                }
            }
            finally
            {
                if (o != null && Marshal.IsComObject(o))
                {
                    Marshal.FinalReleaseComObject(o);
                }
                GC.Collect();
            }
        }
示例#3
0
 public void SetDefaultEndpoint(string devID, DeviceRoles eRole)
 {
     if (_PolicyConfig != null)
     {
         Marshal.ThrowExceptionForHR(_PolicyConfig.SetDefaultEndpoint(devID, eRole));
         return;
     }
     if (_PolicyConfigVista != null)
     {
         Marshal.ThrowExceptionForHR(_PolicyConfigVista.SetDefaultEndpoint(devID, eRole));
         return;
     }
     if (_PolicyConfig10 != null)
     {
         Marshal.ThrowExceptionForHR(_PolicyConfig10.SetDefaultEndpoint(devID, eRole));
     }
 }
示例#4
0
 public void SetDefaultEndpoint(string deviceId, NAudio.CoreAudioApi.Role role)
 {
     if (_PolicyConfig != null)
     {
         Marshal.ThrowExceptionForHR(_PolicyConfig.SetDefaultEndpoint(deviceId, role));
         return;
     }
     if (_PolicyConfigVista != null)
     {
         Marshal.ThrowExceptionForHR(_PolicyConfigVista.SetDefaultEndpoint(deviceId, role));
         return;
     }
     if (_PolicyConfig10 != null)
     {
         Marshal.ThrowExceptionForHR(_PolicyConfig10.SetDefaultEndpoint(deviceId, role));
     }
 }
示例#5
0
 public void SetDefaultEndpoint(string wszDeviceId, ERole eRole)
 {
     Marshal.ThrowExceptionForHR(_RealPolicyConfigVista.SetDefaultEndpoint(wszDeviceId, eRole));
 }
示例#6
0
 public int SetDefaultDevice(string deviceID, ERole role)
 {
     _policyConfigVistaClient.SetDefaultEndpoint(deviceID, role);
     return(0);
 }