Пример #1
0
        /// <summary>
        /// The Logic for the WebPart Customization is contained in a separate DLL because it is customer-specifc.
        /// So SUSHI looks for any DLL in the same directory and uses reflection to load it.
        /// </summary>
        private void populateWebpartCustomizationProfiles()
        {
            DirectoryInfo di = new DirectoryInfo(Application.StartupPath);

            foreach (FileInfo fi in di.GetFiles("SushiClientLibrary_*.dll"))
            {
                try
                {
                    Assembly asm = Assembly.LoadFile(fi.FullName);

                    Type t = Assembly.LoadFile(fi.FullName).GetType("SushiClientLibrary_P1.ActionBulkWebPartCustomization_p1");
                    WebpartBulkClientLibParentProfile profile = (WebpartBulkClientLibParentProfile)Activator.CreateInstance(t);
                    //--set a reference to the rtbDisplay so text can be written to it.
                    profile.InitializeStuff(rtbDisplay);

                    cboProfiles.Items.Add(profile);
                }
                catch (Exception ex)
                {
                    AddToRtbLocal("Problem loading assembly from " + fi.FullName + " " + ex.Message, StyleType.bodyBlue);
                }
                //--select default
                cboProfiles.SelectedIndex = cboProfiles.FindStringExact(GlobalVars.SETTINGS.bulkWebPartCustomization_defaultProfile);
            }
        }
Пример #2
0
        private void DoWebpartBulkCustomization(bool onlyValidate)
        {
            rtbDisplay.Clear();
            AddToRtbLocal("Bulk WebPart Customization" + Util.V(onlyValidate) + "\r\n", StyleType.titleSeagreen);

            if (cboProfiles.SelectedItem == null)
            {
                AddToRtbLocal("Please select a profile\r\n", StyleType.bodyBlack);
                return;
            }

            WebpartBulkClientLibParentProfile profile = (WebpartBulkClientLibParentProfile)cboProfiles.SelectedItem;

            profile.DoWebpartCustomization(onlyValidate, txtTargetSite, rtbSiteValidateMessage);
        }