Example #1
0
        public override void SelectObject(object obj)
        {
            if (this.viewModel != null)
            {
                this.viewModel.PropertyChanged -= ViewModel_PropertyChanged;
            }
            this.viewModel = obj as TemplateTreeViewItemViewModel;
            if (this.viewModel != null)
            {
                this.DisplayName = $"{Resources.Title_TableInfo}({this.GetHeader(this.viewModel)})";
                this.tableInfo   = this.GetTableInfo(this.viewModel);
                this.viewModel.PropertyChanged += ViewModel_PropertyChanged;
            }
            else
            {
                this.tableInfo = null;
            }

            if (this.tableInfo != null)
            {
                var tableInfo = this.tableInfo.Value;
                if (tableInfo.Name.StartsWith(DiffUtility.DiffDummyKey) == true)
                {
                    tableInfo.Name = tableInfo.Name.Substring(DiffUtility.DiffDummyKey.Length);
                }
                this.tableInfo = tableInfo;
            }

            this.NotifyOfPropertyChange(nameof(this.TableInfo));
            this.NotifyOfPropertyChange(nameof(this.IsVisible));
            this.NotifyOfPropertyChange(nameof(this.SelectedObject));
        }
        public override void SelectObject(object obj)
        {
            if (this.viewModel != null)
            {
                this.viewModel.PropertyChanged -= ViewModel_PropertyChanged;
            }
            this.viewModel = obj as TemplateTreeViewItemViewModel;
            if (this.viewModel != null)
            {
                this.DisplayName = $"{Resources.Title_ColumnInfo}({this.GetHeader(this.viewModel)})";
                this.tableInfo   = this.GetTableInfo(this.viewModel);
                this.viewModel.PropertyChanged += ViewModel_PropertyChanged;
            }
            else
            {
                this.tableInfo = null;
            }

            if (this.tableInfo != null)
            {
                this.columns = this.tableInfo.Value.Columns.Select(item => new TemplateColumnInfoItemViewModel(item)).ToArray();
            }
            else
            {
                this.columns = new TemplateColumnInfoItemViewModel[] { }
            };

            this.NotifyOfPropertyChange(nameof(this.Columns));
            this.NotifyOfPropertyChange(nameof(this.IsVisible));
            this.NotifyOfPropertyChange(nameof(this.SelectedObject));
        }
Example #3
0
        public override void SelectObject(object obj)
        {
            if (obj is TemplateTreeViewItemViewModel viewModel)
            {
                var query = from viewModelItem in this.GetViewModels()
                            join unresolvedItem in viewModel.Source.UnresolvedItems on viewModelItem.Target equals unresolvedItem
                            select viewModelItem;

                this.itemList.Clear();
                foreach (var item in query)
                {
                    var itemViewModel = new TemplateUnresolvedItemListBoxItemViewModel(item);
                    this.itemList.Add(itemViewModel);
                    itemViewModel.PropertyChanged += ItemViewModel_PropertyChanged;
                }

                foreach (var item in itemList)
                {
                    this.compositionService.SatisfyImportsOnce(item);
                }

                this.viewModel    = viewModel;
                this.selectedItem = this.itemList.FirstOrDefault();
            }
            else
            {
                this.itemList.Clear();
                this.viewModel = null;
            }
            this.NotifyOfPropertyChange(nameof(this.DisplayName));
            this.NotifyOfPropertyChange(nameof(this.IsVisible));
            this.NotifyOfPropertyChange(nameof(this.Items));
        }
Example #4
0
 protected override TableInfo?GetTableInfo(TemplateTreeViewItemViewModel item)
 {
     if (item.DiffState == DiffState.Inserted)
     {
         return(null);
     }
     return(item.Source1.TableInfo);
 }
        public void View(TemplateTreeViewItemViewModel viewModel)
        {
            var targetModel = (TemplateTreeViewItemViewModel)viewModel.Parent ?? viewModel;
            var document    = this.Items.OfType <TemplateDocumentViewModel>().FirstOrDefault(item => item.Source == targetModel.Source);

            if (document == null)
            {
                document = new TemplateDocumentViewModel(targetModel);
                this.Items.Add(document);
            }
            document.SelectedName = $"{viewModel}";
            this.ActivateItem(document);
        }
 public TemplateDocumentViewModel(TemplateTreeViewItemViewModel viewModel)
 {
     this.viewModel = viewModel;
     this.viewModel.PropertyChanged += ViewModel_PropertyChanged;
     this.itemList.Add(new TemplateDocumentItemViewModel(viewModel));
     foreach (var item in viewModel.Items.OfType <TemplateTreeViewItemViewModel>())
     {
         this.itemList.Add(new TemplateDocumentItemViewModel(item));
     }
     foreach (var item in this.itemList)
     {
         item.PropertyChanged += DocumentItem_PropertyChanged;
     }
     this.undoService.Changed += UndoService_Changed;
     this.resolveCommand       = new DelegateCommand((p) => this.Resolve(), (p) => this.CanResolve);
     this.SelectedItem         = this.itemList.First();
     this.DisplayName          = viewModel.DisplayName;
 }
        private void UpdateItemsSource()
        {
            var dataSet            = this.shell.DataSet;
            var compositionService = this.ServiceProvider.GetService(typeof(ICompositionService)) as ICompositionService;

            foreach (var item in dataSet.Tables)
            {
                if (item.TemplatedParent != null)
                {
                    continue;
                }
                var viewModel = new TemplateTreeViewItemViewModel(item.Template)
                {
                    Header1 = dataSet.Header1,
                    Header2 = dataSet.Header2
                };
                compositionService.SatisfyImportsOnce(viewModel);
                this.Items.Add(viewModel);
            }
        }
Example #8
0
 protected abstract string GetHeader(TemplateTreeViewItemViewModel item);
Example #9
0
 protected abstract TableInfo?GetTableInfo(TemplateTreeViewItemViewModel item);
Example #10
0
 protected override string GetHeader(TemplateTreeViewItemViewModel item)
 {
     return(item.Header1);
 }
 public TemplateDocumentItemViewModel(TemplateTreeViewItemViewModel viewModel)
 {
     this.viewModel = viewModel;
 }