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; }
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); }
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); } }
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)); }
protected override string GetHeader(TypeTreeViewItemViewModel item) { return(item.Header1); }
protected abstract string GetHeader(TypeTreeViewItemViewModel item);
protected abstract TypeInfo?GetTypeInfo(TypeTreeViewItemViewModel item);