Esempio n. 1
0
		IEnumerable<string> GetLayoutLicenses(Layout layout)
		{
			if (!LicenseManager.CurrentLicenseInfo.HasFirefighting && layout.Parts.Any(x => 
				x.DescriptionUID == LayoutPartIdentities.PumpStations || 
				x.DescriptionUID == LayoutPartIdentities.MPTs))
				yield return "\"GLOBAL Пожаротушение\"";

			if (!LicenseManager.CurrentLicenseInfo.HasGuard && layout.Parts.Any(x => 
				x.DescriptionUID == LayoutPartIdentities.GuardZones))
				yield return "\"GLOBAL Охрана\"";

			if (!LicenseManager.CurrentLicenseInfo.HasSKD && layout.Parts.Any(x => 
				x.DescriptionUID == LayoutPartIdentities.Doors ||
				x.DescriptionUID == LayoutPartIdentities.GKSKDZones ||
				x.DescriptionUID == LayoutPartIdentities.SKDVerification ||
				x.DescriptionUID == LayoutPartIdentities.SKDHR ||
				x.DescriptionUID == LayoutPartIdentities.SKDTimeTracking))
				yield return "\"GLOBAL Доступ\"";

			if (!LicenseManager.CurrentLicenseInfo.HasVideo && layout.Parts.Any(x =>
				x.DescriptionUID == LayoutPartIdentities.CamerasList ||
				x.DescriptionUID == LayoutPartIdentities.CameraVideo ||
				x.DescriptionUID == LayoutPartIdentities.MultiCamera))
				yield return "\"GLOBAL Видео\"";
		}
		public LayoutPropertiesViewModel(Layout layout, LayoutUsersViewModel layoutUsersViewModel, List<string> otherCaptions)
		{
			Title = "Свойства элемента: Макет интерфейса ОЗ";
			Layout = layout ?? new Layout(otherCaptions);
			LayoutUsersViewModel = layoutUsersViewModel;
			this.otherCaptions = otherCaptions;
			LayoutUsersViewModel.Update(Layout);
			IPFilterViewModel = new IPFilterViewModel(Layout.HostNameOrAddressList);
			CopyProperties();
		}
Esempio n. 3
0
		public void Update(Layout layout)
		{
			_layout = layout;
			if (_layout != null)
				for (int i = _layout.Users.Count - 1; i >= 0; i--)
					if (Users.Select(x => x.User.UID == _layout.Users[i]).Count() == 0)
						_layout.Users.RemoveAt(i);
			foreach (var layoutUserViewModel in Users)
				layoutUserViewModel.IsActive = _layout != null && _layout.Users.Contains(layoutUserViewModel.User.UID);
			SelectedUser = Users.FirstOrDefault();
		}
Esempio n. 4
0
		public void Update(Layout layout)
		{
			_layout = layout;
			var map = new Dictionary<Guid, int>();
			if (_layout != null)
				foreach (var layoutPart in _layout.Parts)
					if (map.ContainsKey(layoutPart.DescriptionUID))
						map[layoutPart.DescriptionUID]++;
					else
						map.Add(layoutPart.DescriptionUID, 1);
			foreach (var layoutPart in _map)
				if (map.ContainsKey(layoutPart.Key))
					layoutPart.Value.Count = map[layoutPart.Key];
				else
					layoutPart.Value.Count = 0;
			SelectedLayoutPart = LayoutParts.FirstOrDefault();
		}
		bool CheckLayoutCycling(Layout layout, List<Guid> parents = null)
		{
			if (parents == null)
				parents = new List<Guid>() { MonitorLayoutsViewModel.Instance.SelectedLayout.Layout.UID };
			if (parents.Contains(layout.UID))
				return false;
			parents.Add(layout.UID);
			foreach (var layoutPart in layout.Parts.Where(part => part.DescriptionUID == LayoutPartIdentities.TemplateContainer))
			{
				var property = (LayoutPartReferenceProperties)layoutPart.Properties;
				if (property != null)
				{
					var childLayout = MonitorLayoutsViewModel.Instance.Layouts.FirstOrDefault(item => item.Layout.UID == property.ReferenceUID);
					if (childLayout != null && !CheckLayoutCycling(childLayout.Layout, parents))
						return false;
				}
			}
			parents.Remove(layout.UID);
			return true;
		}
Esempio n. 6
0
		public void Update(Layout layout)
		{
			using (new WaitWrapper())
			{
				if (_layout != null)
					SaveLayout();
				_layout = layout;
				_currentLayoutChanged = false;
				if (_layout != null && Manager != null)
				{
					var layoutParts = new ObservableCollection<LayoutPartViewModel>();
					foreach (var layoutPart in _layout.Parts)
						layoutParts.Add(new LayoutPartViewModel(layoutPart));
					LayoutParts = layoutParts;
					_loading = true;
					Manager.GridSplitterWidth = _layout.SplitterSize;
					Manager.GridSplitterHeight = _layout.SplitterSize;
					Manager.GridSplitterBackground = new SolidColorBrush(_layout.SplitterColor.ToWindowsColor());
					Manager.BorderBrush = new SolidColorBrush(_layout.BorderColor.ToWindowsColor());
					Manager.BorderThickness = new Thickness(_layout.BorderThickness);
					Manager.Background = new SolidColorBrush(_layout.BackgroundColor.ToWindowsColor());
					Manager.Padding = new Thickness(_layout.Padding);
					Manager.Layout = new LayoutRoot();
					if (!string.IsNullOrEmpty(_layout.Content))
						using (var tr = new StringReader(_layout.Content))
							_serializer.Deserialize(tr);
					_loading = false;
					ActiveLayoutPart = LayoutParts.FirstOrDefault();
				}
			}
		}
Esempio n. 7
0
		protected override bool Cancel()
		{
			SelectedLayout = null;
			return base.Cancel();
		}
Esempio n. 8
0
		public LayoutViewModel(Layout layout)
		{
			Layout = layout;
		}