当前位置: 首页>>代码示例>>C#>>正文


C# DeviceState类代码示例

本文整理汇总了C#中DeviceState的典型用法代码示例。如果您正苦于以下问题:C# DeviceState类的具体用法?C# DeviceState怎么用?C# DeviceState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DeviceState类属于命名空间,在下文中一共展示了DeviceState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EnumerateDevices

 /// <summary>
 /// Generates a collection of audio endpoint devices that meet the specified criteria.
 /// </summary>
 /// <param name="dataFlow">The data-flow direction for the endpoint device.</param>
 /// <param name="stateMask">The state or states of the endpoints that are to be included in the collection.</param>
 /// <returns><see cref="MMDeviceCollection"/> which contains the enumerated devices.</returns>
 public static MMDeviceCollection EnumerateDevices(DataFlow dataFlow, DeviceState stateMask)
 {
     using (var enumerator = new MMDeviceEnumerator())
     {
         return enumerator.EnumAudioEndpoints(dataFlow, stateMask);
     }
 }
开发者ID:opcon,项目名称:cscore,代码行数:13,代码来源:MMDeviceEnumerator.cs

示例2: EnumAudioEndpoints

 /// <summary>
 /// Generates a collection of audio endpoint devices that meet the specified criteria.
 /// </summary>
 /// <param name="dataFlow">The data-flow direction for the endpoint device.</param>
 /// <param name="stateMask">The state or states of the endpoints that are to be included in the collection.</param>
 /// <returns><see cref="MMDeviceCollection"/> which contains the enumerated devices.</returns>
 public MMDeviceCollection EnumAudioEndpoints(DataFlow dataFlow, DeviceState stateMask)
 {
     IntPtr pcollection;
     CoreAudioAPIException.Try(EnumAudioEndpointsNative(dataFlow, stateMask, out pcollection), InterfaceName,
         "EnumAudioEndpoints");
     return new MMDeviceCollection(pcollection);
 }
开发者ID:hoangduit,项目名称:cscore,代码行数:13,代码来源:MMDeviceEnumerator.cs

示例3: EnumAudioEndpointsNative

 public unsafe int EnumAudioEndpointsNative(DataFlow dataFlow, DeviceState stateMask, out IntPtr collection)
 {
     IntPtr pcollection;
     int result = InteropCalls.CallI(_basePtr, unchecked(dataFlow), unchecked(stateMask), &pcollection, ((void**)(*(void**)_basePtr))[3]);
     collection = pcollection;
     return result;
 }
开发者ID:CheViana,项目名称:AudioLab,代码行数:7,代码来源:MMDeviceEnumerator.cs

示例4: GetByState

        public IHttpActionResult GetByState(Guid companyId, DeviceState state)
        {
            IReadOnlyCollection<Device> devices;

            if (state == DeviceState.Pending)
            {
                devices = DeviceRepository.GetPending(companyId);
            }
            else if (state == DeviceState.Approved)
            {
                devices = DeviceRepository.GetApproved(companyId);
            }
            else if (state == DeviceState.Declined)
            {
                devices = DeviceRepository.GetDeclined(companyId);
            }
            else if (state == DeviceState.Blocked)
            {
                devices = DeviceRepository.GetBlocked(companyId);
            }
            else
            {
                throw new NotImplementedException(String.Format("There is no implementation for DeviceState '{0}'", state));
            }

            var model = devices.Select(x => DeviceModel.From(x));

            return Ok(model);
        }
开发者ID:hendrikdelarey,项目名称:appcampus,代码行数:29,代码来源:DevicesController.cs

示例5: AudioDeviceLister

 public AudioDeviceLister(DeviceState state)
 {
     _state = state;
     AudioController.DeviceAdded += AudioControllerOnDeviceAdded;
     AudioController.DeviceRemoved += AudioControllerOnDeviceRemoved;
     AudioController.DeviceStateChanged += AudioControllerOnDeviceStateChanged;
 }
开发者ID:alexvoda,项目名称:SoundSwitch,代码行数:7,代码来源:AudioDeviceLister.cs

示例6: HardDrive

        public HardDrive(RenderWindow window, VirtualMachine virtualMachine, XElement config)
        {
            vm = virtualMachine;
            state = DeviceState.None;

            var errorMsg = "";

            try
            {
                errorMsg = "Bad Port";
                devPort = short.Parse(Util.ElementValue(config, "Port", null));

                errorMsg = "Bad FileName";
                var fileName = Util.ElementValue(config, "FileName", null);
                if (fileName == null)
                    throw new Exception();

                errorMsg = string.Format("Failed to open '{0}'", fileName);
                diskImage = new FileStream(fileName, FileMode.Open);
                sectorCount = (ushort)(new FileInfo(fileName).Length / BytesPerSector);
            }
            catch (Exception e)
            {
                throw new Exception(string.Format("HardDrive: {0}", errorMsg), e);
            }
        }
开发者ID:Rohansi,项目名称:VM,代码行数:26,代码来源:HardDrive.cs

示例7: Device

 /// <summary>
 /// Creates a device with the specific serial number
 /// </summary>
 /// <param name="serialNo">The serial number of the device as a String</param>
 /// <param name="model">The model of the device</param>
 /// <param name="productName">The product name of the device</param>
 /// <param name="state">The state of the device</param>
 internal Device(string serialNo, string model, string productName, string name, DeviceState state)
 {
     mSerialNumber = serialNo;
     mProductName = productName;
     mModel = model;
     mConnectionStatus = state;
     mName = name;
 }
