Пример #1
0
        public TemplateTreeViewItemViewModel(BrowserViewModel browser, DocumentServiceViewModel documentService, DiffTemplate diffTemplate)
            : base(browser)
        {
            this.documentService                     = documentService;
            this.Source                              = diffTemplate;
            this.Source.PropertyChanged             += DiffTemplate_PropertyChanged;
            this.Source.SourceItem1.PropertyChanged += Template1_PropertyChanged;
            this.Source.SourceItem2.PropertyChanged += Template2_PropertyChanged;
            this.header1                             = diffTemplate.Header1;
            this.header2                             = diffTemplate.Header2;
            this.ViewCommand                         = new DelegateCommand(this.View);
            this.IsActivated                         = diffTemplate.DiffState != DiffState.Unchanged;
            this.Target                              = diffTemplate;

            foreach (var item in this.Source.DiffTable.Childs)
            {
                this.Items.Add(new TemplateTreeViewItemViewModel(browser, documentService, diffTemplate: item.Template));
            }
            this.Dispatcher.InvokeAsync(() =>
            {
                if (this.DiffState != DiffState.Unchanged && this.Parent != null)
                {
                    this.Parent.IsExpanded = true;
                }
            });
        }
Пример #2
0
        public TableTreeViewItemViewModel(BrowserViewModel browser, DocumentServiceViewModel documentService, DiffDataTable diffTable)
            : base(browser)
        {
            this.documentService                     = documentService;
            this.Source                              = diffTable;
            this.Source.PropertyChanged             += DiffType_PropertyChanged;
            this.Source.SourceItem1.PropertyChanged += SourceItem1_PropertyChanged;
            this.Source.SourceItem2.PropertyChanged += SourceItem2_PropertyChanged;
            this.header1                             = diffTable.Header1;
            this.header2                             = diffTable.Header2;
            this.ViewCommand                         = new DelegateCommand(this.View);
            this.IsActivated                         = diffTable.DiffState != DiffState.Unchanged;
            this.Target                              = diffTable;

            foreach (var item in diffTable.Childs)
            {
                var viewModel = new TableTreeViewItemViewModel(browser, documentService, diffTable: item);
                viewModel.PropertyChanged += ChildViewModel_PropertyChanged;
                this.Items.Add(viewModel);
                if (this.IsActivated == false && viewModel.DiffState != DiffState.Unchanged)
                {
                    this.IsActivated = true;
                }
            }
            this.Dispatcher.InvokeAsync(() =>
            {
                if (this.DiffState != DiffState.Unchanged && this.Parent != null)
                {
                    this.Parent.IsExpanded = true;
                }
            });
        }
 public TypeTreeViewItemViewModel(BrowserViewModel browser, DocumentServiceViewModel documentService, DiffDataType diffType)
     : base(browser)
 {
     this.documentService                     = documentService;
     this.Source                              = diffType;
     this.Source.PropertyChanged             += DiffType_PropertyChanged;
     this.Source.SourceItem1.PropertyChanged += DataType1_PropertyChanged;
     this.Source.SourceItem2.PropertyChanged += DataType2_PropertyChanged;
     this.header1                             = diffType.Header1;
     this.header2                             = diffType.Header2;
     this.ViewCommand                         = new DelegateCommand(this.View);
     this.IsActivated                         = diffType.DiffState != DiffState.Unchanged;
     this.Target                              = diffType;
 }
Пример #4
0
 public DifferenceTreeViewItemViewModel(BrowserViewModel browser)
 {
     this.Browser = browser;
 }