Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     skinpicker.Items.Add("Choose...");
     foreach (Skin s in Skinning.GetAllSkins())
     {
         skinpicker.Items.Add(new ListItem(s.Name, s.Alias));
     }
 }
Exemplo n.º 2
0
        protected void SelectStarterKitDesign(object sender, EventArgs e)
        {
            if (((Button)sender).CommandName == "apply")
            {
                var s = Skin.CreateFromName(((Button)sender).CommandArgument);
                Skinning.ActivateAsCurrentSkin(s);

                Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())));
            }
            else if (((Button)sender).CommandName == "remove")
            {
                var n = NodeFactory.Node.GetCurrent();

                var t = new Template(n.template);
                Skinning.RollbackSkin(t.Id);

                Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())));
            }
            else
            {
                var kitGuid = new Guid(((Button)sender).CommandArgument);

                if (_repo.HasConnection())
                {
                    var p = new cms.businesslogic.packager.Installer();

                    var tempFile = p.Import(_repo.fetch(kitGuid.ToString()));
                    p.LoadConfig(tempFile);
                    var pId = p.CreateManifest(tempFile, kitGuid.ToString(), RepoGuid);

                    p.InstallFiles(pId, tempFile);
                    p.InstallBusinessLogic(pId, tempFile);
                    p.InstallCleanUp(pId, tempFile);

                    //NOTE: This seems excessive to have to re-load all content from the database here!?
                    library.RefreshContent();

                    if (Skinning.GetAllSkins().Count > 0)
                    {
                        Skinning.ActivateAsCurrentSkin(Skinning.GetAllSkins()[0]);
                    }


                    Page.Response.Redirect(library.NiceUrl(int.Parse(UmbracoContext.Current.PageId.ToString())));
                }
            }
        }