Ejemplo n.º 1
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public TreePanel()
        {
            this.ShowPanel = false; // Default

            // Try to get registry configuration
            RegistryKey oReg = Registry.CurrentUser.OpenSubKey(String.Format(@"{0}\{1}\", CONFIG.GetRegPath("Root"), Constants.RegistryExtensionKeyName));

            if (null != oReg)
            {
                int showPanel = (int)oReg.GetValue(Constants.RegistryShowPanel, 0);
                this.ShowPanel = (showPanel == 1);
                oReg.Close();
            }

            // Initialize menu options
            this.mnuShowPanel       = new System.Windows.Forms.MenuItem();
            this.miShowPanelEnabled = new System.Windows.Forms.MenuItem();
            this.miAbout            = new System.Windows.Forms.MenuItem();
            this.mnuShowPanel.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.miShowPanelEnabled, this.miAbout });

            this.mnuShowPanel.Text           = "TreeView&Panel";
            this.miShowPanelEnabled.Index    = 0;
            this.miShowPanelEnabled.Text     = "V&isible";
            this.miShowPanelEnabled.Shortcut = Shortcut.CtrlF1;
            this.miShowPanelEnabled.Checked  = this.ShowPanel;
            this.miShowPanelEnabled.Click   += new EventHandler(miShowPanelEnabled_Click);

            this.miAbout.Index  = 1;
            this.miAbout.Text   = "&About...";
            this.miAbout.Click += new EventHandler(miAbout_Click);

            // Add our menu option before the last option (Help) to keep Windows consistency
            FiddlerApplication.UI.mnuMain.MenuItems.Add(FiddlerApplication.UI.mnuMain.MenuItems.Count - 1, mnuShowPanel);

            // Initialize images from the embedded resource file
            this.imageList = new ImageList();
            this.imageList.Images.Add(Constants.ImageKeyGlobe, Resources._1403_Globe_16x16);
            this.imageList.Images.Add(Constants.ImageKeyHost, Resources._1409_Monitor_16x16);                          // Host
            this.imageList.Images.Add(Constants.ImageKeyClosedFolder, Resources.Folder_16x16);                         // Closed folder
            this.imageList.Images.Add(Constants.ImageKeyOpenFolder, Resources.FolderOpen_16x16_72);                    // Open folder
            this.imageList.Images.Add(Constants.ImageKeyHttpCode200, Resources._109_AllAnnotations_Default_16x16_72);  // 200, OK
            this.imageList.Images.Add(Constants.ImageKeyHttpCode301, Resources._010_LowPriority_16x16_72);             // 301, Moved permanently
            this.imageList.Images.Add(Constants.ImageKeyHttpCode304, Resources._109_AllAnnotations_Complete_16x16_72); // 304, Unmodified
            this.imageList.Images.Add(Constants.ImageKeyHttpCode401, Resources._109_AllAnnotations_donotenter_16x16);  // 401, Forbidden
            this.imageList.Images.Add(Constants.ImageKeyHttpCode404, Resources._109_AllAnnotations_Error_16x16_72);    // 404, Not found
            this.imageList.Images.Add(Constants.ImageKeyGenericImage, Resources.generic_picture_16x16);                // Images
            this.imageList.Images.Add(Constants.ImageKeyGenericImageVisited, Resources.generic_picture_16x16_visited); // Images
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Before unloading the extension
        /// </summary>
        public void OnBeforeUnload()
        {
            // Save the persistent values to the registry
            RegistryKey oReg  = Registry.CurrentUser.CreateSubKey(String.Format(@"{0}\{1}\", CONFIG.GetRegPath("Root"), Constants.RegistryExtensionKeyName));
            int         value = this.ShowPanel ? 1 : 0;

            oReg.SetValue(Constants.RegistryShowPanel, value, RegistryValueKind.DWord);
            oReg.Close();
        }