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


C# DeviceType.ToString方法代码示例

本文整理汇总了C#中DeviceType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# DeviceType.ToString方法的具体用法?C# DeviceType.ToString怎么用?C# DeviceType.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DeviceType的用法示例。


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

示例1: WriteChassisFru

        /// <summary>
        /// Write to Chassis Fru - (Important) note that this function enables write to any offset 
        /// Offset checks ensures that we are within permissible limits, but cannot enforce semantics within those limits
        /// Length checks validity of packet, however empty fields in packet are responsibility of writing function
        /// User level priority since this is not an internal call
        /// </summary>
        /// <param name="offset"></param>
        /// <param name="length"></param>
        /// <param name="packet"></param>
        /// <returns></returns>
        public CompletionCode WriteChassisFru(ushort offset, ushort length, 
            byte[] packet, DeviceType deviceType)
        {
            ChassisFruWriteResponse response = new ChassisFruWriteResponse();
            response.CompletionCode = (byte)CompletionCode.UnspecifiedError;

            try
            {
                response = (ChassisFruWriteResponse)this.SendReceive(deviceType,
                    this.DeviceId, new ChassisFruWriteRequest(offset, length, packet),
                 typeof(ChassisFruWriteResponse), (byte)PriorityLevel.User);
            }
            catch (Exception ex)
            {
                Tracer.WriteError(string.Format("ChassisFru.WriteChassisFru() Write had an exception with paramaters: Offset: {0} Length: {1} Packet: {2} DeviceType: {3} Exception: {4}",
                    offset, length, (packet == null ? "Null packet" : Ipmi.IpmiSharedFunc.ByteArrayToHexString(packet)), deviceType.ToString(), ex));
            }

            if (response.CompletionCode != (byte)CompletionCode.Success)
            {
                Tracer.WriteError("ChassisFru.WriteChassisFru() write failed with completion code {0:X}", response.CompletionCode);
            }

            return (CompletionCode)response.CompletionCode;
        }
开发者ID:silupher,项目名称:ChassisManager,代码行数:35,代码来源:ChassisFru.cs

示例2: LinuxDeviceNotifyEventArgs

 internal LinuxDeviceNotifyEventArgs(LinuxDevItem linuxDevItem, DeviceType deviceType, EventType eventType)
 {
     mEventType = eventType;
     mDeviceType = deviceType;
     switch (mDeviceType)
     {
         case DeviceType.Volume:
             throw new NotImplementedException(mDeviceType.ToString());
         case DeviceType.Port:
             throw new NotImplementedException(mDeviceType.ToString());
         case DeviceType.DeviceInterface:
             mDevice = new LinuxUsbDeviceNotifyInfo(linuxDevItem);
             mObject = mDevice;
             break;
     }
 }
开发者ID:CoreCompat,项目名称:LibUsbDotNet,代码行数:16,代码来源:LinuxDeviceNotifyEventArgs.cs

示例3: Show

		public void Show(InputPort port, DeviceType deviceType, MotorMovementTypes movementType, int degreeMovement, int powerRatingMovement, int timeToMoveInSeconds)
		{
			PortName.Text = port.ToString();
			ObjectName.Text = deviceType.ToString();

			MovementStyle.SelectedIndex = (int) movementType;
			DegreeSlider.Value = degreeMovement;

			PowerTimerSlider.Value = timeToMoveInSeconds;
			PowerSlider.Value = powerRatingMovement;

			Visibility = Visibility.Visible;
		}
开发者ID:BananaScheriff,项目名称:legoev3,代码行数:13,代码来源:MotorSettingsControl.xaml.cs

示例4: Show

		public void Show(InputPort port, DeviceType deviceType, byte sensorMode)
		{
			_sensorType = GetTypeFromSensorType(deviceType);

			BindData(_sensorType);

			if (_sensorType != null)
				SensorStyle.SelectedItem = Enum.ToObject(_sensorType, sensorMode);

			PortName.Text = port.ToString();
			ObjectName.Text = deviceType.ToString();

			Visibility = Visibility.Visible;
		}
