本文整理汇总了C#中DeviceInfo类的典型用法代码示例。如果您正苦于以下问题:C# DeviceInfo类的具体用法?C# DeviceInfo怎么用?C# DeviceInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DeviceInfo类属于命名空间,在下文中一共展示了DeviceInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: From
public static DeviceInfo From(DeviceInfo di)
{
DeviceInfo result = new DeviceInfo(di.DriveName);
result.DeviceXml = di.DeviceXml;
result.DeviceName = di.DeviceName;
return result;
}
示例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;
}
}
}
示例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);
}
}
示例5: Update
public static bool Update(UserConfiguration userConfig, DeviceInfo deviceInfo)
{
var deviceInfos = new List<DeviceInfo>();
deviceInfos.Add(deviceInfo);
return Update(userConfig, deviceInfos);
}
示例6: InstallApplication
public static void InstallApplication(
DeviceInfo deviceInfo,
IAppManifestInfo manifestInfo,
DeploymentOptions deploymentOptions,
string packageFile)
{
DeployApplication(DeployAppMode.Install, deviceInfo, manifestInfo, deploymentOptions, packageFile);
}
示例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);
}
示例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);
}
示例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");
}
示例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;
}
}
示例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;
}
示例12: LoginDevice
/// <summary>
/// 尝试登陆某一个设备
/// </summary>
/// <returns>是否登陆成功</returns>
private bool LoginDevice(DeviceInfo loginInfo)
{
//某个设备可能回登陆失败所以要try。
//todo
try
{
}
catch (Exception)
{
throw;
}
return true;
}
示例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;
}
示例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 = "";
}
示例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;
}