开发者ID:hypervtechnics,项目名称:AndroidLib,代码行数:15,代码来源:Device.cs

示例8: Open

        public override Boolean Open(int Instance = 0)
        {
            if (base.Open(Instance))
            {
                m_State = DeviceState.Reserved;
            }

            return State == DeviceState.Reserved;
        }
开发者ID:joshreve,项目名称:Touchmote,代码行数:9,代码来源:BusDevice.cs

示例9: From

 public static DeviceStateRequest From(DeviceState state, DateTime changeDate, string comment)
 {
     return new DeviceStateRequest()
     {
         State = state,
         ChangeDate = changeDate,
         Comment = comment
     };
 }
开发者ID:hendrikdelarey,项目名称:appcampus,代码行数:9,代码来源:DeviceStateRequest.cs

示例10: ApplyState

        public virtual void ApplyState(DeviceState state)
        {
            // Shouldn't change any of these post creation
            state.Name = mState.Name;
            state.DisplayName = mState.DisplayName;
            state.Archetype = mState.Archetype;

            if (!state.Type.Equals(mState.Type))
                throw new InvalidOperationException(string.Format("Type {0} of source state does not match type {1} of target state", state.Type, mState.Type));
        }
开发者ID:Necat0r,项目名称:Automation,代码行数:10,代码来源:DeviceBase.cs

示例11: From

 public static StateModel From(DeviceState state, DateTime changeDate, string macAddress, string comment)
 {
     return new StateModel()
     {
         State = state.ToString(),
         ChangeDate = changeDate,
         MacAddress = macAddress,
         Comment = comment
     };
 }
开发者ID:hendrikdelarey,项目名称:appcampus,代码行数:10,代码来源:StateResponseModel.cs

示例12: Close

        public override Boolean Close()
        {
            if (IsActive)
            {
                Unplug(0);
                m_State = DeviceState.Disconnected;
            }

            return base.Close();
        }
开发者ID:joshreve,项目名称:Touchmote,代码行数:10,代码来源:BusDevice.cs

示例13: DeviceBase

        protected DeviceBase(DeviceState state, DeviceCreationInfo creationInfo)
        {
            mState = state;
            mState.Name = creationInfo.Configuration.name;
            try
            {
                mState.DisplayName = creationInfo.Configuration.displayName;
            }
            catch (RuntimeBinderException) { }  // Optional

            mState.Type = GetType().ToString();
        }
开发者ID:Necat0r,项目名称:Automation,代码行数:12,代码来源:DeviceBase.cs

示例14: DirectXOutputDevice

    public DirectXOutputDevice(Controller controller)
    {
      _controller = controller;
      _deviceState = DeviceState.Stopped;
      _streamWriteProcDelegate = OutputStreamWriteProc;
      _silence = new Silence();

      _deviceNo = GetDeviceNo();

      BASSInit flags = BASSInit.BASS_DEVICE_DEFAULT;

      // Because all deviceinfo is saved in a static dictionary,
      // we need to determine the latency only once.
      if (!_deviceInfos.ContainsKey(_deviceNo))
        flags |= BASSInit.BASS_DEVICE_LATENCY;

      bool result = Bass.BASS_Init(
          _deviceNo,
          44100, //Only relevant for -> pre-XP (VxD drivers)
          flags,
          IntPtr.Zero);

      BASSError? bassInitErrorCode = result ? null : new BASSError?(Bass.BASS_ErrorGetCode());

      // If the GetDeviceNo() method returned BassConstants.BassDefaultDevice, we must request the actual device number
      // of the choosen default device
      _deviceNo = Bass.BASS_GetDevice();

      if (bassInitErrorCode.HasValue)
      {
        if (bassInitErrorCode.Value == BASSError.BASS_ERROR_ALREADY)
        {
          if (!Bass.BASS_SetDevice(_deviceNo))
            throw new BassLibraryException("BASS_SetDevice");
          bassInitErrorCode = null;
        }
      }

      if (bassInitErrorCode.HasValue)
        throw new BassLibraryException("BASS_Init", bassInitErrorCode.Value);

      CollectDeviceInfo(_deviceNo);

      int ms = Convert.ToInt32(Controller.GetSettings().DirectSoundBufferSize.TotalMilliseconds);

      if (!Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_BUFFER, ms))
        throw new BassLibraryException("BASS_SetConfig");

      // Enable update thread while the output device is active
      if (!Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_UPDATEPERIOD, ms / 4))
        throw new BassLibraryException("BASS_SetConfig");
    }
开发者ID:HAF-Blade,项目名称:MediaPortal-2,代码行数:52,代码来源:DirectXOutputDevice.cs

示例15: ApplyState

        public override void ApplyState(DeviceState state)
        {
            base.ApplyState(state);

            var newState = (ComputerState)state;
            var currentState = (ComputerState)mState;

            if (newState.Power != currentState.Power)
                SetPower(newState.Power);

            if (newState.MonitorPower != currentState.MonitorPower)
                SetMonitorPower(newState.MonitorPower);
        }
开发者ID:Necat0r,项目名称:Automation,代码行数:13,代码来源:ComputerProxyDevice.cs


注:本文中的DeviceState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。