示例#1
0
        public ElementZoneViewModel(ElementPolygonZone elementPolygonZone)
        {
            ShowInTreeCommand = new RelayCommand(OnShowInTree);
            DisableAllCommand = new RelayCommand(OnDisableAll, CanDisableAll);
            EnableAllCommand = new RelayCommand(OnEnableAll, CanEnableAll);
            SetGuardCommand = new RelayCommand(OnSetGuard, CanSetGuard);
            UnSetGuardCommand = new RelayCommand(OnUnSetGuard, CanUnSetGuard);

            ZoneNo = elementPolygonZone.ZoneNo;
            Zone = FiresecManager.Zones.FirstOrDefault(x => x.No == ZoneNo);
            if (Zone != null)
            {
                ZoneState = FiresecManager.DeviceStates.ZoneStates.FirstOrDefault(x => x.No == ZoneNo);
                if (ZoneState != null)
                {
                    ZoneState.StateChanged += new Action(ZoneState_StateChanged);
                }
            }

            ElementZoneView = new ElementZoneView();
            if (elementPolygonZone.Points == null)
                elementPolygonZone.Points = new System.Windows.Media.PointCollection();
            ElementZoneView._polygon.Points = PainterHelper.GetPoints(elementPolygonZone);
            InitializeDevices();
        }
示例#2
0
 protected override ElementBaseShape CreateElement()
 {
     var element = new ElementPolygonZone();
     var propertiesViewModel = new ZonePropertiesViewModel(element);
     DialogService.ShowModalWindow(propertiesViewModel);
     Helper.SetZone(element);
     return element;
 }
示例#3
0
		public override ElementBase Clone()
		{
			var elementBase = new ElementPolygonZone();
			Copy(elementBase);
			return elementBase;
		}
		void AddPolygonZone(Plan plan, surfacesSurfaceLayerElementsElement innerElement, Zone zone)
		{
			try
			{
				if (innerElement.points != null)
				{
					var elementPolygonZone = new ElementPolygonZone()
					{
						ZoneUID = zone == null ? Guid.Empty : zone.UID,
					};
					elementPolygonZone.Points = GetPointCollection(innerElement);
					//elementPolygonZone.Normalize();
					plan.ElementPolygonZones.Add(elementPolygonZone);
					if (zone != null)
					{
						if (zone.PlanElementUIDs == null)
							zone.PlanElementUIDs = new List<Guid>();
						zone.PlanElementUIDs.Add(elementPolygonZone.UID);
					}
				};
			}
			catch (Exception e)
			{
				Logger.Error(e, "ConfigurationConverter.AddPolygonZone");
			}
		}
 void AddPolygonZone(Plan plan, surfacesSurfaceLayerElementsElement innerElement, int? zoneNo)
 {
     if (innerElement.points != null)
     {
         var elementPolygonZone = new ElementPolygonZone()
         {
             ZoneNo = zoneNo
         };
         elementPolygonZone.Points = GetPointCollection(innerElement);
         //elementPolygonZone.Normalize();
         plan.ElementPolygonZones.Add(elementPolygonZone);
     };
 }