Example #1
0
		public void UpdateLayout(LayoutModel layout)
		{
			Layout = layout;
			if (LayoutChanging != null)
				LayoutChanging(this, EventArgs.Empty);
			if (Layout != null && Manager != null)
			{
				Initialize();
				Manager.GridSplitterHeight = Layout.SplitterSize;
				Manager.GridSplitterWidth = Layout.SplitterSize;
				Manager.GridSplitterBackground = new SolidColorBrush(Layout.SplitterColor.ToWindowsColor());
				Manager.BorderBrush = new SolidColorBrush(Layout.BorderColor.ToWindowsColor());
				Manager.BorderThickness = new Thickness(Layout.BorderThickness);
				if (_serializer != null && Layout != null && !string.IsNullOrEmpty(Layout.Content))
					using (var tr = new StringReader(Layout.Content))
						_serializer.Deserialize(tr);
				LoadLayoutProperties();
			}
			if (LayoutChanged != null)
				LayoutChanged(this, EventArgs.Empty);
		}
		void OnChangeLayout(LayoutModel layout)
		{
			if (ClientManager.RubezhService.LayoutChanged(RubezhServiceFactory.UID, layout == null ? Guid.Empty : layout.UID))
			{
				ShowOnPlanHelper.LayoutUID = layout == null ? Guid.Empty : layout.UID;
				ApplicationService.CloseAllWindows();
				LayoutContainer.UpdateLayout(layout);
			}
			else
				MessageBoxService.ShowError("Не удалось сменить шаблон. Возможно, отсутствует связь с сервером.");
		}
		public ProcedureLayoutItemViewModel(LayoutModel layout, bool isChecked)
		{
			Layout = layout;
			IsChecked = isChecked;
		}
Example #4
0
		public LayoutContainer(BaseViewModel viewModel, LayoutModel layout = null)
		{
			_viewModel = viewModel;
			Layout = layout;
		}
Example #5
0
		private bool GetLayout()
		{
			_layout = null;
			var ip = ConnectionSettingsManager.IsRemote ? ClientManager.GetIP() : null;
			var localHostName = System.Net.Dns.GetHostName();
			var layouts = ClientManager.LayoutsConfiguration.Layouts.Where(layout =>
				layout.Users.Contains(ClientManager.CurrentUser.UID) &&
				(ip == null || layout.HostNameOrAddressList.Count == 0 || layout.HostNameOrAddressList.Contains(ip)) ||
					layout.HostNameOrAddressList.Any(allowedHostName => string.Compare(allowedHostName, localHostName, true) == 0)).ToList();

			if (layouts.Count > 0)
			{
				if (_layoutID.HasValue)
				{
					_layout = layouts.FirstOrDefault(item => item.UID == _layoutID.Value);
					if (_layout == null)
						_layout = layouts.FirstOrDefault();
				}

				if (_layout == null && layouts.Count == 1)
					_layout = layouts[0];

				if (_layout == null)
				{
					ServiceFactory.ResourceService.AddResource(typeof(Bootstrapper).Assembly, "DataTemplates/Dictionary.xaml");
					_layout = SelectLayout(layouts);
				}

				if (_layout == null)
					return false;
				else
				{
					ShowOnPlanHelper.LayoutUID = _layout.UID;
					return ClientManager.RubezhService.LayoutChanged(RubezhServiceFactory.UID, _layout.UID);
				}
			}

			MessageBoxService.ShowWarning("К сожалению, для Вас нет ни одного доступного макета!");
			return false;
		}
Example #6
0
		public Bootstrapper()
		{
			BootstrapperCurrent = this;
			_layout = null;
		}
Example #7
0
		void _LayoutChanging(object sender, EventArgs e)
		{
			_layout = _monitorLayoutShellViewModel.LayoutContainer.Layout;
		}