本文整理汇总了C#中DeviceType.CreateNewDevice方法的典型用法代码示例。如果您正苦于以下问题:C# DeviceType.CreateNewDevice方法的具体用法?C# DeviceType.CreateNewDevice怎么用?C# DeviceType.CreateNewDevice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeviceType
的用法示例。
在下文中一共展示了DeviceType.CreateNewDevice方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDeviceByName
public Device GetDeviceByName(DeviceType deviceType)
{
Device device = PresentationController.Instance.SelectedSlide.DeviceList.Where(s => s.Name == deviceType.Name).FirstOrDefault();
if (device != null) return device;
device = deviceType.CreateNewDevice();
PresentationController.Instance.SelectedSlide.DeviceList.Add(device);
return device;
}
示例2: DeviceNode
public DeviceNode(DeviceType ADeviceType)
: base(ADeviceType.Name)
{
this.DeviceType = ADeviceType;
this.Device = ADeviceType.CreateNewDevice();
}
示例3: AddNewNode
Device AddNewNode(DeviceType d)
{
if (!d.Visible)
return null;
DeviceNode node = new DeviceNode(d);
Device dev;
if (CurrentSlide.DeviceList.Any(x => x.Type.Equals(d)))
{
node.Checked = true;
dev = CurrentSlide.DeviceList.Find(x => x.Type.Equals(d));
}
else
dev = d.CreateNewDevice(DesignerClient.Instance.PresentationWorker.GetGlobalDeviceSources());
if (nodesByDevice.ContainsKey(d))
{
equipmentList.Nodes.Remove(nodesByDevice[d]);
nodesByDevice[d] = node;
}
else
nodesByDevice.Add(d, node);
bool? isOnline = EquipmentController.Instance.IsOnline(dev);
node.TextColor = isOnline.HasValue ? (isOnline.Value ? Color.Green : Color.Red) : Color.Black;
node.Device = dev;
equipmentList.Nodes.Add(node);
return dev;
}