public CreateReferenceDlgViewModel(IBlockManager blockManager, TreeItemDto first)
        {
            _blockManager = blockManager;

            Block1 = new NamedGuid() {Caption = first.Caption, Uid = first.Id};
            IsTo = true;

            SelectBlockCommand = new DelegateCommand(() =>
            {
                var dlg = new SelectTagDlg(typeof(Block));
                var res = dlg.ShowDialog();
                if (res.HasValue && res.Value && dlg.Id.HasValue)
                {
                    var block = _blockManager.GetBlockById(dlg.Id.Value);

                    Block2 = new NamedGuid() {Caption = block.Caption, Uid = block.Id};
                    OnPropertyChanged("Block2");
                    OkCommand.RaiseCanExecuteChanged();
                }
            });

            OkCommand = new DelegateCommand<Window>(window =>
            {
                window.DialogResult = true;
                window.Close();
            }, window => Block2 != null);
        }
 public static TreeListNode NodeFromItem(TreeItemDto item)
 {
     var node = new TreeListNode()
     {
         Content = item,
         IsExpandButtonVisible = item.IsContainChildren() ? DefaultBoolean.True : DefaultBoolean.False,
         Image = item.GetMyImage()
     };
     return node;
 }
 protected virtual void OnRenameTag(TreeItemDto dto)
 {
     var handler = RenameTag;
     if (handler != null) handler(dto);
 }
 protected virtual void OnNodeAnnihilated(TreeItemDto obj)
 {
     Action<TreeItemDto> handler = NodeAnnihilated;
     if (handler != null) handler(obj);
 }
 protected virtual void OnNodeAdded(TreeItemDto addeDto)
 {
     var handler = NodeAdded;
     if (handler != null) handler(addeDto);
 }