示例#1
0
        public MMDevice GetDefaultAudioEndpoint(EDataFlow dataFlow, ERole role)
        {
            IMMDevice result;

            Marshal.ThrowExceptionForHR(_deviceEnumerator.GetDefaultAudioEndpoint(dataFlow, role, out result));
            return(new MMDevice(result));
        }
示例#2
0
 public User(Email email, ERole role)
 {
     Email    = email;
     Role     = role;
     Active   = false;
     CreateAt = DateTime.Now.Date;
 }
        void GetIndex(int deviceNum)
        {
            ERole role = (ERole)deviceNum;

            if (role == ERole.HMD)
            {
                devices[deviceNum].index = (int)EIndex.Hmd;
                return;
            }

            int DeviceCount = 0;

            for (uint i = 0; i < (uint)EIndex.Limit; i++)
            {
                ETrackedPropertyError error = new ETrackedPropertyError();
                ETrackedDeviceClass   type  = (ETrackedDeviceClass)OpenVR.System.GetInt32TrackedDeviceProperty(i, ETrackedDeviceProperty.Prop_DeviceClass_Int32, ref error);

                if (pTrackingToUse == ETrackedDeviceClass.Controller && type == ETrackedDeviceClass.Controller ||
                    pTrackingToUse == ETrackedDeviceClass.GenericTracker && type == ETrackedDeviceClass.GenericTracker)
                {
                    if (role == ERole.LeftHand && DeviceCount == 0 || role == ERole.RightHand && DeviceCount == 1)
                    {
                        devices[deviceNum].index = (int)i;
                        return;
                    }

                    DeviceCount++;
                }
            }
        }
        /// <summary>
        /// Creator: Chase Schulte
        /// Created: 02/07/2020
        /// Approver: Kaleb Bachert
        ///
        /// Insert a role the database by invoking the "sp_delete_eRole" stored procedure
        /// </summary>
        ///
        /// <remarks>
        /// Updater
        /// Updated:
        /// Update:
        /// </remarks>
        /// <param name="eRoleID"></param>
        /// <param name="DepartmentID"></param>
        /// <param name="description"></param>
        /// <returns></returns>
        public int InsertERole(ERole eRole)
        {
            int nonQueryResults;

            //Conn
            var conn = DBConnection.GetConnection();

            //Cmd
            var cmd = new SqlCommand("sp_insert_eRole", conn);

            cmd.CommandType = CommandType.StoredProcedure;

            //Param
            cmd.Parameters.AddWithValue("@ERoleID", eRole.ERoleID);
            cmd.Parameters.AddWithValue("@DepartmentID", eRole.DepartmentID);
            cmd.Parameters.AddWithValue("@Description", eRole.Description);

            //Execute Command
            try
            {
                //Open conn
                conn.Open();
                nonQueryResults = cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }
            return(nonQueryResults);
        }
示例#5
0
        public MMDevice GetDefaultAudioEndpoint(EDataFlow dataFlow, ERole role)
        {
            IMMDevice _Device;

            Marshal.ThrowExceptionForHR(_realEnumerator.GetDefaultAudioEndpoint(dataFlow, role, out _Device));
            return(new MMDevice(_Device));
        }
        public MMDevice GetDefaultAudioEndpoint(EDataFlow dataFlow, ERole role)
        {
            IMMDevice?immDevice;
            var       result = _mmDeviceEnumerator.GetDefaultAudioEndpoint(dataFlow, role, out immDevice);

            if (result != WindowsApi.S_OK)
            {
                if (result == WindowsApi.E_NOTFOUND)
                {
                    throw new NoDeviceIsAvailableException();
                }
                else
                {
                    // TODO: consider throwing more granular exceptions here
                    throw new COMException("IMMDeviceEnumerator.GetDefaultAudioEndpoint failed", Marshal.GetExceptionForHR(result));
                }
            }

            if (immDevice == null)
            {
                // NOTE: this code should never be executed since GetDefaultAudioEndpoint should have returned an HRESULT of E_POINTER if it failed
                throw new COMException("IMMDeviceEnumerator.GetDefaultAudioEndpoint returned a null pointer", new NullReferenceException());
            }

            var mmDevice = MMDevice.CreateFromIMMDevice(immDevice !);

            return(mmDevice);
        }
