• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# DeviceState类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: GetJavascriptDeviceState

 internal static string GetJavascriptDeviceState(DeviceState state)
 {
     switch (state)
     {
         case DeviceState.Active:
             return ACTIVE;
         case DeviceState.NotPresent:
             return NOTPRESENT;
         case DeviceState.Unplugged:
             return UNPLUGGED;
         case DeviceState.Disabled:
             return DISABLED;
         case DeviceState.All:
             return ALL;
     }
     throw new ArgumentOutOfRangeException("state");
 }
开发者ID:cdhunt,项目名称:AudioSwitcher,代码行数:17,代码来源:JavaScriptDeviceState.cs


示例17: SetDeviceStateAsync

 /// <summary>
 ///     Sets the device state asynchronously
 /// </summary>
 /// <param name="deviceId">The device identifier.</param>
 /// <param name="deviceState">State of the device.</param>
 /// <returns></returns>
 /// <exception cref="DeviceException">Unable to communicate with device with ID=  + deviceId</exception>
 public async Task SetDeviceStateAsync(byte deviceId, DeviceState deviceState)
 {
     try
     {
         var data = new[] { (ushort)deviceState };
         await this.deviceAccessLayer.WriteToDeviceAsync(deviceId, Registry.STATE_ADDR, data);
     }
     catch (Exception e)
     {
         this.logger.Error(
             string.Format(
                 "Unable to set state of device {0} to {1}. Exception occured {2}",
                 deviceId,
                 deviceState,
                 e));
         throw new DeviceException("Unable to communicate with device with ID= " + deviceId);
     }
 }
开发者ID:MarcinKowal,项目名称:SmartDom,代码行数:25,代码来源:DeviceManager.cs


示例18: UpdateStatus

 void UpdateStatus(DeviceState state)
 {
     //Clear connecting.
     if (state == DeviceState.Connected)
     {
         state &= ~DeviceState.Connecting;
         state |= DeviceState.Initialized;
     }
     m_Status = state;
     if (OnStatusChanged != null)
     {
         OnStatusChanged(this, m_Status);
     }
 }
开发者ID:giapdangle,项目名称:GXDLMSDirector,代码行数:14,代码来源:GXDLMSDevice.cs


示例19: SetState

        private DeviceState SetState()
        {
            string state = null;

            using (StringReader r = new StringReader(Adb.Devices()))
            {
                string line;

                while (r.Peek() != -1)
                {
                    line = r.ReadLine();

                    if (line.Contains(this.serialNumber))
                        state = line.Substring(line.IndexOf('\t') + 1);
                }
            }

            if (state == null)
            {
                using (StringReader r = new StringReader(Fastboot.Devices()))
                {
                    string line;

                    while (r.Peek() != -1)
                    {
                        line = r.ReadLine();

                        if (line.Contains(this.serialNumber))
                            state = line.Substring(line.IndexOf('\t') + 1);
                    }
                }
            }

            switch (state)
            {
                case "device":
                    return DeviceState.ONLINE;
                case "recovery":
                    return DeviceState.RECOVERY;
                case "fastboot":
                    return DeviceState.FASTBOOT;
                default:
                    return DeviceState.UNKNOWN;
            }
        }
开发者ID:srini4sranch,项目名称:AndroidLib,代码行数:45,代码来源:Device.cs


示例20: Init

 protected virtual void Init()
 {
     this.State = DeviceState.UNKNOWN;
 }
开发者ID:belsoft,项目名称:traingraph,代码行数:4,代码来源:DisplayBase.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DeviceType类代码示例发布时间:2022-05-24
下一篇:
C# DeviceMode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap