Exemplo n.º 1
0
        public override bool ApplyChanges()
        {
            EnsureChildControls();

            TitleWebpart.TitleWebpart webPartToEdit = (TitleWebpart.TitleWebpart) this.WebPartToEdit;
            if (webPartToEdit != null)
            {
                webPartToEdit.FirstString           = txtTitle1.Text;
                webPartToEdit.SecondString          = txtTitle2.Text;
                webPartToEdit.FirstBackColorString  = txtFirstBackColorBox.Text;
                webPartToEdit.FirstForeColorString  = txtFirstForeColorBox.Text;
                webPartToEdit.SecondBackColorString = txtSecondBackColorBox.Text;
                webPartToEdit.SecondForeColorString = txtSecondForeColorBox.Text;
                webPartToEdit.FirstFontName         = drpFirstFonts.SelectedValue;
                webPartToEdit.FirstFontSize         = int.Parse(drpFirstSize.SelectedValue);
                webPartToEdit.FirstFontItallic      = drpFirstItallic.SelectedIndex == 0 ? true : false;
                webPartToEdit.FirstFontBold         = drpFirstBold.SelectedIndex == 0 ? true : false;
                webPartToEdit.FirstFontUnderline    = drpFirstUnderline.SelectedIndex == 0 ? true : false;
                webPartToEdit.SecondFontName        = drpSecondFonts.SelectedValue;
                webPartToEdit.SecondFontSize        = int.Parse(drpSecondSize.SelectedValue);
                webPartToEdit.SecondFontItallic     = drpSecondItallic.SelectedIndex == 0 ? true : false;
                webPartToEdit.SecondFontBold        = drpSecondBold.SelectedIndex == 0 ? true : false;
                webPartToEdit.SecondFontUnderline   = drpSecondUnderline.SelectedIndex == 0 ? true : false;
                webPartToEdit.IsSyncronised         = drpSyncWithStore.SelectedIndex == 0 ? true : false;
                webPartToEdit.ImageUrl   = txtImageUrl.Text;
                webPartToEdit.ImageStyle = drpImageStyle.SelectedValue;
                webPartToEdit.IsDebug    = chkDebug.Checked;

                // sync with main storage
                if (drpSyncWithStore.SelectedValue.ToString().Equals("true"))
                {
                    using (SPSetttingsProvider prov = new SPSetttingsProvider())
                    {
                        bool error = prov.SaveSPSetting(webPartToEdit);
                        if (!error && prov.exception != null)
                        {
                            webPartToEdit.Error = prov.exception.ToString();
                        }
                    }

                    //SPSite site = SPContext.Current.Site;
                    //ThreadPool.QueueUserWorkItem(new WaitCallback(saveSPSettings), new ContextWrapper { _webPartToEdit = webPartToEdit, _webID = site.RootWeb.ID, _siteID = site.ID});
                }
            }
            return(true);
        }
Exemplo n.º 2
0
 void btnSyncronise_Click(object sender, EventArgs e)
 {
     TitleWebpart.TitleWebpart webPartToEditt = (TitleWebpart.TitleWebpart) this.WebPartToEdit;
     //if (drpSyncWithStore.SelectedValue.Equals("true"))
     //{
     using (SPSetttingsProvider provider = new SPSetttingsProvider())
     {
         bool error = provider.LoadSPSetting(webPartToEditt);
         if (!error && provider.exception != null)
         {
             webPartToEditt.Error = provider.exception.ToString();
         }
     }
     this.RenderControls();
     this.SyncChanges();
     //}
 }
Exemplo n.º 3
0
        public void saveSPSettings(object input)
        {
            TitleWebpart.TitleWebpart webPartToEdit = ((ContextWrapper)input)._webPartToEdit;
            Guid siteID = ((ContextWrapper)input)._siteID;
            Guid webID  = ((ContextWrapper)input)._webID;

            using (SPSite site = new SPSite(siteID))
            {
                using (SPWeb web = site.OpenWeb(webID))
                {
                    using (SPSetttingsProvider prov = new SPSetttingsProvider(site.RootWeb))
                    {
                        bool error = prov.SaveSPSetting(webPartToEdit);
                        if (!error && prov.exception != null)
                        {
                            webPartToEdit.Error = prov.exception.ToString();
                        }
                    }
                }
            }
        }