protected override Infrustructure.Plans.Elements.ElementBaseRectangle CreateElement() { var element = new ElementRectangleTank(); var propertiesViewModel = new TankPropertiesViewModel(element); DialogService.ShowModalWindow(propertiesViewModel); Helper.SetXDevice(element); return element; }
public TankPropertiesViewModel(ElementRectangleTank element) { _element = element; Title = "Свойства фигуры: Бак"; Devices = new ObservableCollection<XDevice>(XManager.Devices.Where(item => item.DriverType == XDriverType.RSR2_Bush)); if (_element.XDeviceUID != Guid.Empty) SelectedDevice = Devices.FirstOrDefault(x => x.UID == _element.XDeviceUID); }
public static XDevice GetXDevice(ElementRectangleTank element) { return XManager.Devices.FirstOrDefault(x => x.UID == element.XDeviceUID); //return element.XDeviceUID != Guid.Empty && _xdeviceMap != null && _xdeviceMap.ContainsKey(element.XDeviceUID) ? _xdeviceMap[element.XDeviceUID] : null; }
public static string GetTankTitle(ElementRectangleTank element) { var device = GetXDevice(element); return device == null ? "Бак" : "Бак " + device.DottedAddress; }
public static XDevice GetXDevice(ElementRectangleTank element) { return element.XDeviceUID == Guid.Empty ? null : XManager.DeviceConfiguration.Devices.Where(item => item.DriverType == XDriverType.RSR2_Bush && item.UID == element.XDeviceUID).FirstOrDefault(); }
public static void SetXDevice(ElementRectangleTank element) { XDevice xdevice = GetXDevice(element); SetXDevice(element, xdevice); }
public static void SetXDevice(ElementRectangleTank element, XDevice device) { element.XDeviceUID = device == null ? Guid.Empty : device.UID; element.BackgroundColor = GetTankColor(device); }
public override ElementBase Clone() { var elementBase = new ElementRectangleTank(); Copy(elementBase); return elementBase; }