void tabManager_OnAddRemoveTabState(TabManager<TabState> tabManager, TabManagerAddType addType, TabState tabState) { if (addType == TabManagerAddType.Add) { tabState.PropertyChanged += tabState_PropertyChanged; var dts = tabState as DecompileTabState; if (dts != null) { var view = dts.TextView; RemoveCommands(view); view.TextEditor.TextArea.MouseRightButtonDown += (s, e) => view.GoToMousePosition(); view.TextEditor.Options.EnableRectangularSelection = false; view.TextEditor.SetBinding(ICSharpCode.AvalonEdit.TextEditor.WordWrapProperty, new Binding("WordWrap") { Source = sessionSettings }); } if (OnTabStateAdded != null) OnTabStateAdded(this, new TabStateEventArgs(tabState)); } else if (addType == TabManagerAddType.Remove) { tabState.PropertyChanged -= tabState_PropertyChanged; if (OnTabStateRemoved != null) OnTabStateRemoved(this, new TabStateEventArgs(tabState)); } else if (addType == TabManagerAddType.Attach) { if (OnTabStateAttached != null) OnTabStateAttached(this, new TabStateEventArgs(tabState)); } else if (addType == TabManagerAddType.Detach) { if (OnTabStateDetached != null) OnTabStateDetached(this, new TabStateEventArgs(tabState)); } else throw new InvalidOperationException(); }
void tabManager_OnAddRemoveTabState(TabManager<TabStateDecompile> tabManager, TabManagerAddType addType, TabStateDecompile tabState) { var view = tabState.TextView; if (addType == TabManagerAddType.Add) { tabState.PropertyChanged += tabState_PropertyChanged; RemoveCommands(view); view.TextEditor.TextArea.MouseRightButtonDown += delegate { view.GoToMousePosition(); }; view.TextEditor.WordWrap = sessionSettings.WordWrap; view.TextEditor.Options.HighlightCurrentLine = sessionSettings.HighlightCurrentLine; view.TextEditor.Options.EnableRectangularSelection = false; if (OnDecompilerTextViewAdded != null) OnDecompilerTextViewAdded(this, new DecompilerTextViewEventArgs(view)); } else if (addType == TabManagerAddType.Remove) { tabState.PropertyChanged -= tabState_PropertyChanged; if (OnDecompilerTextViewRemoved != null) OnDecompilerTextViewRemoved(this, new DecompilerTextViewEventArgs(view)); } else if (addType == TabManagerAddType.Attach) { if (OnDecompilerTextViewAttached != null) OnDecompilerTextViewAttached(this, new DecompilerTextViewEventArgs(view)); } else if (addType == TabManagerAddType.Detach) { if (OnDecompilerTextViewDetached != null) OnDecompilerTextViewDetached(this, new DecompilerTextViewEventArgs(view)); } else throw new InvalidOperationException(); }