Exemple #1
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load"></see> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"></see> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            _sheet = Services.FileService.GetStylesheetByName(Request.QueryString["id"]);
            if (_sheet == null)
            {
                throw new InvalidOperationException("No stylesheet found with name: " + Request.QueryString["id"]);
            }

            var propName = IsPostBack ? OriginalName.Value : Request.QueryString["prop"];

            _stylesheetproperty = _sheet.Properties.FirstOrDefault(x => x.Name.InvariantEquals(propName));
            if (_stylesheetproperty == null)
            {
                throw new InvalidOperationException("No stylesheet property found with name: " + Request.QueryString["prop"]);
            }

            Panel1.Text = ui.Text("stylesheet", "editstylesheetproperty", UmbracoUser);

            var bt = Panel1.Menu.NewButton();

            bt.Click     += SaveClick;
            bt.Text       = ui.Text("save");
            bt.ToolTip    = ui.Text("save");
            bt.ButtonType = uicontrols.MenuButtonType.Primary;
            bt.ID         = "save";
        }
        public void RefreshFromFile()
        {
            var name = StylesheetItem.Name;

            StylesheetItem = ApplicationContext.Current.Services.FileService.GetStylesheetByName(name);
            if (StylesheetItem == null)
            {
                throw new ArgumentException(string.Format("No stylesheet exists with name '{0}'", name));
            }

            StylesheetProp = StylesheetItem.Properties.FirstOrDefault(x => x.Alias == StylesheetProp.Alias);
        }
 internal StylesheetProperty(Umbraco.Core.Models.Stylesheet sheet, Umbraco.Core.Models.StylesheetProperty prop)
     : base(int.MaxValue, true)
 {
     StylesheetItem = sheet;
     StylesheetProp = prop;
 }