开发者ID:BananaScheriff,项目名称:legoev3,代码行数:14,代码来源:SensorSettingsControl.xaml.cs

示例5: IsInstalled

        /// <summary>
        /// Check whether is installed.
        /// </summary>
        /// <param name="deviceType">Device type.</param>
        /// <returns>Whether is installed.</returns>
        public static bool IsInstalled(DeviceType deviceType)
        {
            bool isInstalled = false;
            switch (deviceType)
            {
                case DeviceType.Audio:
                    isInstalled = IsAudioInstalled();
                    break;
                default:
                    throw new NotSupportedException(Helper.NeutralFormat(
                        "Not supported device type [{0}]", deviceType.ToString()));
            }

            return isInstalled;
        }
开发者ID:JohnsonYuan,项目名称:TTSFramework,代码行数:20,代码来源:DeviceDetector.cs

示例6: UpdateTokenLurchtable

 /// <summary>
 /// 更新lurchtable,维护最新的UserDeviceMutability的键值对,使用devicetype作为key
 /// </summary>
 /// <param name="tkey">devicetype</param>
 /// <param name="tbase">UserTokenMutability</param>
 /// <returns></returns>
 public bool UpdateTokenLurchtable(DeviceType tkey, UserDeviceMutability tbase)
 {
     //清理缓存
     //GCLurchtable();
     if (_tokenDictionary_s.ContainsKey(tkey.ToString()))
     {
         return _tokenDictionary_s.TryUpdate(tkey.ToString(), tbase);
     }
     else
     {
         return _tokenDictionary_s.TryAdd(tkey.ToString(), tbase);
     }
 }
开发者ID:aaron-clark-aic,项目名称:WebApplication_Collection,代码行数:19,代码来源:SingleTokenMutability.cs

示例7: Device

 public Device(DeviceType deviceType, string name, int pinNumber)
 {
     DeviceType = deviceType.ToString();
     Name = name;
     PinNumber = pinNumber.ToString(CultureInfo.InvariantCulture);
 }
开发者ID:ideic,项目名称:Smarthome,代码行数:6,代码来源:Device.cs

示例8: UpdateDeviceStats

            /// <summary>
            /// Updates the string which describes the device
            /// </summary>
            private void UpdateDeviceStats(DeviceType deviceType, CreateFlags behaviorFlags, AdapterDetails info)
            {
            if (State.AreStatsHidden)
                return; // Do nothing if stats are hidden

            // Get the behavior flags
            BehaviorFlags flags = new BehaviorFlags(behaviorFlags);
            // Store device information
            System.Text.StringBuilder builder = new System.Text.StringBuilder();
            // Append device type
            builder.Append(deviceType.ToString());
            // Append other types based on flags
            if (flags.HardwareVertexProcessing && flags.PureDevice)
            {
                if (deviceType == DeviceType.Hardware)
                    builder.Append(" (pure hw vp)");
                else
                    builder.Append(" (simulated pure hw vp)");
            }
            else if (flags.HardwareVertexProcessing)
            {
                if (deviceType == DeviceType.Hardware)
                    builder.Append(" (hw vp)");
                else
                    builder.Append(" (simulated hw vp)");
            }
            else if (flags.MixedVertexProcessing)
            {
                if (deviceType == DeviceType.Hardware)
                    builder.Append(" (mixed vp)");
                else
                    builder.Append(" (simulated mixed vp)");
            }
            else if (flags.SoftwareVertexProcessing)
            {
                builder.Append(" (sw vp)");
            }

            // now add the description
            builder.Append(": ");
            builder.Append(info.Description);

            // Store the device stats string
            State.DeviceStats = builder.ToString();
            }
开发者ID:JamesTryand,项目名称:simergy,代码行数:48,代码来源:dxmut.cs

