Example #1
0
 public TypeDocumentViewModel(TypeTreeViewItemViewModel viewModel)
 {
     this.viewModel            = viewModel;
     this.undoService.Changed += UndoService_Changed;
     this.resolveCommand       = new DelegateCommand(async(p) => await this.ResolveAsync(), (p) => this.CanResolve);
     this.DisplayName          = viewModel.DisplayName;
 }
Example #2
0
 protected override TypeInfo?GetTypeInfo(TypeTreeViewItemViewModel item)
 {
     if (item.DiffState == DiffState.Inserted && item.IsResolved == false)
     {
         return(null);
     }
     return(item.Source1.TypeInfo);
 }
        public async Task ViewAsync(TypeTreeViewItemViewModel viewModel)
        {
            var cancellation = new CancellationTokenSource();
            var document     = this.Items.OfType <TypeDocumentViewModel>().FirstOrDefault(item => item.Source == viewModel.Source);

            if (document == null)
            {
                document = new TypeDocumentViewModel(viewModel);
                this.Items.Add(document);
            }
            await this.ActivateItemAsync(document, cancellation.Token);
        }
Example #4
0
        private void UpdateItemsSource()
        {
            var dataSet            = this.shell.DataSet;
            var compositionService = this.ServiceProvider.GetService(typeof(ICompositionService)) as ICompositionService;

            foreach (var item in dataSet.Types)
            {
                var viewModel = new TypeTreeViewItemViewModel(item)
                {
                    Header1 = dataSet.Header1,
                    Header2 = dataSet.Header2
                };
                compositionService.SatisfyImportsOnce(viewModel);
                this.Items.Add(viewModel);
            }
        }
Example #5
0
        public override void SelectObject(object obj)
        {
            if (this.viewModel != null)
            {
                this.viewModel.PropertyChanged -= ViewModel_PropertyChanged;
            }
            this.viewModel = obj as TypeTreeViewItemViewModel;
            if (this.viewModel != null)
            {
                this.DisplayName = $"{Resources.Title_TypeInfo}({this.GetHeader(this.viewModel)})";
                this.typeInfo    = this.GetTypeInfo(this.viewModel);
                this.viewModel.PropertyChanged += ViewModel_PropertyChanged;
            }
            else
            {
                this.typeInfo = null;
            }

            this.NotifyOfPropertyChange(nameof(this.TypeInfo));
            this.NotifyOfPropertyChange(nameof(this.IsVisible));
            this.NotifyOfPropertyChange(nameof(this.SelectedObject));
        }
Example #6
0
 protected override string GetHeader(TypeTreeViewItemViewModel item)
 {
     return(item.Header1);
 }
Example #7
0
 protected abstract string GetHeader(TypeTreeViewItemViewModel item);
Example #8
0
 protected abstract TypeInfo?GetTypeInfo(TypeTreeViewItemViewModel item);