Exemplo n.º 1
0
		public override void Execute(IMenuItemContext context) {
			if (!documentListLoader.CanLoad)
				return;

			documentListLoader.SaveCurrentDocumentsToList();

			var win = new OpenDocumentListDlg();
			const bool syntaxHighlight = true;
			var vm = new OpenDocumentListVM(syntaxHighlight, classificationFormatMap, textElementProvider, documentListService, labelMsg => messageBoxService.Ask<string>(labelMsg, ownerWindow: win, verifier: s => string.IsNullOrEmpty(s) ? dnSpy_Resources.OpenList_MissingName : string.Empty));
			win.DataContext = vm;
			win.Owner = appWindow.MainWindow;
			if (win.ShowDialog() != true)
				return;

			var flvm = win.SelectedItems.FirstOrDefault();
			var oldSelected = documentListService.SelectedDocumentList;
			if (flvm != null) {
				documentListLoader.SaveCurrentDocumentsToList();
				documentListService.Add(flvm.DocumentList);
				documentListService.SelectedDocumentList = flvm.DocumentList;
			}

			vm.Save();

			if (flvm == null)
				return;
			var documentList = flvm.DocumentList;
			if (documentList == oldSelected)
				return;

			documentListLoader.Load(documentList, new DsDocumentLoader(documentService, appWindow.MainWindow));
		}
Exemplo n.º 2
0
		public DocumentListVM(OpenDocumentListVM owner, DocumentList documentList, bool isExistingList, bool isUserList) {
			this.owner = owner;
			DocumentList = documentList;
			IsExistingList = isExistingList;
			IsUserList = isUserList;
		}