示例#1
0
        public OpenDocumentListVM(bool syntaxHighlight, IClassificationFormatMap classificationFormatMap, ITextElementProvider textElementProvider, DocumentListService documentListService, Func <string, string> askUser)
        {
            this.SyntaxHighlight         = syntaxHighlight;
            this.ClassificationFormatMap = classificationFormatMap;
            this.TextElementProvider     = textElementProvider;
            this.documentListService     = documentListService;
            this.askUser                   = askUser;
            this.documentListColl          = new ObservableCollection <DocumentListVM>();
            this.collectionView            = (ListCollectionView)CollectionViewSource.GetDefaultView(documentListColl);
            this.collectionView.CustomSort = new DocumentListVM_Comparer();
            this.selectedItems             = Array.Empty <DocumentListVM>();
            this.removedDocumentLists      = new HashSet <DocumentListVM>();
            this.addedDocumentLists        = new List <DocumentListVM>();
            this.cancellationTokenSource   = new CancellationTokenSource();
            this.cancellationToken         = cancellationTokenSource.Token;
            this.searchingForDefaultLists  = true;

            var hash = new HashSet <string>(StringComparer.OrdinalIgnoreCase);

            foreach (var documentList in documentListService.DocumentLists)
            {
                hash.Add(documentList.Name);
                documentListColl.Add(new DocumentListVM(this, documentList, true, true));
            }
            Refilter();

            Task.Factory.StartNew(() => new DefaultDocumentListFinder(cancellationToken).Find(), cancellationToken)
            .ContinueWith(t => {
                var ex = t.Exception;
                SearchingForDefaultLists = false;
                if (!t.IsCanceled && !t.IsFaulted)
                {
                    foreach (var defaultList in t.Result)
                    {
                        if (hash.Contains(defaultList.Name))
                        {
                            continue;
                        }
                        var documentList = new DocumentList(defaultList);
                        documentListColl.Add(new DocumentListVM(this, documentList, false, false));
                    }
                    Refilter();
                }
            }, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());
        }
示例#2
0
 public DocumentList(DocumentListService documentListService)
 {
     _documentListService = documentListService;
 }
 public DocumentListDataController(IWidgetService <DocumentListWidget> widgetService, DocumentListService documentListService)
 {
     _widgetService       = widgetService;
     _documentListService = documentListService;
 }
示例#4
0
		public OpenDocumentListVM(bool syntaxHighlight, IClassificationFormatMap classificationFormatMap, ITextElementProvider textElementProvider, DocumentListService documentListService, Func<string, string> askUser) {
			SyntaxHighlight = syntaxHighlight;
			ClassificationFormatMap = classificationFormatMap;
			TextElementProvider = textElementProvider;
			this.documentListService = documentListService;
			this.askUser = askUser;
			documentListColl = new ObservableCollection<DocumentListVM>();
			collectionView = (ListCollectionView)CollectionViewSource.GetDefaultView(documentListColl);
			collectionView.CustomSort = new DocumentListVM_Comparer();
			selectedItems = Array.Empty<DocumentListVM>();
			removedDocumentLists = new HashSet<DocumentListVM>();
			addedDocumentLists = new List<DocumentListVM>();
			cancellationTokenSource = new CancellationTokenSource();
			cancellationToken = cancellationTokenSource.Token;
			searchingForDefaultLists = true;

			var hash = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
			foreach (var documentList in documentListService.DocumentLists) {
				hash.Add(documentList.Name);
				documentListColl.Add(new DocumentListVM(this, documentList, true, true));
			}
			Refilter();

			Task.Factory.StartNew(() => new DefaultDocumentListFinder(cancellationToken).Find(), cancellationToken)
			.ContinueWith(t => {
				var ex = t.Exception;
				SearchingForDefaultLists = false;
				if (!t.IsCanceled && !t.IsFaulted) {
					foreach (var defaultList in t.Result) {
						if (hash.Contains(defaultList.Name))
							continue;
						var documentList = new DocumentList(defaultList);
						documentListColl.Add(new DocumentListVM(this, documentList, false, false));
					}
					Refilter();
				}
			}, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());
		}
 public DocumentListTitleForm(DocumentListService documentService)
 {
     _documentService = documentService;
 }
示例#6
0
 public AddDocumentListItemsForm(DocumentListService documentListService)
 {
     _documentListService = documentListService;
 }