/// <summary> /// Initialization after the extension loads /// </summary> public void OnLoad() { // Locate the original sessions listview lvSessions = FiddlerApplication.UI.pnlSessions.Controls[Constants.ListViewName] as SessionListView; FiddlerApplication.UI.pnlSessions.SizeChanged += new EventHandler(pnlSessions_SizeChanged); // Create our TreeView tv = new CustomTreeView(); tv.Name = Constants.TreeViewName; tv.ImageList = this.imageList; tv.Location = lvSessions.Location; tv.Size = lvSessions.Size; tv.HideSelection = false; // If "false" the highlight is too "light", so we'll keep the selection "manually" tv.ContextMenu = FiddlerApplication.UI.mnuSessionContext; // Assign same context menu //tv.BeforeSelect += new TreeViewCancelEventHandler(tv_BeforeSelect); //tv.LostFocus += new EventHandler(tv_LostFocus); tv.AfterSelect += new TreeViewEventHandler(tv_AfterSelect); tv.AfterCollapse += new TreeViewEventHandler(tv_AfterCollapse); tv.AfterExpand += new TreeViewEventHandler(tv_AfterExpand); tv.NodeMouseDoubleClick += new TreeNodeMouseClickEventHandler(tv_NodeMouseDoubleClick); //tv.KeyDown += new KeyEventHandler(tv_KeyDown); //tv.PreviewKeyDown += new PreviewKeyDownEventHandler(tv_PreviewKeyDown); FiddlerApplication.UI.pnlSessions.Controls.Add(tv); // Show or hide depending on the registry value this.ShowHidePanel(); // TODO: Avoid hardcoded reference to the actual button // TODO: Research possible error executing the following (code after this would not execute) foreach (Control c in FiddlerApplication.UI.Controls) { if (c is ToolStrip) { ToolStrip menuBar = c as ToolStrip; foreach (ToolStripItem btn in menuBar.Items) { //if (btn.Text.Equals(Constants.RemoveButtonText, StringComparison.CurrentCultureIgnoreCase)) //if (btn.ToolTipText.Equals(Constants.RemoveButtonToolTipText, StringComparison.CurrentCultureIgnoreCase)) if (btn.ImageKey.Equals(Constants.RemoveButtonImageKey, StringComparison.CurrentCultureIgnoreCase)) { ToolStripDropDownButton btnRemove = btn as ToolStripDropDownButton; btnRemove.DropDownItemClicked += new ToolStripItemClickedEventHandler(btnRemove_DropDownItemClicked); } } } } }
/// <summary> /// Initialization after the extension loads /// </summary> public void OnLoad() { // Locate the original sessions listview lvSessions = FiddlerApplication.UI.pnlSessions.Controls[Constants.ListViewName] as SessionListView; if (lvSessions == null) { MessageBox.Show("Unable to locate original sessions panel.", Constants.RegistryExtensionKeyName); return; } this.Initialize(); lvSessions.Invalidated += LvSessions_Invalidated; FiddlerApplication.UI.pnlSessions.SizeChanged += new EventHandler(pnlSessions_SizeChanged); // Create our TreeView tv = new CustomTreeView { Name = Constants.TreeViewName, ImageList = this.imageList, Location = lvSessions.Location, Size = lvSessions.Size, HideSelection = false, // If "false" the highlight is too "light", so we'll keep the selection "manually" ContextMenu = FiddlerApplication.UI.mnuSessionContext // Assign same context menu }; //tv.BeforeSelect += new TreeViewCancelEventHandler(tv_BeforeSelect); //tv.LostFocus += new EventHandler(tv_LostFocus); tv.AfterSelect += new TreeViewEventHandler(tv_AfterSelect); tv.AfterCollapse += new TreeViewEventHandler(tv_AfterCollapse); tv.AfterExpand += new TreeViewEventHandler(tv_AfterExpand); tv.NodeMouseDoubleClick += new TreeNodeMouseClickEventHandler(tv_NodeMouseDoubleClick); //tv.KeyDown += new KeyEventHandler(tv_KeyDown); //tv.PreviewKeyDown += new PreviewKeyDownEventHandler(tv_PreviewKeyDown); FiddlerApplication.UI.pnlSessions.Controls.Add(tv); // Show or hide depending on the registry value this.ShowHidePanel(); }
public bool BindFiddlerResource() { this.ImageList = Fiddler.FiddlerApplication.UI.imglSessionIcons; //Find the Fiddler session list foreach (var item in Fiddler.FiddlerApplication.UI.pnlSessions.Controls) { if (item.GetType() == typeof(Fiddler.SessionListView)) { sessionListView = item as SessionListView; break; } } return sessionListView != null; }