Exemple #1
0
        //====================================================================================
        #endregion

        #region UI Manager
        //====================================================================================
        /// <summary>
        /// Display the UI Settings for the currently selected site
        /// </summary>
        private void btnDisplayUISettings_Click(object sender, EventArgs e)
        {
            UIGrid.Rows.Clear();

            SPWebApplication webApp = GetSelectedWebApplication();

            if (webApp == null)
            {
                return;
            }

            try
            {
                progressBar1.Value   = 0;
                collectionLabel.Text = "Total Sites: Loading...Please Wait";
                this.Invalidate();
                this.Update();

                foreach (SPSite site in webApp.Sites)
                {
                    foreach (SPWeb web in site.AllWebs)
                    {
                        int             rowIndex = UIGrid.Rows.Add();
                        DataGridViewRow row      = UIGrid.Rows[rowIndex];
                        row.Cells["URL"].Value               = web.Url.ToString();
                        row.Cells["Theme"].Value             = web.Theme.ToString() == "" ? "Default Theme" : web.Theme.ToString();
                        row.Cells["Master_URL"].Value        = System.IO.Path.GetFileName(web.MasterUrl.ToString());       //.Substring(web.MasterUrl.LastIndexOf('/'));
                        row.Cells["Custom_Master_URL"].Value = System.IO.Path.GetFileName(web.CustomMasterUrl.ToString()); //.Substring(web.MasterUrl.LastIndexOf('/'));
                        row.Cells["Alternate_CSS_URL"].Value = string.IsNullOrEmpty(web.AlternateCssUrl) ? "N/A" : web.AlternateCssUrl;
                        web.Dispose();
                    }
                    site.Dispose();
                }
                UIGrid.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
                collectionLabel.Text = "Total Sites: " + (UIGrid.Rows.Count - 1);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }