private void Initialize(ElementXDevice element) { var device = Helper.GetXDevice(element); if (device != null) { DeviceStates.Add(device.State); device.State.StateChanged += CallBack; } }
public override ElementBase Clone() { ElementXDevice elementBase = new ElementXDevice() { XDeviceUID = XDeviceUID }; Copy(elementBase); return elementBase; }
public DevicePropertiesViewModel(DevicesViewModel devicesViewModel, ElementXDevice elementDevice) { Title = "Свойства фигуры: Устройство ГК"; _elementXDevice = elementDevice; _devicesViewModel = devicesViewModel; RootDevice = AddDeviceInternal(XManager.DeviceConfiguration.RootDevice, null); if (SelectedDevice != null) SelectedDevice.ExpandToThis(); }
public ElementXDeviceViewModel(ElementXDevice elementXDevice) { ShowInTreeCommand = new RelayCommand(OnShowInTree); ShowPropertiesCommand = new RelayCommand(OnShowProperties); ElementDevice = elementXDevice; XDeviceUID = elementXDevice.XDeviceUID; XDevice = XManager.DeviceConfiguration.Devices.FirstOrDefault(x => x.UID == elementXDevice.XDeviceUID); DeviceState = XManager.DeviceStates.DeviceStates.FirstOrDefault(x => x.UID == elementXDevice.XDeviceUID); if (DeviceState != null) DeviceState.StateChanged += new Action(OnDeviceStateChanged); }
public XDevicePropertiesViewModel(XDevicesViewModel xdevicesViewModel, ElementXDevice elementDevice) { Title = "Свойства фигуры: Устройство ГК"; _elementXDevice = elementDevice; _xdevicesViewModel = xdevicesViewModel; Devices = new ObservableCollection<XDeviceViewModel>(); BuildTree(); if (Devices.Count > 0) { CollapseChild(Devices[0]); ExpandChild(Devices[0]); } Select(elementDevice.XDeviceUID); }
public static XDevice GetXDevice(ElementXDevice element) { return element.XDeviceUID != Guid.Empty && _xdeviceMap.ContainsKey(element.XDeviceUID) ? _xdeviceMap[element.XDeviceUID] : null; }
public static void ResetXDevice(ElementXDevice element) { XDevice device = GetXDevice(element); if (device != null) device.PlanElementUIDs.Remove(element.UID); }
public static void SetXDevice(ElementXDevice element, XDevice device) { ResetXDevice(element); element.XDeviceUID = device == null ? Guid.Empty : device.UID; if (device != null) device.PlanElementUIDs.Add(element.UID); }
public static XDevice SetXDevice(ElementXDevice element) { XDevice device = GetXDevice(element); if (device != null) device.PlanElementUIDs.Add(element.UID); return device; }
public static string GetXDeviceImageSource(ElementXDevice element) { var device = GetXDevice(element); return device == null ? null : device.Driver.ImageSource; }
public static string GetXDeviceTitle(ElementXDevice element) { var device = GetXDevice(element); return device == null ? "Неизвестное устройство" : device.PresentationName; }
private void Update(ElementXDevice elementDevice) { var device = Devices.FirstOrDefault(x => x.Device.UID == elementDevice.XDeviceUID); if (device != null) device.Update(); }
public Painter(ElementXDevice elementXDevice) : base(elementXDevice) { _elementXDevice = elementXDevice; _toolTip = new ImageTextTooltipViewModel(); }