Exemple #1
0
        private void CloseTabExecutedHandler(object sender, ExecutedRoutedEventArgs args)
        {
            var currentDocument = (args.Parameter ?? sender) as DocumentPage;

            if (currentDocument == null)
            {
                return;
            }

            var activeDocument   = ActiveDocument;
            var previousDocument = EditorNavigationService.GetPreviousDocumentEdit();

            EditorNavigationService.IsEnabled = false;
            if (CloseDocument(currentDocument))
            {
                var isDocumentOpen = previousDocument != null && AllDocuments.Any(p => p.WorkDocument == previousDocument.Document);
                if (Equals(activeDocument, currentDocument) && isDocumentOpen)
                {
                    GoToEditCommand(previousDocument);
                }
                else
                {
                    DocumentTabControl.SelectedItem = activeDocument.TabItem;
                }
            }

            EditorNavigationService.IsEnabled = true;
        }
Exemple #2
0
        private void WindowLoadedHandler(object sender, RoutedEventArgs args)
        {
            _windowDatabaseMonitor.Owner = WindowTraceLog.Instance.Owner = this;

            CommandBindings.Add(new CommandBinding(GenericCommands.SaveAll, SaveAllCommandExecutedHandler));

            WorkDocumentCollection.RestoreWindowProperties(this);
            _windowDatabaseMonitor.RestoreAppearance();

            if (WorkDocumentCollection.WorkingDocuments.Count > 0)
            {
                foreach (var workingDocument in WorkDocumentCollection.WorkingDocuments.OrderBy(d => d.TabIndex))
                {
                    AddNewDocumentPage(workingDocument);
                }
            }
            else
            {
                AddNewDocumentPage();
            }

            DocumentTabControl.SelectionChanged += TabControlSelectionChangedHandler;

            DocumentTabControl.SelectedIndex = WorkDocumentCollection.ActiveDocumentIndex;

            ClipboardManager.RegisterWindow(this);
            ClipboardManager.ClipboardChanged += ClipboardChangedHandler;

            EditorNavigationService.Initialize(ActiveDocument.WorkDocument);
        }
Exemple #3
0
        private void TabControlSelectionChangedHandler(object sender, SelectionChangedEventArgs args)
        {
            var tabItem = args.AddedItems.Count == 0 ? null : args.AddedItems[0] as TabItem;

            if (tabItem?.Content is DocumentPage document)
            {
                document.SaveWorkingDocument();
                _findReplaceManager.CurrentEditor          = document.EditorAdapter;
                WorkDocumentCollection.ActiveDocumentIndex = DocumentTabControl.SelectedIndex;
                EditorNavigationService.RegisterDocumentCursorPosition(document.WorkDocument, document.Editor.CaretOffset);
            }

            if (!args.AddedItems.Contains(NewTabItem))
            {
                return;
            }

            AddNewDocumentPage();
        }
Exemple #4
0
 private void GoToPreviousEditCommandExecutedHandler(object sender, ExecutedRoutedEventArgs args)
 {
     GoToEditCommand(EditorNavigationService.GetPreviousEdit());
 }
Exemple #5
0
 private static void ClipboardChangedHandler(object sender, EventArgs eventArgs)
 {
     EditorNavigationService.RegisterClipboardEntry();
 }