示例9: UpdateDeliveryDevice

        /// <summary>
        /// Modify device information
        /// </summary>
        /// <param name="device">Which device to use.</param>
        /// <param name="includeEntitites">Set this to false to not add entitites to response. (default: true)</param>
        /// <param name="callback">Async Callback.</param>
        /// <returns></returns>
        public static Account UpdateDeliveryDevice(this TwitterContext ctx, DeviceType device, bool includeEntitites, Action<TwitterAsyncResponse<User>> callback)
        {
            var accountUrl = ctx.BaseUrl + "account/update_delivery_device.json";

            var reqProc = new AccountRequestProcessor<Account>();

            ITwitterExecute exec = ctx.TwitterExecutor;
            exec.AsyncCallback = callback;
            var resultsJson =
                exec.PostToTwitter(
                    accountUrl,
                    new Dictionary<string, string>
                    {
                        { "device", device.ToString().ToLower() },
                        { "include_entities", includeEntitites.ToString().ToLower() }
                    },
                    response => reqProc.ProcessActionResult(response, AccountAction.Settings));

            Account acct = reqProc.ProcessActionResult(resultsJson, AccountAction.Settings);
            return acct;
        }
开发者ID:prog-moh,项目名称:LinqToTwitter,代码行数:28,代码来源:AccountExtensions.cs

示例10: setRSPExecutionOutputDataCmd

        /// <summary>
        /// �g�J�@���s��ƶi�JtblRSPExecutionOutputData���db�R�O
        /// </summary>
        /// <param name="rspId">�����p���s��</param>
        /// <param name="dev">�]�ƫ��A</param>
        /// <param name="outputData">��ܤ��e</param>
        /// <returns></returns>
        public static InsertCommand setRSPExecutionOutputDataCmd(string rspId,int eventid, string devName,DeviceType dev, object outputData,bool isUserChange)
        {
            InsertCommand insertCmd = new InsertCommand();
            insertCmd.TblNames += string.Format(" {0}.{1} ", schema, DB2TableName.tblRSPExecutionOutputData);
            if (isUserChange)
                insertCmd.FiledNames += string.Format(" Exe_Id,DEVICENAME,Device_Type,OutputData2,priority,eventid  ");
            else
                insertCmd.FiledNames += string.Format(" Exe_Id,DEVICENAME,Device_Type,OutputData1,priority,eventid ");

            if (dev == DeviceType.CMS || dev == DeviceType.LCS || dev == DeviceType.CSLS || dev == DeviceType.RMS || dev == DeviceType.RGS)
            {
                List<object> outputs = (List<object>)outputData;
                insertCmd.WhereCon += string.Format(" '{0}','{1}','{2}','{3}',{4},{5} ", rspId, devName, dev.ToString(), RemoteInterface.Utils.Util.ObjToString(outputs[1]), (int)outputs[0], eventid);
            }
            else
                insertCmd.WhereCon += string.Format(" '{0}','{1}','{2}','{3}',{4},{5} ", rspId, devName, dev.ToString(), RemoteInterface.Utils.Util.ObjToString(outputData), 0, eventid);

            return insertCmd;
        }
开发者ID:ufjl0683,项目名称:Center,代码行数:26,代码来源:GetInsertCommand.cs

示例11: GetDevice

 /// <summary>
 /// Returns Windows Phone device or emulator.
 /// </summary>
 /// <exception cref="InvalidOperationException">If no Windows Phone device or emulator is registered.</exception>
 public WPDevice GetDevice(DeviceType deviceType, PlatformVersion version)
 {
     switch (deviceType)
     {
         case DeviceType.Emulator:
             return GetEmulator(version);
         case DeviceType.Device:
             return GetDevice(version);
         default:
             throw new NotSupportedException(String.Format("Device type '{0}' is not supported.", deviceType.ToString()));
     }
 }
开发者ID:andreycha,项目名称:tangerine,代码行数:16,代码来源:DeviceRetriever.cs