示例#7
0
文件: GameCreator.cs 项目: Dumba/Bang
        public ERole[] GenerateRoles(int playerCount)
        {
            ERole[] roles;
            switch (playerCount)
            {
            case 4:
                roles = new ERole[] { ERole.sheriff, ERole.outlaw, ERole.outlaw, ERole.renegade };
                break;

            case 5:
                roles = new ERole[] { ERole.sheriff, ERole.outlaw, ERole.outlaw, ERole.renegade, ERole.vice };
                break;

            case 6:
                roles = new ERole[] { ERole.sheriff, ERole.outlaw, ERole.outlaw, ERole.outlaw, ERole.renegade, ERole.vice };
                break;

            case 7:
                roles = new ERole[] { ERole.sheriff, ERole.outlaw, ERole.outlaw, ERole.outlaw, ERole.renegade, ERole.vice, ERole.vice };
                break;

            default:
                throw new Exception("Invalid player count");
            }

            roles = roles.OrderBy(r => _random.Next()).ToArray();

            return(roles);
        }
 public MMDevice GetDefaultAudioEndpoint(EDataFlow dataFlow, ERole role)
 {
     IMMDevice _Device = null;
     //Marshal.ThrowExceptionForHR(((IMMDeviceEnumerator)_realEnumerator).GetDefaultAudioEndpoint(dataFlow, role, out _Device));
     _realEnumerator.GetDefaultAudioEndpoint(dataFlow, role, out _Device);
     return new MMDevice(_Device);
 }
示例#9
0
        public Role(ERole id)
        {
            Id   = id;
            Name = id.GetDescription();

            Users = new List <User>();
        }
