1- using System ;
2- using System . Windows . Forms ;
3- using Fiddler ;
1+ using Fiddler ;
42using Microsoft . Win32 ;
3+ using System ;
54using System . Drawing ;
5+ using System . Windows . Forms ;
66
77namespace TreeViewPanelExtension
88{
@@ -28,17 +28,17 @@ public class TreePanel : IFiddlerExtension
2828 /// <summary>
2929 /// New menu item
3030 /// </summary>
31- private System . Windows . Forms . MenuItem mnuShowPanel ;
31+ private MenuItem mnuShowPanel ;
3232
3333 /// <summary>
3434 /// New menu item to show/hide the panel
3535 /// </summary>
36- private System . Windows . Forms . MenuItem miShowPanelEnabled ;
36+ private MenuItem miShowPanelEnabled ;
3737
3838 /// <summary>
3939 /// New item to show about information
4040 /// </summary>
41- private System . Windows . Forms . MenuItem miAbout ;
41+ private MenuItem miAbout ;
4242
4343 /// <summary>
4444 /// To keep images to be used in the TreeView
@@ -64,7 +64,7 @@ public class TreePanel : IFiddlerExtension
6464 public TreePanel ( )
6565 {
6666 this . ShowPanel = false ; // Default
67-
67+
6868 // Try to get registry configuration
6969 RegistryKey oReg = Registry . CurrentUser . OpenSubKey ( String . Format ( @"{0}\{1}\" , CONFIG . GetRegPath ( "Root" ) , Constants . RegistryExtensionKeyName ) ) ;
7070 if ( null != oReg )
@@ -75,10 +75,10 @@ public TreePanel()
7575 }
7676
7777 // Initialize menu options
78- this . mnuShowPanel = new System . Windows . Forms . MenuItem ( ) ;
79- this . miShowPanelEnabled = new System . Windows . Forms . MenuItem ( ) ;
80- this . miAbout = new System . Windows . Forms . MenuItem ( ) ;
81- this . mnuShowPanel . MenuItems . AddRange ( new System . Windows . Forms . MenuItem [ ] { this . miShowPanelEnabled , this . miAbout } ) ;
78+ this . mnuShowPanel = new MenuItem ( ) ;
79+ this . miShowPanelEnabled = new MenuItem ( ) ;
80+ this . miAbout = new MenuItem ( ) ;
81+ this . mnuShowPanel . MenuItems . AddRange ( new MenuItem [ ] { this . miShowPanelEnabled , this . miAbout } ) ;
8282
8383 this . mnuShowPanel . Text = "TreeView&Panel" ;
8484 this . miShowPanelEnabled . Index = 0 ;
@@ -287,30 +287,6 @@ private void tv_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
287287 }
288288 }
289289
290- /// <summary>
291- /// Delete sessions from the TreeView
292- /// </summary>
293- /// <param name="sender">Sender</param>
294- /// <param name="e">ToolStripItemClickedEventArgs</param>
295- private void btnRemove_DropDownItemClicked ( object sender , ToolStripItemClickedEventArgs e )
296- {
297- switch ( e . ClickedItem . Text . ToLower ( ) )
298- {
299- case "remove all" :
300- tv . Nodes . Clear ( ) ;
301- break ;
302- case "images" :
303- break ;
304- case "connects" :
305- break ;
306- case "non-200s" :
307- break ;
308- default :
309- // Other possible things to do here
310- break ;
311- }
312- }
313-
314290 #endregion "Methods"
315291
316292 #region "IFiddlerExtension Members"
@@ -348,26 +324,6 @@ public void OnLoad()
348324
349325 // Show or hide depending on the registry value
350326 this . ShowHidePanel ( ) ;
351-
352- // TODO: Avoid hardcoded reference to the actual button
353- // TODO: Research possible error executing the following (code after this would not execute)
354- foreach ( Control c in FiddlerApplication . UI . Controls )
355- {
356- if ( c is ToolStrip )
357- {
358- ToolStrip menuBar = c as ToolStrip ;
359- foreach ( ToolStripItem btn in menuBar . Items )
360- {
361- //if (btn.Text.Equals(Constants.RemoveButtonText, StringComparison.CurrentCultureIgnoreCase))
362- //if (btn.ToolTipText.Equals(Constants.RemoveButtonToolTipText, StringComparison.CurrentCultureIgnoreCase))
363- if ( btn . ImageKey . Equals ( Constants . RemoveButtonImageKey , StringComparison . CurrentCultureIgnoreCase ) )
364- {
365- ToolStripDropDownButton btnRemove = btn as ToolStripDropDownButton ;
366- btnRemove . DropDownItemClicked += new ToolStripItemClickedEventHandler ( btnRemove_DropDownItemClicked ) ;
367- }
368- }
369- }
370- }
371327 }
372328
373329 private void LvSessions_Invalidated ( object sender , InvalidateEventArgs e )
@@ -392,7 +348,7 @@ public void OnBeforeUnload()
392348 oReg . SetValue ( Constants . RegistryShowPanel , value , RegistryValueKind . DWord ) ;
393349 oReg . Close ( ) ;
394350 }
395-
351+
396352 #endregion "IFiddlerExtension Members"
397353 }
398354}
0 commit comments