示例12: GetAvailableDisks

        /// <summary>
        /// <para>Gets all available disks of the specified <paramref name="Type"/></para>
        /// </summary>
        /// <param name="Type"></param>
        /// <returns></returns>
        public static List<StorageDisk> GetAvailableDisks(DeviceType Type)
        {
            string query = "SELECT * FROM Win32_DiskDrive";
            if (Type != DeviceType.Any)
                query += " WHERE InterfaceType = '" + Type.ToString() + "'";
            ManagementObjectCollection drives = new ManagementObjectSearcher(query).Get();

            List<StorageDisk> disks = new List<StorageDisk>();

            foreach (ManagementObject drive in drives)	// browse all queried WMI physical disks
            {
                StorageDisk diskDrive = CreateStorageDiskFromDrive(drive);
                disks.Add(diskDrive);

                ManagementObjectCollection partitions = new ManagementObjectSearcher(String.Format("ASSOCIATORS OF {{Win32_DiskDrive.DeviceID='{0}'}} WHERE AssocClass = Win32_DiskDriveToDiskPartition", drive["DeviceID"])).Get();	 // associate physical disks with partitions

                foreach (ManagementObject partition in partitions)
                {
                    ManagementObjectCollection logicals = new ManagementObjectSearcher(String.Format("ASSOCIATORS OF {{Win32_DiskPartition.DeviceID='{0}'}} WHERE AssocClass = Win32_LogicalDiskToPartition", partition["DeviceID"])).Get();  // associate partitions with logical disks (drive letter volumes)

                    foreach (ManagementObject logical in logicals)
                    {
                        ManagementObjectCollection volumes = new ManagementObjectSearcher(String.Format("SELECT * FROM Win32_LogicalDisk WHERE Name='{0}'", logical["Name"])).Get();
                        if (volumes.Count == 0)
                            diskDrive.AddPartition(new Partition(logical));
                        else
                        {
                            foreach (ManagementObject volume in volumes)
                            {
                                diskDrive.AddPartition(new Partition(volume));
                                break;
                            }
                        }
                    }
                }
            }

            return disks;
        }
开发者ID:Jonny007-MKD,项目名称:Trigger4Win,代码行数:44,代码来源:StorageDisk.cs

示例13: OnDeviceRemoval

 public override void OnDeviceRemoval(DeviceType deviceType)
 {
     MessageBox.Show("Device removed " + deviceType.ToString());
 }
开发者ID:Half-Shot,项目名称:Logitech-LCD,代码行数:4,代码来源:LgLcdTestForm.cs

