Beispiel #1
0
        public void DeleteTextEditor(ITextEditor textEditor)
        {
            if (textEditor == null)
            {
                return;
            }
            var item = GetTextEditorSetsViewItem(textEditor);

            if (item == null)
            {
                return;
            }
            item.IsEnabled = false;
            item.PrepareForClosing();
            Sets.Items?.Remove(item);

            if (item.ContextFlyout is TabContextFlyout tabContextFlyout)
            {
                tabContextFlyout.Dispose();
            }

            TextEditorUnloaded?.Invoke(this, textEditor);

            textEditor.Loaded                       -= TextEditor_Loaded;
            textEditor.Unloaded                     -= TextEditor_Unloaded;
            textEditor.KeyDown                      -= TextEditorKeyDown;
            textEditor.SelectionChanged             -= TextEditor_OnSelectionChanged;
            textEditor.FontZoomFactorChanged        -= TextEditor_OnFontZoomFactorChanged;
            textEditor.ModificationStateChanged     -= TextEditor_OnEditorModificationStateChanged;
            textEditor.ModeChanged                  -= TextEditor_OnModeChanged;
            textEditor.FileModificationStateChanged -= TextEditor_OnFileModificationStateChanged;
            textEditor.LineEndingChanged            -= TextEditor_OnLineEndingChanged;
            textEditor.EncodingChanged              -= TextEditor_OnEncodingChanged;
            textEditor.Dispose();
        }
Beispiel #2
0
        private void OnDisposed(object sender, EventArgs e)
        {
            Console.WriteLine("Dispose python host");
            host?.Dispose();
            host = null;

            textEditor?.Dispose();
            textEditor = null;
        }
Beispiel #3
0
 private void OnDisposed(object sender, EventArgs e)
 {
     this.Disposed -= OnDisposed;
     _editor?.Dispose();
     _editor = null;
 }