示例#10
0
        public void TestPUUserERolesRetrieveSuccess()
        {
            int sameValues = 0;
            //Arrange
            ERole ERole = new ERole()
            {
                PUUserID = 100000
            };
            IPetUniverseUserERolesManager _userERoleManager = new PetUniverseUserERolesManager(_pUUserERoleAccessor);
            //Act
            List <string> actualResult   = _userERoleManager.RetrievePetUniverseUserERolesByPetUniverseUser(ERole.PUUserID);
            List <string> expectedResult = new List <string>()
            {
                "Manager"
            };

            //Assert
            foreach (var actual in actualResult)
            {
                foreach (var expected in expectedResult)
                {
                    if (expected == actual)
                    {
                        sameValues++;
                    }
                }
            }
            Assert.AreEqual(sameValues, 1);
        }
            /*/
             * /// <summary>
             * /// IMMNotificationClient : OnDeviceStateChanged
             * /// </summary>
             * /// <param name="deviceId"></param>
             * /// <param name="newState"></param>
             * public void OnDeviceStateChanged(
             *          [MarshalAs(UnmanagedType.LPWStr)] string deviceId,
             *          [MarshalAs(UnmanagedType.U4)] EDeviceState newState)
             * {
             *  // Console.WriteLine("OnDeviceStateChanged: deviceId="+ deviceId +", state=" + newState);
             *
             *  if (newState == EDeviceState.Active)
             *  {
             *      //Console.WriteLine("Active");
             *  }
             *  else if (newState == EDeviceState.NotPresent)
             *  {
             *      // Console.WriteLine("NotPresent");
             *  }
             *  //releaseDevice();
             *  //initDevice();
             * }
             *
             * /// <summary>
             * /// IMMNotificationClient : OnDeviceAdded
             * /// </summary>
             * /// <param name="deviceId"></param>
             * public void OnDeviceAdded([MarshalAs(UnmanagedType.LPWStr)] string deviceId)
             * {
             *  //Console.WriteLine("OnDeviceAdded:" + deviceId);
             * }
             *
             * /// <summary>
             * /// IMMNotificationClient : OnDeviceRemoved
             * /// </summary>
             * /// <param name="deviceId"></param>
             * public void OnDeviceRemoved(
             *  [MarshalAs(UnmanagedType.LPWStr)] string deviceId)
             * {
             *  //Console.WriteLine("OnDeviceRemoved:" + deviceId);
             * }
             * /// <summary>
             * /// IMMNotificationClient : OnPropertyValueChanged
             * /// </summary>
             * /// <param name="deviceId"></param>
             * /// <param name="propertyKey"></param>
             * public void OnPropertyValueChanged(
             *  [MarshalAs(UnmanagedType.LPWStr)] string deviceId, PropertyKey propertyKey)
             * {
             *  //Console.WriteLine("OnPropertyValueChanged:" + deviceId);
             * }
             * //*/

            /// <summary>
            /// IMMNotificationClient : OnDefaultDeviceChanged
            /// </summary>
            /// <param name="dataFlow"></param>
            /// <param name="deviceRole"></param>
            /// <param name="defaultDeviceId"></param>
            public void OnDefaultDeviceChanged(
                [MarshalAs(UnmanagedType.I4)] EDataFlow dataFlow,
                [MarshalAs(UnmanagedType.I4)] ERole deviceRole,
                [MarshalAs(UnmanagedType.LPWStr)] string defaultDeviceId)
            {
                //Console.WriteLine("OnDefaultDeviceChanged:  DeviceId:[" + defaultDeviceId + "] EDataFlow:[" + dataFlow+ "] ERole:[" + deviceRole+"]");
                if (dataFlow != monitor.DataFlow || deviceRole != monitor.Role)
                {
                    return;
                }


                var dispatcher = Application.Current.Dispatcher;

                //dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate () {
                dispatcher.Invoke((Action) delegate()
                {
                    monitor.updateDevice(defaultDeviceId);

                    // if (monitor.listener == null)
                    // {
                    //    return;
                    //}
                    //
                    //monitor.listener.OnDeviceChanged(monitor.device);

                    Debug.WriteLine($"OnDefaultDeviceChanged flow={dataFlow} role={deviceRole} device={defaultDeviceId} list={(_OnAudioDeviceChanged?.GetInvocationList().Length ?? 0)}");
                    _OnAudioDeviceChanged?.Invoke(monitor.device);
                });
            }
示例#12
0
 public User(string username, string password, string email, ERole role)
 {
     Username = username;
     Password = password;
     Email    = email;
     Role     = role;
 }
示例#13
0
        protected override void Seed(Library.Data.LibraryContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data.

            DateTime dateTime = DateTime.Now;

            ERole preminiumUser = new ERole
            {
                Name            = "Preminium",
                CreatedDateTime = dateTime
            };

            ERole user = new ERole
            {
                Name            = "User",
                CreatedDateTime = dateTime
            };

            ERole administrator = new ERole
            {
                Name            = "Administrator",
                CreatedDateTime = dateTime
            };

            context.Set <ERole>().AddOrUpdate(new ERole[] { administrator, user, preminiumUser });
        }
示例#14
0
        public int OnDefaultDeviceChanged(EDataFlow flow, ERole role, string strDefaultDeviceId)
        {
            DefaultDeviceChangedEventArgs arg = new DefaultDeviceChangedEventArgs(flow, role, strDefaultDeviceId);

            _DeviceEnumerator.FireDefaultDeviceChangedEvent(arg);
            return(0);
        }
示例#15
0
 public void OnDefaultDeviceChanged(
     [MarshalAs(UnmanagedType.I4)] EDataFlow dataFlow,
     [MarshalAs(UnmanagedType.I4)] ERole deviceRole,
     [MarshalAs(UnmanagedType.LPWStr)] string defaultDeviceId)
 {
     parent.FireOnDefaultDeviceChanged(dataFlow, deviceRole, defaultDeviceId);
 }
