Exemplo n.º 1
0
		protected override ElementBaseRectangle CreateElement(double left, double top)
		{
			var element = new ElementRectangleTank() { Left = left, Top = top };
			var propertiesViewModel = new TankPropertiesViewModel(element);
			DialogService.ShowModalWindow(propertiesViewModel);
			Helper.SetGKDevice(element);
			return element;
		}
Exemplo n.º 2
0
		public TankPropertiesViewModel(ElementRectangleTank element)
		{
			_element = element;
			Title = "Свойства фигуры: Бак";

			Devices = new ObservableCollection<GKDevice>(GKManager.Devices.Where(item => item.DriverType == GKDriverType.RSR2_Bush_Drenazh));
			if (_element.DeviceUID != Guid.Empty)
				SelectedDevice = Devices.FirstOrDefault(x => x.UID == _element.DeviceUID);
		}
Exemplo n.º 3
0
		public static string GetTankTitle(ElementRectangleTank element)
		{
			var device = GetGKDevice(element);
			return device == null ? "Бак" : "Бак " + device.DottedAddress;
		}
Exemplo n.º 4
0
		public static GKDevice GetGKDevice(ElementRectangleTank element)
		{
			return element.DeviceUID == Guid.Empty ? null : GKManager.DeviceConfiguration.Devices.Where(item => item.DriverType == GKDriverType.RSR2_Bush_Drenazh && item.UID == element.DeviceUID).FirstOrDefault();
		}
Exemplo n.º 5
0
		public static void SetGKDevice(ElementRectangleTank element)
		{
			GKDevice device = GetGKDevice(element);
			SetGKDevice(element, device);
		}
Exemplo n.º 6
0
		public static void SetGKDevice(ElementRectangleTank element, GKDevice device)
		{
			element.DeviceUID = device == null ? Guid.Empty : device.UID;
			element.BackgroundColor = GetTankColor(device);
		}