public static bool EditSettings(IWin32Window owner, TemporaryBlogSettings blogSettings, bool showAccountSettings, Type selectedPanel)
        {
            // make a copy of the blog settings for editing
            TemporaryBlogSettings editableBlogSettings = blogSettings.Clone() as TemporaryBlogSettings;

            // show form
            using (PreferencesForm preferencesForm = new PreferencesForm())
            {
                using (BlogClientUIContextScope uiContextScope = new BlogClientUIContextScope(preferencesForm))
                {
                    // customize form title and behavior
                    preferencesForm.Text = String.Format(CultureInfo.CurrentCulture, Res.Get(StringId.WeblogSettings), blogSettings.BlogName);
                    preferencesForm.HideApplyButton();

                    // panels
                    int iPanel = 0;
                    if (showAccountSettings)
                        preferencesForm.SetEntry(iPanel++, new AccountPanel(blogSettings, editableBlogSettings));

                    preferencesForm.SetEntry(iPanel++, new ImagesPanel(blogSettings, editableBlogSettings));
                    preferencesForm.SetEntry(iPanel++, new EditingPanel(blogSettings, editableBlogSettings));
                    preferencesForm.SetEntry(iPanel++, new BlogPluginsPanel(blogSettings, editableBlogSettings));
                    preferencesForm.SetEntry(iPanel++, new AdvancedPanel(blogSettings, editableBlogSettings));
                    preferencesForm.SelectEntry(selectedPanel);

                    // show the dialog
                    return (preferencesForm.ShowDialog(owner) == DialogResult.OK);
                }
            }
        }
        /// <summary>
        /// A version of show preferences that allows the caller to specify which
        /// panel should be selected when the dialog opens
        /// </summary>
        /// <param name="selectedPanelType"></param>
        public void ShowPreferences(IWin32Window owner, IBlogPostEditingSite editingSite, Type selectedPanelType)
        {
            //	Load preferences panels.
            LoadPreferencesPanels();

            //	Show the preferences form.
            using (new WaitCursor())
            {
                using (PreferencesForm preferencesForm = new PreferencesForm())
                {
                    //	Set the PreferencesPanel entries.
                    for (int i = 0; i < preferencesPanelTypes.Length; i++)
                    {
                        //	Add the entry.
                        Type type = preferencesPanelTypes[i];
                        PreferencesPanel panel = Activator.CreateInstance(type) as PreferencesPanel;
                        if (editingSite != null && panel is IBlogPostEditingSitePreferences)
                        {
                            (panel as IBlogPostEditingSitePreferences).EditingSite = editingSite;
                        }
                        preferencesForm.SetEntry(i, panel);

                        //	Select it, if requested.
                        if (type.Equals(selectedPanelType))
                            preferencesForm.SelectedIndex = i;
                    }

                    //	Provide a default selected index if none was specified.
                    if (preferencesForm.SelectedIndex == -1)
                        preferencesForm.SelectedIndex = 0;

                    //	Show the form.
                    preferencesForm.Win32Owner = owner;
                    preferencesForm.ShowDialog(owner);

                    // if we have an editing site then let it know that the account
                    // list may have been edited (allows it to adapt to the currently
                    // active weblog being deleted)
                    if (editingSite != null)
                        editingSite.NotifyWeblogAccountListEdited();
                }
            }
        }
 public void ShowWebProxyPreferences(IWin32Window owner)
 {
     //	Show the preferences form.
     using (new WaitCursor())
     {
         using (PreferencesForm preferencesForm = new PreferencesForm())
         {
             preferencesForm.Text = Res.Get(StringId.ProxyPrefTitle);
             preferencesForm.SetEntry(0, new WebProxyPreferencesPanel());
             preferencesForm.SelectedIndex = 0;
             preferencesForm.Win32Owner = owner;
             preferencesForm.ShowDialog(owner);
         }
     }
 }