示例#16
0
 public void OnDefaultDeviceChanged(EDataFlow dataFlow, ERole deviceRole, string defaultDeviceId)
 {
     if (DefaultChanged != null)
     {
         DefaultChanged(defaultDeviceId);
     }
 }
示例#17
0
        void DeviceChanged(
            [MarshalAs(UnmanagedType.I4)] EDataFlow dataFlow,
            [MarshalAs(UnmanagedType.I4)] ERole deviceRole,
            [MarshalAs(UnmanagedType.LPWStr)] string defaultDeviceId)
        {
            if (deviceRole != this.Role)
            {
                return;
            }

            var dispatcher = Application.Current.Dispatcher;

            //dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate () {
            dispatcher.BeginInvoke((Action) delegate()
            {
                if (!Initialized)
                {
                    return;
                }

                Debug.WriteLine($"MicPlayter Stop(DeviceChanged) Role={deviceRole} Flow={dataFlow} ID={defaultDeviceId}");
                Stop();
                Dispose();
                //var newDevice = deviceEnumerator.GetDevice(defaultDeviceId);
            });
        }
示例#18
0
        /// <summary>
        /// Switch the audio endpoint of the given process
        /// </summary>
        /// <param name="deviceId">Id of the device</param>
        /// <param name="role">Which role to switch</param>
        /// <param name="flow">Which flow to switch</param>
        /// <param name="processId">ProcessID of the process</param>
        public void SwitchProcessTo(string deviceId, ERole role, EDataFlow flow, uint processId)
        {
            var roles = new[]
            {
                ERole.eConsole,
                ERole.eCommunications,
                ERole.eMultimedia
            };

            if (role != ERole.ERole_enum_count)
            {
                roles = new[]
                {
                    role
                };
            }

            ComThread.Invoke((() =>
            {
                var currentEndpoint = roles.Select(eRole => ExtendPolicyClient.GetDefaultEndPoint(flow, eRole, processId)).FirstOrDefault(endpoint => !string.IsNullOrEmpty(endpoint));
                if (deviceId.Equals(currentEndpoint))
                {
                    Trace.WriteLine($"Default endpoint for {processId} already {deviceId}");
                    return;
                }

                ExtendPolicyClient.SetDefaultEndPoint(deviceId, flow, roles, processId);
            }));
        }
示例#19
0
    IEnumerator PlotRoutine(ERole ident, Action <string> onPlot, PlotConf conf)
    {
        if (conf._triggerRoleIdent != ident)
        {
            yield break;
        }
        List <SingleConvers> converses = new List <SingleConvers>(conf.conversList);

        while (converses.Count >= 0)
        {
            RoleConf role = GameData._Instance._roleLib.GetRole(converses[0]._roleIdent);
            if (role == null)
            {
                converses.RemoveAt(0);
                continue;
            }

            string s = role._name + (string.IsNullOrEmpty(role._name) ? "" : ":") + converses[0]._convers;
            if (onPlot != null)
            {
                onPlot(s);
            }

            // there is no need to wait if the length of conversation is zero.
            converses.RemoveAt(0);
            if (converses.Count == 0)
            {
                ClearMeetRoutine();
                break;
            }
            yield return(new WaitForSeconds(GameData._Instance._conversSpeed));
        }
    }
 public void SetDefaultEndpoint(string devID, ERole eRole)
 {
     if (_PolicyConfig != null)
     {
         Marshal.ThrowExceptionForHR(_PolicyConfig.SetDefaultEndpoint(devID, eRole));
     }
 }
示例#21
0
        public MMDevice GetDefaultAudioEndpoint(EDataFlow dataFlow, ERole role)
        {
            IMMDevice ppEndpoint = null;

            Marshal.ThrowExceptionForHR(this._realEnumerator.GetDefaultAudioEndpoint(dataFlow, role, out ppEndpoint));
            return(new MMDevice(ppEndpoint));
        }
