public override void Dispose()
        {
            if (isDisposed)
            {
                return;
            }

            base.Dispose();

            isDisposed = true;
            CancelDocumentParsedUpdate();
            textEditorImpl.ViewContent.DirtyChanged -= HandleDirtyChanged;
            textEditor.MimeTypeChanged -= UpdateTextEditorOptions;
            textEditor.TextChanged     -= HandleTextChanged;
            textEditorImpl.ViewContent.ContentNameChanged -= ViewContent_ContentNameChanged;
            textEditorImpl.ViewContent.DirtyChanged       -= ViewContent_DirtyChanged;;

            DefaultSourceEditorOptions.Instance.Changed -= UpdateTextEditorOptions;
            RemovePolicyChangeHandler();
            RemoveAutoSaveTimer();
            textEditor.Dispose();
        }
Ejemplo n.º 2
0
        protected override void OnDispose()
        {
            if (isDisposed)
            {
                return;
            }

            isDisposed = true;

            HasUnsavedChangesChanged -= TextEditorViewContent_HasUnsavedChangesChanged;

            if (textEditorImpl != null)
            {
                if (autoSaveTask != null)
                {
                    autoSaveTask.Wait(TimeSpan.FromSeconds(5));
                }
                RemoveAutoSaveTimer();
                if (!string.IsNullOrEmpty(textEditorImpl.ContentName))
                {
                    AutoSave.RemoveAutoSaveFile(textEditorImpl.ContentName);
                }

                EditorConfigService.RemoveEditConfigContext(textEditor.FileName).Ignore();
                textEditorImpl.DirtyChanged -= HandleDirtyChanged;
                textEditor.MimeTypeChanged  -= UpdateTextEditorOptions;
                textEditor.TextChanged      -= HandleTextChanged;
                textEditorImpl.DirtyChanged -= ViewContent_DirtyChanged;;

                DefaultSourceEditorOptions.Instance.Changed -= UpdateTextEditorOptions;
                textEditor.Dispose();
            }
            RemovePolicyChangeHandler();

            editorOptionsUpdateCancellationSource?.Cancel();

            base.OnDispose();
        }
Ejemplo n.º 3
0
        public override void Dispose()
        {
            if (isDisposed)
            {
                return;
            }

            base.Dispose();

            isDisposed = true;
            EditorConfigService.RemoveEditConfigContext(textEditor.FileName).Ignore();
            CancelDocumentParsedUpdate();
            textEditorImpl.ViewContent.DirtyChanged -= HandleDirtyChanged;
            textEditor.MimeTypeChanged -= UpdateTextEditorOptions;
            textEditor.TextChanged     -= HandleTextChanged;
            textEditorImpl.ViewContent.ContentNameChanged -= ViewContent_ContentNameChanged;
            textEditorImpl.ViewContent.DirtyChanged       -= ViewContent_DirtyChanged;;

            DefaultSourceEditorOptions.Instance.Changed -= UpdateTextEditorOptions;
            RemovePolicyChangeHandler();
            editorOptionsUpdateCancellationSource?.Cancel();
            RemoveAutoSaveTimer();
            textEditor.Dispose();
        }