private void View_Drop(object sender, DragEventArgs e)
        {
            object data = e.Data.GetData("Zhichkin.Metadata.Model.Entity");

            if (data == null)
            {
                return;
            }
            SetDefaultBackground(sender);

            Entity entity = data as Entity;

            if (entity == null)
            {
                return;
            }

            MetadataTreeViewModel viewModel = this.DataContext as MetadataTreeViewModel;

            if (viewModel == null)
            {
                return;
            }

            viewModel.BuildDataNodesTree(entity);

            Z.Notify(new Notification {
                Title = "Hermes", Content = "Узлы данных сформированы."
            });
        }
        private void TreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            MetadataTreeViewModel viewModel = this.DataContext as MetadataTreeViewModel;

            if (viewModel == null)
            {
                return;
            }
            viewModel.SelectedNode = (MetadataTreeNode)e.NewValue;
        }
示例#3
0
        private void BuildMetadataTree()
        {
            Z.ClearRightRegion(this.regionManager);
            IRegion rightRegion = this.regionManager.Regions[RegionNames.RightRegion];

            if (rightRegion == null)
            {
                return;
            }

            MetadataTreeViewModel model = new MetadataTreeViewModel();
            MetadataTreeView      view  = new MetadataTreeView();

            view.DataContext = model;
            rightRegion.Add(view);
        }
        public void DocumentsTreeIsBuilt(MetadataTreeNode root)
        {
            if (root == null)
            {
                return;
            }

            Dispatcher.Invoke(() =>
            {
                MetadataTreeViewModel viewModel = this.DataContext as MetadataTreeViewModel;
                if (viewModel == null)
                {
                    return;
                }
                viewModel.Nodes.Add(root);
            });
        }
 public void SetStateText(string text)
 {
     if (string.IsNullOrWhiteSpace(text))
     {
         return;
     }
     Dispatcher.Invoke(() =>
     {
         MetadataTreeViewModel viewModel = this.DataContext as MetadataTreeViewModel;
         if (viewModel == null)
         {
             return;
         }
         viewModel.SetStateText(text);
         int last_index = viewModel.StateList.Count - 1;
         this.StateListBox.SelectedIndex = last_index;
         this.StateListBox.ScrollIntoView(this.StateListBox.SelectedItem);
     });
 }