示例#22
0
        private bool CheckRole(ERole role)
        {
            if (Session[DSEConstant.UserId] == null)
            {
                return(false);
            }
            Guid userId = new Guid(Session[DSEConstant.UserId].ToString());

            switch (role)
            {
            case ERole.Create:
                return(CommonFunction.IsValidRoleCreate(FUNCTION_ID, userId));

            case ERole.Read:
                return(CommonFunction.IsValidRoleRead(FUNCTION_ID, userId));

            case ERole.Update:
                return(CommonFunction.IsValidRoleUpdate(FUNCTION_ID, userId));

            case ERole.Delete:
                return(CommonFunction.IsValidRoleDelete(FUNCTION_ID, userId));

            default:
                return(false);
            }
        }
示例#23
0
        /// <summary>
        /// Creator: Chase Schulte
        /// Created: 02/09/2020
        /// Approver: Kaleb Bachert
        ///
        /// Test fake activation for Roles
        /// </summary>
        ///
        /// <remarks>
        /// Updater
        /// Updated:
        /// Update:
        /// </remarks>
        /// <param name="eRoleID"></param>
        /// <returns></returns>
        public int ActivateERole(string eRoleID)
        {
            ERole eRole = null;

            //Fail immediately if null
            if (eRoleID == null)
            {
                throw new Exception();
            }

            //Check that eRole is in list, if so assign it, else fail
            foreach (var r in eRoles)
            {
                if (eRoleID == r.ERoleID)
                {
                    eRole = r;
                }
            }

            //Throw exception if eRole isn't in list
            if (eRole == null || eRoleID != eRole.ERoleID)
            {
                throw new Exception();
            }

            //Activate it
            eRole.EActive = true;

            if (eRole.EActive == true)
            {
                return(1);
            }
            return(0);
        }
示例#24
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();
            }
        }
示例#25
0
        /// <summary>
        /// Creator: Chase Schulte
        /// Created: 02/09/2020
        /// Approver: Kaleb Bachert
        ///
        /// Test fake deletion of role
        /// </summary>
        ///
        /// <remarks>
        /// Updater
        /// Updated:
        /// Update:
        /// </remarks>
        /// <param name="eRoleID"></param>
        /// <returns></returns>
        public int DeleteERole(string eRoleID)
        {
            ERole eRole = null;

            //Check that eRole is in list, if so assign it, else fail
            foreach (var r in eRoles)
            {
                if (eRoleID == r.ERoleID)
                {
                    eRole = r;
                }
            }
            if (eRole == null)
            {
                throw new Exception();
            }

            //Simulate deletion
            eRole = null;
            if (eRole == null)
            {
                return(1);
            }
            return(0);
        }
示例#26
0
 /// <summary>
 /// Creator: Chase Schulte
 /// Created: 02/13/2020
 /// Approver: Jordan Lindo
 ///
 /// Delete a role
 /// </summary>
 ///
 /// <remarks>
 /// Updater: Chaser Schulte
 /// Updated: 02/28/2020
 /// Update: Delete can only occur on in-active roles
 /// </remarks>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BtnDeleteERole_Click(object sender, RoutedEventArgs e)
 {
     if (dgERoleList.SelectedItem != null)
     {
         ERole selectedERole = (ERole)dgERoleList.SelectedItem;
         if (selectedERole.EActive == true)
         {
             WPFErrorHandler.ErrorMessage("Can't delete an active Role");
             return;
         }
         var deleteERole = MessageBox.Show("Are you sure you want to delete " + selectedERole.ERoleID, "Confirm Delete", MessageBoxButton.YesNo, MessageBoxImage.Warning);
         if (deleteERole == MessageBoxResult.Yes)
         {
             try
             {
                 _eRoleManager.DeleteERole(selectedERole.ERoleID);
                 RefreshERole();
             }
             catch (Exception ex)
             {
                 WPFErrorHandler.ErrorMessage(ex.Message);
             }
         }
     }
     else
     {
         WPFErrorHandler.ErrorMessage("Please select a role");
     }
 }
