示例#1
0
        public void Dispatch(IDictionary values, Control parent, string collectionName)
        {
            string parentID = string.Empty;
            string page     = string.Empty;

            if (parent != null)
            {
                parentID = parent.UniqueID;
                page     = parent.Page.ToString();
            }

            foreach (DictionaryEntry entry in values)
            {
                string id = (string)entry.Key;

                IControlItem item = Find(id);
                if (item != null)
                {
                    ResourceDispatcher.DispatchGeneric(item, (IDictionary)entry.Value);
                }
                else //  Invalid collection element
                {
                    s_log.Debug(
                        "'" + parentID + "' on page '" + page + "' does not contain an item with an ID of '" + id + "' inside the collection '" + collectionName
                        + "'.");
                }
            }
        }
        protected override void OnPreRender(EventArgs e)
        {
            //  A call to the ResourceDispatcher to get have the automatic resources dispatched
            ResourceDispatcher.Dispatch(this, ResourceManagerUtility.GetResourceManager(this));

            base.OnPreRender(e);

            HtmlHeadAppender.Current.RegisterPageStylesheetLink();

            var key = GetType().FullName + "_Global";

            if (!HtmlHeadAppender.Current.IsRegistered(key))
            {
                HtmlHeadAppender.Current.RegisterStylesheetLink(key, "Html/global.css");
            }


            LiteralControl stack = new LiteralControl();

            StringBuilder sb = new StringBuilder();

            sb.Append("<br /><div>");
            sb.Append("<b>Stack:</b><br />");
            for (WxeStep step = CurrentPageStep; step != null; step = step.ParentStep)
            {
                sb.AppendFormat("{0}<br />", step.ToString());
            }
            sb.Append("</div>");
            stack.Text = sb.ToString();

            WxeControls.Add(stack);
        }
示例#3
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            HtmlHeadAppender.Current.RegisterPageStylesheetLink();

            //  A call to the ResourceDispatcher to get have the automatic resources dispatched
            ResourceDispatcher.Dispatch(this, ResourceManagerUtility.GetResourceManager(this));
        }
示例#4
0
        protected override void OnPreRender(EventArgs e)
        {
            ResourceDispatcher.Dispatch(this, ResourceManagerUtility.GetResourceManager(this));

            if (!IsPostBack && InitialFocusControl != null)
            {
                SetFocus(InitialFocusControl);
            }

            base.OnPreRender(e);
        }
示例#5
0
        protected override void OnPreRender(EventArgs e)
        {
            if (!CurrentFunction.TenantHandle.Equals(CurrentTenantHandle))
            {
                CurrentTenantHandle = CurrentFunction.TenantHandle;
                _hasTenantChanged   = true;
            }

            ResourceDispatcher.Dispatch(this, ResourceManagerUtility.GetResourceManager(this));

            base.OnPreRender(e);
        }
        protected override void OnPreRender(EventArgs e)
        {
            //  A call to the ResourceDispatcher to get have the automatic resources dispatched
            ResourceDispatcher.Dispatch(this, ResourceManagerUtility.GetResourceManager(this));

            HtmlHeadAppender.Current.RegisterPageStylesheetLink();

            var key = GetType().FullName + "_Global";

            if (!HtmlHeadAppender.Current.IsRegistered(key))
            {
                string href = ResolveClientUrl("~/Html/global.css");
                HtmlHeadAppender.Current.RegisterStylesheetLink(key, href);
            }

            base.OnPreRender(e);
        }
示例#7
0
        protected override void OnPreRender(EventArgs e)
        {
            var    themedResourceUrlResolver = SafeServiceLocator.Current.GetInstance <IThemedResourceUrlResolverFactory> ().CreateResourceUrlResolver();
            string url = themedResourceUrlResolver.GetResourceUrl(this, ResourceType.Html, "Style.css");

            Remotion.Web.UI.HtmlHeadAppender.Current.RegisterStylesheetLink(GetType() + "remotionstyle", url);

            url = ResolveClientUrl("~/Html/style.css");
            Remotion.Web.UI.HtmlHeadAppender.Current.RegisterStylesheetLink(GetType() + "projectstyle", url);

            // globalization
            IResourceManager rm = ResourceManagerUtility.GetResourceManager(this);

            if (rm != null)
            {
                ResourceDispatcher.Dispatch(this, rm);
            }

            base.OnPreRender(e);
        }
        /// <summary> Dispatches the resources passed in <paramref name="values"/> to the control's properties. </summary>
        /// <param name="values"> An <c>IDictonary</c>: &lt;string key, string value&gt;. </param>
        protected virtual void Dispatch(IDictionary values)
        {
            HybridDictionary tabValues      = new HybridDictionary();
            HybridDictionary propertyValues = new HybridDictionary();

            //  Parse the values

            foreach (DictionaryEntry entry in values)
            {
                string   key      = (string)entry.Key;
                string[] keyParts = key.Split(new[] { ':' }, 3);

                //  Is a property/value entry?
                if (keyParts.Length == 1)
                {
                    string property = keyParts[0];
                    propertyValues.Add(property, entry.Value);
                }
                //  Is collection entry?
                else if (keyParts.Length == 3)
                {
                    //  Compound key: "collectionID:elementID:property"
                    string collectionID = keyParts[0];
                    string elementID    = keyParts[1];
                    string property     = keyParts[2];

                    IDictionary currentCollection = null;

                    //  Switch to the right collection
                    switch (collectionID)
                    {
                    case c_resourceKeyTabs:
                    {
                        currentCollection = tabValues;
                        break;
                    }

                    default:
                    {
                        //  Invalid collection property
                        s_log.Warn(
                            "WebTabStrip '" + ID + "' in naming container '" + NamingContainer.GetType().FullName + "' on page '" + Page
                            + "' does not contain a collection property named '" + collectionID + "'.");
                        break;
                    }
                    }

                    //  Add the property/value pair to the collection
                    if (currentCollection != null)
                    {
                        //  Get the dictonary for the current element
                        IDictionary elementValues = (IDictionary)currentCollection[elementID];

                        //  If no dictonary exists, create it and insert it into the elements hashtable.
                        if (elementValues == null)
                        {
                            elementValues = new HybridDictionary();
                            currentCollection[elementID] = elementValues;
                        }

                        //  Insert the argument and resource's value into the dictonary for the specified element.
                        elementValues.Add(property, entry.Value);
                    }
                }
                else
                {
                    //  Not supported format or invalid property
                    s_log.Warn(
                        "WebTabStrip '" + ID + "' in naming container '" + NamingContainer.GetType().FullName + "' on page '" + Page
                        + "' received a resource with an invalid or unknown key '" + key
                        + "'. Required format: 'property' or 'collectionID:elementID:property'.");
                }
            }

            //  Dispatch simple properties
            ResourceDispatcher.DispatchGeneric(this, propertyValues);

            //  Dispatch to collections
            Tabs.Dispatch(tabValues, this, "Tabs");
        }