Пример #1
0
#pragma warning disable VSTHRD100 // Avoid async void methods
        private async void Document_Opened(object sender, EventArgs e)
#pragma warning restore VSTHRD100 // Avoid async void methods
        {
            try
            {
                // This event is called by the EditorDocumentManager, which runs on the UI thread.
                // However, due to accessing the project snapshot manager, we need to switch to
                // running on the project snapshot manager's specialized thread.
                await _projectSnapshotManagerDispatcher.RunOnDispatcherThreadAsync(() =>
                {
                    var document = (EditorDocument)sender;
                    _projectManager.DocumentOpened(document.ProjectFilePath, document.DocumentFilePath, document.EditorTextContainer.CurrentText);
                }, CancellationToken.None).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                Debug.Fail("EditorDocumentManagerListener.Document_Opened threw exception:" +
                           Environment.NewLine + ex.Message + Environment.NewLine + "Stack trace:" + Environment.NewLine + ex.StackTrace);
            }
        }
Пример #2
0
        private void Document_Opened(object sender, EventArgs e)
        {
            var document = (EditorDocument)sender;

            _projectManager.DocumentOpened(document.ProjectFilePath, document.DocumentFilePath, document.EditorTextContainer.CurrentText);
        }