示例#27
0
        public void SetDefaultEndpoint(string deviceId, ERole role = ERole.eMultimedia)
        {
            var policy_rs1 = _policyClient as IPolicyConfig_RS1;

            if (policy_rs1 != null)
            {
                policy_rs1.SetDefaultEndpoint(deviceId, (uint)role);
                return;
            }

            var policy_th1 = _policyClient as IPolicyConfig_TH1;

            if (policy_th1 != null)
            {
                policy_th1.SetDefaultEndpoint(deviceId, (uint)role);
                return;
            }

            var policy_th2 = _policyClient as IPolicyConfig_TH2;

            if (policy_th2 != null)
            {
                policy_th2.SetDefaultEndpoint(deviceId, (uint)role);
                return;
            }

            throw new Exception("IPolicyClient is not available.");
        }
示例#28
0
        public async Task <IActionResult> AssignRole(string userId, ERole role)
        {
            var functionName = MethodBase.GetCurrentMethod()?.Name;

            try
            {
                this._logger?.LogInformation(LogRecord.CreateLogStart(functionName));

                var user = _rep.GetUserById(userId);
                if (user != null)
                {
                    // Remove all roles instead of 'administrator'
                    var roles = Enum.GetNames(typeof(ERole));
                    foreach (var s in roles.Where(o => !o.Equals(ERole.Administrator.ToString())))
                    {
                        await _userManager.RemoveFromRoleAsync(user, s);
                    }

                    await _userManager.AddToRoleAsync(user, role.ToString());
                }

                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception ex)
            {
                this._logger?.LogError(LogRecord.CreateLogRecord(functionName, ex));
                return(RedirectToAction(nameof(Index)));
            }
            finally
            {
                this._logger?.LogInformation(LogRecord.CreateLogFinish(functionName));
            }
        }
示例#29
0
        public static void SetDefaultEndpoint(string devId, ERole eRole)
        {
            _PolicyConfigClient policyConfig = null;
            try
            {
                policyConfig = new _PolicyConfigClient();

                var policyConfigX = policyConfig as IPolicyConfigX;
                var policyConfig7 = policyConfig as IPolicyConfig;
                var policyConfigVista = policyConfig as IPolicyConfigVista;

                if (policyConfigX != null)
                {
                    Marshal.ThrowExceptionForHR(policyConfigX.SetDefaultEndpoint(devId, eRole));
                }
                else if (policyConfig7 != null)
                {
                    Marshal.ThrowExceptionForHR(policyConfig7.SetDefaultEndpoint(devId, eRole));
                }
                else if (policyConfigVista != null)
                {
                    Marshal.ThrowExceptionForHR(policyConfigVista.SetDefaultEndpoint(devId, eRole));
                }
            }
            finally
            {
                if (policyConfig != null && Marshal.IsComObject(policyConfig))
                    Marshal.FinalReleaseComObject(policyConfig);

                GC.Collect();
            }
        }
示例#30
0
    IEnumerator AddPlayerRoutine(ERole roleIdent)
    {
        Debug.Log("add player");
        yield return(new WaitForSeconds(3));

        UIManager._Instance.SetSysMsgInfo(string.Format(SystemMessage._addPlayer, GameData._Instance._roleLib.GetRole(roleIdent)._name));
    }
示例#31
0
        public static void SetDefaultEndpoint(string devId, ERole eRole)
        {
            _PolicyConfigClient policyConfig = null;

            try
            {
                policyConfig = new _PolicyConfigClient();

                var policyConfigX     = policyConfig as IPolicyConfigX;
                var policyConfig7     = policyConfig as IPolicyConfig;
                var policyConfigVista = policyConfig as IPolicyConfigVista;

                if (policyConfigX != null)
                {
                    Marshal.ThrowExceptionForHR(policyConfigX.SetDefaultEndpoint(devId, eRole));
                }
                else if (policyConfig7 != null)
                {
                    Marshal.ThrowExceptionForHR(policyConfig7.SetDefaultEndpoint(devId, eRole));
                }
                else if (policyConfigVista != null)
                {
                    Marshal.ThrowExceptionForHR(policyConfigVista.SetDefaultEndpoint(devId, eRole));
                }
            }
            finally
            {
                if (policyConfig != null && Marshal.IsComObject(policyConfig))
                {
                    Marshal.FinalReleaseComObject(policyConfig);
                }

                GC.Collect();
            }
        }
