public OpcDaClientAddingServersViewModel(OpcDaClientViewModel vm)
		{
			Title = "Добавить OPC DA сервер";

			_opcDaServersViewModel = vm;
			GetOpcServerListCommand = new RelayCommand(OnGetOpcServerList, CanGetOpcServerList);

			WaitHelper.Execute(OnGetOpcServerList);
		}
Ejemplo n.º 2
0
		public override void CreateViewModels()
		{
			_soundsViewModel = new SoundsViewModel();
			_opcServersViewModel = new OPCServersViewModel();
			_proceduresViewModel = new ProceduresViewModel();
			_schedulesViewModel = new SchedulesViewModel();
			_globalVariablesViewModel = new GlobalVariablesViewModel();
			_planExtension = new AutomationPlanExtension(_proceduresViewModel);
			_opcTechnosoftwareViewModel = new OpcTechnosoftwareViewModel();
			_opcDaClientViewModel = new OpcDaClientViewModel();
			_opcDaTagFiltersViewModel = new OpcDaTagFiltersViewModel();
		}
		public OpcDaClientReadWriteTagsViewModel(OpcDaClientViewModel vm)
		{
			Title = "Запись и чтение тегов";
			_opcDaServersViewModel = vm;

			Tags = _opcDaServersViewModel.SelectedTags
				.Where(x => (x.AccessRights == TsDaAccessRights.ReadWritable) || 
					(x.AccessRights == TsDaAccessRights.Writable))
				.ToArray();

			ReadTagCommand = new RelayCommand(OnReadTag, CanReadTag);
			WriteTagCommand = new RelayCommand(OnWriteTag, CanWriteTag);
		}
		public OpcDaClientEditingTagsViewModel(OpcDaClientViewModel vm)
		{
			Title = "Структура групп тегов";

			OpcDaClientViewModel = vm;
			
			var result = ClientManager.RubezhService
				.GetOpcDaServerGroupAndTags(RubezhServiceFactory.UID, OpcDaClientViewModel.SelectedOpcServer);

			if (result.HasError)
			{
				throw new InvalidOperationException(String.Format("Сервер вернул ошибку: {0}", result.Error));
			}
			else
			{
				// Строим дерево для отображения
				Elements = result.Result;
				RootElement = OpcDaClientElementViewModel.Create(result.Result);
			}

			//var resultDisconnect = ClientManager.RubezhService
			//	.DisconnectFromOpcDaServer(OpcDaClientViewModel.SelectedOpcServer);

			var children = RootElement.GetAllChildren(false).Where(x => x.Element.IsTag);

			// Отмечаем уже выбранные теги
			foreach (var item in OpcDaClientViewModel.SelectedTags)
			{
				var element = children.FirstOrDefault(x =>
					x.Element.ElementName == item.ElementName && x.Element.Path == item.Path);
				
				if (element != null)
				{
					var node = (OpcDaTag)element.Element;
					node.IsChecked = true;
					node.Uid = item.Uid;
				}
			}
		}
Ejemplo n.º 5
0
		public OpcDaClientMenuViewModel(OpcDaClientViewModel contex)
		{
			Context = contex;
		}