示例14: WriteMultiRecordFru

        /// <summary>
        /// Prepares and writes the Multi Record area portion of FRU for blade, CM and Pdb.
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="recordData"></param>
        /// <param name="deviceType"></param>
        /// <returns></returns>
        private MultiRecordResponse WriteMultiRecordFru(int deviceId, string recordData, DeviceType deviceType)
        {
            Ipmi.FruCommonHeader commonHeader = null;
            Ipmi.FruMultiRecordInfo multiRecordInfo = null;

            CompletionCode completionCode = CompletionCode.UnspecifiedError;

            switch (deviceType)
            {
                case DeviceType.Server:
                    {
                        Ipmi.FruDevice fruData = WcsBladeFacade.GetFruDeviceInfo((byte)deviceId);
                        completionCode = (CompletionCode)fruData.CompletionCode;
                        commonHeader = fruData.CommonHeader;
                        multiRecordInfo = fruData.MultiRecordInfo;
                    }
                    break;
                case DeviceType.ChassisFruEeprom:
                case DeviceType.PdbFruEeprom:
                    {
                        Ipmi.FruDevice fruData = ChassisState.CmFruData.ReadFru(deviceType);
                        completionCode = (CompletionCode)fruData.CompletionCode;
                        commonHeader = fruData.CommonHeader;
                        multiRecordInfo = fruData.MultiRecordInfo;
                    }
                    break;
                default:
                    Tracer.WriteInfo("WriteMultiRecordFru() Unknown device type: {0} CompletionCode: {1}",
                        deviceType.ToString(), completionCode.ToString());
                    break;
            }

            MultiRecordResponse setAsset = new MultiRecordResponse();

            try
            {
                if (completionCode == (byte)CompletionCode.Success)
                {
                    if (multiRecordInfo == null || commonHeader == null)
                    {
                        Tracer.WriteError("WriteMultiRecordFru(). multiRecordInfo and/or commonHeader is null. Aborting...");
                        setAsset.completionCode = Contracts.CompletionCode.Failure;
                        setAsset.statusDescription = setAsset.completionCode.ToString();
                        return setAsset;
                    }

                    // Abort if the starting offset of MultiRecordArea is 0,
                    // suggesting that no Multi Record Area provision is made
                    if (commonHeader.MultiRecordAreaStartingOffset == 0)
                    {
                        Tracer.WriteError(@"WriteMultiRecordFru(). MultiRecordAreaStartingOffset is zero.
                                           Fru does not have Multi Record Area provisioned.");
                        setAsset.completionCode = Contracts.CompletionCode.WriteFruZeroStartingOffset;
                        setAsset.statusDescription = setAsset.completionCode.ToString();
                        return setAsset;
                    }

                    int idx = 0; // offset for different Multi Record Area fields (including header)
                    byte[] header = new byte[multiRecordInfo.HeaderSize];
                    byte maxWritesRemaining = 255;
                    bool writesRemainingReset = false; // to track if writes remaining has been set to the max value

                    // When starting offset of Multi Record Area is not 0, and both Record ID, Record Format is not set,
                    // it implies that the Multi Record Area is being written for the first time.
                    // The Multi Record Area format is as follows: [0] Record Type ID, [1] Record Format,
                    // [2] Record Length, [3] Record Checksum, [4] Header Checksum, [5-7] Manufacturer ID,
                    // [8] Language Code, [9] Writes Remaining, [10-N]: Record Data
                    // 0x1 is the header record format as per the specification.
                    if (commonHeader.MultiRecordAreaStartingOffset != 0 &&
                        multiRecordInfo.RecordTypeId != Ipmi.FruMultiRecordInfo.MultiRecordId &&
                        multiRecordInfo.RecordFormat != (byte)1)
                    {
                        // We are writing to Multi Record Area for the first time.
                        // Prepare and populate the Multi Record Header.
                        // We increment idx depending on the length of each header field. See IPMI FRU Specs. for
                        // details on the header format including length and offset of fields.

                        // Add Record Type Id at index [0]
                        header[idx++] = Ipmi.FruMultiRecordInfo.MultiRecordId;

                        // Add Record Format at index [1]
                        header[idx++] = 0x1;

                        // Add Writes Remaining at index [9]. This is custom defined maximum number of writes allowed.
                        header[idx + 7] = maxWritesRemaining; // writes remaining index is at index [9]
                        writesRemainingReset = true;
                    }
                    else // There is already an existing Multi Record Area portion of FRU
                    {
                        // Abort, if number of writes remaining is not greater than 0
                        if (!(multiRecordInfo.WritesRemaining > 0))
                        {
                            if (!ConfigLoaded.ResetMultiRecordFruWritesRemaining)
//.........这里部分代码省略.........
开发者ID:rockyshek,项目名称:ocs-source-code-and-operations-toolkit-for-open-cloudserver,代码行数:101,代码来源:ChassisManager.cs

示例15: GetUserTokenMutabilityFromLurchtable

        /// <summary>
        /// 获取UserDeviceMutability
        /// </summary>
        public UserDeviceMutability GetUserTokenMutabilityFromLurchtable(DeviceType dt)
        {
            UserDeviceMutability _ut = null;
            _tokenDictionary_s.TryGetValue(dt.ToString(),out _ut);

            #if false
            //使用ling没有触发fetched事件
            return _tokenLurchtables.Where(a => a.Key == uidtokenKey).SingleOrDefault().Value.Uid;
            #else
            return _ut;
            #endif
        }
开发者ID:aaron-clark-aic,项目名称:WebApplication_Collection,代码行数:15,代码来源:SingleTokenMutability.cs


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