示例#32
0
        private void OnHotKeyHandler(HotKey hotkey)
        {
            ConfiguredHotKeyViewModel vm = HotKeys.FirstOrDefault(h => h.Shortcut.Id == hotkey.Id);
            ERole role = vm.Mode == Enums.Modes.Communication ? ERole.eCommunications : ERole.eMultimedia;

            _audio.SetDefaultDevice(vm.AudioDevice.DeviceId, role);
        }
 public void OnDefaultDeviceChanged(EDataFlow flow, ERole role, string defaultDeviceId)
 {
     try
     {
         if (DefaultDeviceChanged != null)
         {
             DefaultDeviceChanged(flow, role, defaultDeviceId);
         }
     }
     catch (Exception ex)
     {
     }
 }
 public void SetDefaultEndpoint(string devID, ERole 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));
     }
 }
 internal void SetExpected(EDataFlow dataflow, ERole role, string deviceId, int newState, PROPERTYKEY propertyKey)
 {
     _dataFlow = dataflow;
     _role = role;
     _deviceId = deviceId;
     _newState = newState;
     _propertyKey = propertyKey;
 }
		public void OnDefaultDeviceChanged(EDataFlow dataFlow, ERole deviceRole, string defaultDeviceId)
		{
		    if (DefaultChanged != null)
		        DefaultChanged(defaultDeviceId);
		}
 public DefaultDeviceChangedEventArgs(EDataFlow flow, ERole role, string defaultDeviceId)
 {
     Flow = flow;
     Role = role;
     DeviceId = defaultDeviceId;
 }
 public int OnDefaultDeviceChanged(EDataFlow flow, ERole role, string strDefaultDeviceId)
 {
     DefaultDeviceChangedEventArgs arg = new DefaultDeviceChangedEventArgs(flow, role, strDefaultDeviceId);
     _DeviceEnumerator.FireDefaultDeviceChangedEvent(arg);
     return 0;
 }
示例#39
0
 public void SetDefaultEndpoint(string devID, ERole eRole)
 {
     Marshal.ThrowExceptionForHR(_PolicyConfig.SetDefaultEndpoint(devID, eRole));
 }
示例#40
0
 public void OnDefaultDeviceChanged(EDataFlow flow, ERole role, string defaultDeviceId)
 {
     throw new NotImplementedException();
 }
 public void OnDefaultDeviceChanged(EDataFlow dataFlow, ERole deviceRole, string defaultDeviceId)
 {
     Assert.AreEqual(_dataFlow, dataFlow);
     Assert.AreEqual(_role, deviceRole);
     Assert.AreEqual(_deviceId, defaultDeviceId);
 }
 public int SetDefaultEndpoint(String wszDeviceId, ERole eRole)
 {
     return _realClient.SetDefaultEndpoint(wszDeviceId, eRole);
 }
 public int SetDefaultDevice(string deviceID, ERole role)
 {
     _policyConfigClient.SetDefaultEndpoint(deviceID, role);
     return 0;
 }
 public static int SetDefaultDeviceStatic(string deviceID, ERole role)
 {
     return new CPolicyConfigClient().SetDefaultDevice(deviceID, role);
 }
 public void OnDefaultDeviceChanged(EDataFlow flow, ERole role, string defaultDeviceId)
 {
     var inner = GetInner();
     if(inner != null)
         inner.OnDefaultDeviceChanged(flow, role, defaultDeviceId);
 }