public DAGroupProperties(ServerNode serverNode, DAGroupNode groupNode)
		{
			this.serverNode = serverNode;
            this.groupNode = groupNode;
			InitializeComponent();

            properties.Name = groupNode != null ? groupNode.Name : string.Empty;

			_propertyGrid.IsReadOnly = false;
			_propertyGrid.SelectedObject = properties;
            _acceptButton.Content = groupNode != null ? "OK" : "Create";

            if (groupNode != null)
            {
                groupNode.GetPropertiesAsync((task, args) =>
                {
                    if (args.Result != null)
                    {
                        var groupProperties = (GroupProperties)args.Result;
                        Mapper.Map(groupProperties, properties);
                        properties.PropertiesChanged();
                    }
                });                
            }
		}
		public ServerProperties(ServerNode node)
		{
			this.node = node;
			InitializeComponent();

			properties.Id = node.Id;
			properties.ProgramId = node.Name;
			properties.ServerName = node.ServerName;

			_propertyGrid.IsReadOnly = true;
			_propertyGrid.SelectedObject = properties;

			updatePropertiesTimer.Interval = new TimeSpan(0, 0, 0, 1);
			updatePropertiesTimer.Tick += UpdateProperties;
			updatePropertiesTimer.Start();
			
			Closed += OnClosed;
		}
        public DAGroupItemProperties(ServerNode serverNode, string itemId)
		{
			InitializeComponent();

            serverNode.GetDAItemPropertiesAsync(itemId, (task, args) =>
            {
                var result = (KeyValuePair<ItemProperty[], ItemPropertyValue[]>) args.Result;
                var properties = new List<DAGroupItemProperty>(result.Key.Length);
                for (var i = 0; i < result.Key.Length; ++i)
                    properties.Add(new DAGroupItemProperty
                    {
                        Id = result.Key[i].Id,
                        Description = result.Key[i].Description,
                        Type = result.Key[i].Type,
                        SubType = result.Key[i].SubType,
                        Value = result.Value[i].Value,
                        Error = result.Value[i].Error,
                    });
                _itemPropertiesList.ItemsSource = properties;
            });                
		}