本文整理汇总了C#中DeviceInfo类的典型用法代码示例。如果您正苦于以下问题:C# DeviceInfo类的具体用法?C# DeviceInfo怎么用?C# DeviceInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DeviceInfo类属于命名空间,在下文中一共展示了DeviceInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Scan
public Image Scan(DeviceInfo device)
{
if (device == null)
throw new ArgumentException("Device must be specified");
var scanner = device.Connect();
var wiaCommonDialog = new WPFCommonDialog();
var item = scanner.Items[1];
var image = (ImageFile)wiaCommonDialog.ShowTransfer(item, wiaFormatBMP, false);
string fileName = Path.GetTempFileName();
File.Delete(fileName);
image.SaveFile(fileName);
image = null;
// add file to output list
return Image.FromFile(fileName);
}
开发者ID:JakeGinnivan,项目名称:Enhance,代码行数:19,代码来源:ScannerService.cs
示例2: From
public static DeviceInfo From(DeviceInfo di)
{
DeviceInfo result = new DeviceInfo(di.DriveName);
result.DeviceXml = di.DeviceXml;
result.DeviceName = di.DeviceName;
return result;
}
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:7,代码来源:GarminMassStorage.cs
示例3: ActiveScanner
private void ActiveScanner(DeviceInfo selectedScanner)
{
if (selectedScanner != null && !selectedScanner.IsDeviceInfoOf(activeScanner))
{
DeactivateScanner();
UpdateEventHistory(string.Format("Activate Scanner:{0}", selectedScanner.ServiceObjectName));
try
{
activeScanner = (Scanner)explorer.CreateInstance(selectedScanner);
activeScanner.Open();
activeScanner.Claim(1000);
activeScanner.DeviceEnabled = true;
activeScanner.DataEvent += new DataEventHandler(activeScanner_DataEvent);
activeScanner.ErrorEvent += new DeviceErrorEventHandler(activeScanner_ErrorEvent);
activeScanner.DecodeData = true;
activeScanner.DataEventEnabled = true;
}
catch (PosControlException)
{
UpdateEventHistory(string.Format("Activation Failed:{0}", selectedScanner.ServiceObjectName));
activeScanner = null;
}
}
}
开发者ID:RiazMahmud,项目名称:ATK-Computer-LTD,代码行数:25,代码来源:Home_Admin_EntryNewProduct.cs
示例4: addDevice
public void addDevice(int deviceID, DeviceInfo deviceInfo, DeviceType deviceType)
{
Debug.Log("addDevice("+deviceID+", "+deviceInfo+", "+deviceType+")");
bool alreadyEquiped = (!_equipedDevices.Exists(device => device.getID() == deviceID));
bool alreadyInventory = (!_inventoryDevices.Exists(device => device.getID() == deviceID));
if(alreadyEquiped || alreadyInventory) {
Vector3 localPosition;
UnityEngine.Transform parent;
List<DisplayedDevice> devices;
int newDeviceId = deviceID;
if(deviceType == DeviceType.Equiped) {
parent = equipPanel.transform;
devices = _equipedDevices;
if(deviceID == 0) {
newDeviceId = devices.Count;
}
Debug.Log("addDevice("+newDeviceId+") in equipment");
} else {
parent = inventoryPanel.transform;
devices = _inventoryDevices;
Debug.Log("addDevice("+newDeviceId+") in inventory");
}
localPosition = getNewPosition(deviceType);
DisplayedDevice newDevice = DisplayedDevice.Create (parent, localPosition, newDeviceId, deviceType, deviceInfo, this);
devices.Add(newDevice);
//let's add reaction to reaction engine
//for each module of deviceInfo, add to reaction engine
//deviceInfo._modules.ForEach( module => module.addToReactionEngine(celliaMediumID, reactionEngine));
} else {
Debug.Log("addDevice failed: alreadyEquiped="+alreadyEquiped+", alreadyInventory="+alreadyInventory);
}
}
开发者ID:quito,项目名称:DSynBio_reloaded,代码行数:32,代码来源:DevicesDisplayer.cs
示例5: Update
public static bool Update(UserConfiguration userConfig, DeviceInfo deviceInfo)
{
var deviceInfos = new List<DeviceInfo>();
deviceInfos.Add(deviceInfo);
return Update(userConfig, deviceInfos);
}
开发者ID:TrakHound,项目名称:TrakHound-Community,代码行数:7,代码来源:Update.cs
示例6: InstallApplication
public static void InstallApplication(
DeviceInfo deviceInfo,
IAppManifestInfo manifestInfo,
DeploymentOptions deploymentOptions,
string packageFile)
{
DeployApplication(DeployAppMode.Install, deviceInfo, manifestInfo, deploymentOptions, packageFile);
}
开发者ID:shasanraj,项目名称:Winium.StoreApps.CodedUi,代码行数:8,代码来源:Utils.cs
示例7: GetDeviceInfo
/// <summary>
/// Get Information for a Device (CPU/GPU/...)
/// </summary>
/// <returns></returns>
public static OpenCLErrorCode GetDeviceInfo(DeviceHandle device,
DeviceInfo paramName,
IntPtr paramValueSize,
InfoBuffer paramValue,
out IntPtr paramValueSizeRet)
{
return clGetDeviceInfo((device as IHandleData).Handle, paramName, paramValueSize, paramValue.Address, out paramValueSizeRet);
}
开发者ID:Multithread,项目名称:OpenOCL_NET,代码行数:12,代码来源:OpenCL_DeviceInformation.cs
示例8: ArcazeDevice
public ArcazeDevice(DeviceInfo info)
{
this.arcazeDevice = new ArcazeHid();
Connect(ref info);
this.arcazeDevice.DeviceRemoved += new EventHandler<HidEventArgs>(this.DeviceRemoved);
this.arcazeDevice.OurDeviceRemoved += new EventHandler<HidEventArgs>(this.OurDeviceRemoved);
}
开发者ID:H-J-P,项目名称:DAC-Source,代码行数:8,代码来源:ArcaseDevice.cs
示例9: Load
public void Load()
{
var device = new DeviceInfo();
device.Load();
ScreenResolution = string.Format(CultureInfo.InvariantCulture, "{0}x{1}", device.ScreenResolution.Width, device.ScreenResolution.Height);
RaisePropertyChanged("ScreenResolution");
}
开发者ID:seriema,项目名称:WP7Caps,代码行数:9,代码来源:DeviceInfoViewModel.cs
示例10: Check
/// <summary>
/// Checks to see if the current device or the useragent string contain each
/// other at the start.
/// </summary>
/// <param name="userAgent">The useragent being searched for.</param>
/// <param name="bestMatch">Reference to the best matching device so far.</param>
/// <param name="maxInitialString">The maximum number of characters that have matched in the search so far.</param>
/// <param name="current">The current device being checked for a match.</param>
private static void Check(string userAgent, ref DeviceInfo bestMatch, ref int maxInitialString,
DeviceInfo current)
{
if ((userAgent.StartsWith(current.UserAgent) ||
current.UserAgent.StartsWith(userAgent)) &&
maxInitialString < current.UserAgent.Length)
{
maxInitialString = current.UserAgent.Length;
bestMatch = current;
}
}
开发者ID:irobinson,项目名称:51DegreesDNN,代码行数:19,代码来源:Matcher.cs
示例11: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
var ignored = base.OnCreateView(inflater, container, savedInstanceState);
this.EnsureBindingContextIsSet(savedInstanceState);
View _view = this.BindingInflate(Resource.Layout.MenuView, null);
_deviceInfoPlugin = Mvx.Resolve<IMvxDeviceInfo>();
_deviceInfo = _deviceInfoPlugin.GetDeviceInfo ();
View mv = _view.FindViewById (Resource.Id.menu_view_layout_main);
TreeListView treeView = (TreeListView)_view.FindViewById (Resource.Id.menu_categories_listview);
return _view;
}
开发者ID:fpt-software,项目名称:Wordpress-Client,代码行数:13,代码来源:MenuView.cs
示例12: LoginDevice
/// <summary>
/// 尝试登陆某一个设备
/// </summary>
/// <returns>是否登陆成功</returns>
private bool LoginDevice(DeviceInfo loginInfo)
{
//某个设备可能回登陆失败所以要try。
//todo
try
{
}
catch (Exception)
{
throw;
}
return true;
}
开发者ID:litao008,项目名称:LitaoWorld,代码行数:18,代码来源:DeviceLogIn.cs
示例13: StringToObject
/// <summary>
/// 把String转换成Object
/// </summary>
/// <param name="deviceConfig">按一定格式排列的设备信息字符串</param>
private DeviceInfo StringToObject(string deviceConfig)
{
string[] configs = deviceConfig.Split(',');
if (configs.Length == 7)
{
try
{
DeviceInfo deviceLoginInfo = new DeviceInfo();
if (ParameterCheck.IsIpAddress(configs[0]))
{
deviceLoginInfo.Ip = configs[0];
}
LogInType type;
if (Enum.TryParse(configs[1],true,out type))
{
deviceLoginInfo.Type = type;
}
int port;
if (int.TryParse(configs[2], out port))
{
deviceLoginInfo.Port = port;
}
deviceLoginInfo.LoginReq = configs[3].Equals("true",StringComparison.CurrentCultureIgnoreCase);
LogInStatus status;
if (Enum.TryParse(configs[4], true, out status))
{
deviceLoginInfo.Status = status;
}
deviceLoginInfo.BelongTo = configs[5];
if (ParameterCheck.IsIpAddress(configs[6]))
{
deviceLoginInfo.LocalIp = configs[6];
}
return deviceLoginInfo;
}
catch (Exception)
{
//todo log
return null;
}
}
return null;
}
开发者ID:litao008,项目名称:LitaoWorld,代码行数:53,代码来源:DeviceConfigManager.cs
示例14: MerchantInfo
/// <summary>
///
/// </summary>
public MerchantInfo()
{
supportsManualRefunds = true;
supportsTipAdjust = true;
supportsVaultCards = true;
supportsPreAuths = true;
merchantID = "";
merchantMId = "";
merchantName = "";
Device = new DeviceInfo();
Device.Name = "";
Device.Serial = "";
Device.Model = "";
}
开发者ID:clover,项目名称:remote-pay-windows,代码行数:18,代码来源:MerchantInfo.cs
示例15: BuildEntity
private DeviceInfo BuildEntity()
{
DeviceInfo user = new DeviceInfo();
user.ID = GetFormInteger("id");
user.IP = Request.Form["ip"];
user.Port = Request.Form["port"];
user.DeviceType = Request.Form["deviceType"];
user.UserName = Request.Form["userName"];
user.Password = Request.Form["password"];
user.AntNo = GetFormInteger("antNo");
user.AccessFlag = GetFormInteger("accessFlag");
user.Location = Request.Form["location"];
user.Active = Request.Form["active"] == "true";
return user;
}
开发者ID:weihongji,项目名称:FRAS,代码行数:15,代码来源:DeviceAjax.aspx.cs
示例16: Create
public static DisplayedDevice Create(
Transform parentTransform,
Vector3 localPosition,
int deviceID,
DevicesDisplayer.DeviceType deviceType,
DeviceInfo deviceInfo,
DevicesDisplayer devicesDisplayer
)
{
Debug.Log("create device "+deviceID
+ " parentTransform="+parentTransform
+ " localPosition="+localPosition
+ " deviceType="+deviceType
+ "deviceInfo="+deviceInfo
+ "devicesDisplayer="+devicesDisplayer);
GameObject newDevice = Instantiate(prefab, new Vector3(0.0f, 0.0f, 0.0f), Quaternion.identity) as GameObject;
newDevice.transform.parent = parentTransform;
newDevice.transform.localPosition = localPosition;
newDevice.transform.localScale = new Vector3(1f, 1f, 0);
DisplayedDevice deviceScript = newDevice.GetComponent<DisplayedDevice>();
deviceScript._deviceID = deviceID;
deviceScript._deviceType = deviceType;
deviceScript._deviceInfo = deviceInfo;
deviceScript._devicesDisplayer = devicesDisplayer;
deviceScript._currentSpriteName = deviceInfo._spriteName;
/*
//deviceScript._sprite = newDevice.transform.GetComponentInChildren<UISprite>();
GameObject background = newDevice.transform.Find("Background").gameObject;
if(background) {
deviceScript._sprite = background.GetComponent<UISprite>();
Debug.Log("init _sprite as "+deviceScript._sprite);
} else {
Debug.Log("init _sprite impossible: no background found");
}
*/
//do additional initialization steps here
return deviceScript;
}
开发者ID:quito,项目名称:DSynBio_reloaded,代码行数:42,代码来源:DisplayedDevice.cs
示例17: CreateKeyChange
internal static byte[] CreateKeyChange(DeviceInfo devInfo)
{
List<byte> keyChangePacket = new List<byte>();
//LOCAL IP
keyChangePacket.AddRange(MessageBuilder.HexToByteArray(GMPDataTags.DT_IP));
keyChangePacket.AddRange(MessageBuilder.AddLength(6));
String[] strLocalIP = getLocalIP().Split('.');//devInfo.DevIP.ToString().Split('.');
String ip12Format = "";
for (int i = 0; i < strLocalIP.Length; i++)
{
ip12Format += String.Format("{0:D3}", Convert.ToInt32(strLocalIP[i]));
}
for (int i = 0; i < ip12Format.Length; i++)
{
String strByte = ip12Format.Substring(i, 2);
keyChangePacket.AddRange(MessageBuilder.ConvertIntToBCD(Convert.ToInt32(strByte), 1));
i++;
}
//BRAND
keyChangePacket.AddRange(MessageBuilder.HexToByteArray(GMPDataTags.DT_BRAND));
keyChangePacket.AddRange(MessageBuilder.AddLength(devInfo.Brand.Length));
keyChangePacket.AddRange(Encoding.ASCII.GetBytes(devInfo.Brand));
//MODEL
keyChangePacket.AddRange(MessageBuilder.HexToByteArray(GMPDataTags.DT_MODEL));
keyChangePacket.AddRange(MessageBuilder.AddLength(devInfo.Model.Length));
keyChangePacket.AddRange(Encoding.ASCII.GetBytes(devInfo.Model));
//SERIAL
keyChangePacket.AddRange(MessageBuilder.HexToByteArray(GMPDataTags.DT_SERIAL));
keyChangePacket.AddRange(MessageBuilder.AddLength(devInfo.TerminalNo.Length));
keyChangePacket.AddRange(Encoding.ASCII.GetBytes(devInfo.TerminalNo));
return keyChangePacket.ToArray();
}
开发者ID:huginsdk,项目名称:fpu,代码行数:40,代码来源:Identifier.cs
示例18: Scan
public Image Scan(DeviceInfo device, PageSize pageSize, ColorDepth colorDepth, Resolution resolution, Orientation orientation, bool setSize = true)
{
if (device == null)
throw new ArgumentException("Device must be specified");
var scanner = device.Connect();
var wiaCommonDialog = new WPFCommonDialog();
var item = scanner.Items[1];
SetupPageSize(item, pageSize, colorDepth, resolution, orientation, setSize);
var image = (ImageFile)wiaCommonDialog.ShowTransfer(item, wiaFormatBMP, false);
string fileName = Path.GetTempFileName();
File.Delete(fileName);
image.SaveFile(fileName);
image = null;
// add file to output list
return Image.FromFile(fileName);
}
开发者ID:x-skywalker,项目名称:Enhance,代码行数:22,代码来源:ScannerService.cs
示例19: CreateEventInfoBase
private EventInfo CreateEventInfoBase(Event errorData)
{
var appInfo = new AppInfo
{
Version = Config.AppVersion,
ReleaseStage = Config.ReleaseStage,
AppArchitecture = Diagnostics.AppArchitecture,
ClrVersion = Diagnostics.ClrVersion
};
var userInfo = new UserInfo
{
Id = errorData.UserId,
Email = errorData.UserEmail,
Name = errorData.UserName
};
var deviceInfo = new DeviceInfo
{
OSVersion = Diagnostics.DetectedOSVersion,
ServicePack = Diagnostics.ServicePack,
OSArchitecture = Diagnostics.OSArchitecture,
ProcessorCount = Diagnostics.ProcessorCount,
MachineName = Diagnostics.MachineName,
HostName = Diagnostics.HostName
};
var eventInfo = new EventInfo
{
App = appInfo,
Device = deviceInfo,
Severity = errorData.Severity,
User = userInfo,
Context = errorData.Context,
GroupingHash = errorData.GroupingHash,
Exceptions = new List<ExceptionInfo>()
};
return eventInfo;
}
开发者ID:ersin-demirtas,项目名称:bugsnag-dotnet,代码行数:39,代码来源:NotificationFactory.cs
示例20: InitializePreviewPlugin
void InitializePreviewPlugin(string preferredDeviceName, Camera camera)
{
// Test library compatibility
if (DesktopWrapper.GetInterfaceVersion() != 3)
{
Debug.LogError("You appear to be using incompatible versions of StringWrapper.cs and String.bundle; Please make sure you're using the latest versions of both.");
return;
}
// Enumerate devices
uint maxDeviceCount = 10;
DeviceInfo[] deviceInfo = new DeviceInfo[maxDeviceCount];
uint deviceCount = DesktopWrapper.EnumerateDevices(deviceInfo, maxDeviceCount);
for (int i = 0; i < deviceCount; i++)
{
Debug.Log("Found camera \"" + deviceInfo[i].name + "\" (" + (deviceInfo[i].isAvailable ? "available for use.)" : "not available for use.)"));
}
if (deviceCount > 0)
{
uint i;
for (i = 0; i < deviceCount; i++)
{
if (deviceInfo[i].name == preferredDeviceName) break;
}
if (i < deviceCount)
{
Debug.Log("Capturing video from preferred device \"" + deviceInfo[i].name + "\".");
}
else
{
i = 0;
if (preferredDeviceName != null)
{
Debug.Log("Preferred device was not found. Using \"" + deviceInfo[i].name + "\".");
}
else
{
Debug.Log("Capturing video from device \"" + deviceInfo[i].name + "\".");
}
}
if (DesktopWrapper.InitTracker(deviceInfo[i].id, ref previewWidth, ref previewHeight, _previewCamApproxVerticalFOV))
{
CreateVideoMaterial();
CreateVideoMesh();
float scale = camera.farClipPlane * 0.99f;
float verticalScale = scale * Mathf.Tan(_previewCamApproxVerticalFOV * Mathf.PI / 360f);
videoPlaneObject = new GameObject("Video Plane", new Type[] {typeof(MeshRenderer), typeof(MeshFilter)});
videoPlaneObject.hideFlags = HideFlags.HideAndDontSave;
videoPlaneObject.active = false;
videoPlaneObject.renderer.material = videoMaterial;
MeshFilter meshFilter = (MeshFilter)videoPlaneObject.GetComponent(typeof(MeshFilter));
meshFilter.sharedMesh = videoPlaneMesh;
videoPlaneObject.transform.parent = camera.transform;
videoPlaneObject.transform.localPosition = new Vector3(0, 0, scale);
videoPlaneObject.transform.localRotation = Quaternion.identity;
videoPlaneObject.transform.localScale = new Vector3(verticalScale * (float)previewWidth / previewHeight, verticalScale, 1);
wasInitialized = true;
}
else
{
Debug.Log("Failed to initialize String.");
}
}
else
{
Debug.LogError("No devices suitable for video capture were detected.");
}
}
开发者ID:ece1778github,项目名称:The-Mobile-Stage,代码行数:83,代码来源:StringWrapper.cs
注:本文中的DeviceInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论