コード例 #1
0
        /// <summary>
        /// Load zero or more url content xml elements into alist of url models.
        /// </summary>
        /// <param name="xmlData">
        /// the xElement containing the url references.
        /// </param>
        private OCURLModelCollection GetURLCollection(XElement xmlData)
        {
            OCURLModelCollection t = new OCURLModelCollection();

            // Get colour
            Application.Current.Resources.TryGetValue("CardBackGroundUtility", out var varCardColour);
            Color cardColour = (Color)varCardColour;

            // Run query
            var theERElement =
                from orElementEl
                in xmlData.Elements(ns + "url")
                select orElementEl;

            if (theERElement.Any())
            {
                HLinkHomeImageModel newHomeLink = new HLinkHomeImageModel
                {
                    HomeImageType = CommonConstants.HomeImageTypeSymbol,
                    HomeSymbol    = CommonConstants.IconBookMark // TODO  Windows.UI.Xaml.Controls.Symbol.World,
                };

                // load event object references
                foreach (XElement theLoadORElement in theERElement)
                {
                    URLModel tt = new URLModel
                    {
                        Handle = "URL Collection",

                        HomeImageHLink = newHomeLink,

                        Priv = SetPrivateObject(GetAttribute(theLoadORElement.Attribute("priv"))),

                        GType = GetAttribute(theLoadORElement.Attribute("type")),

                        GHRef = GetUri(GetAttribute(theLoadORElement.Attribute("href"))),

                        GDescription = GetAttribute(theLoadORElement.Attribute("description")),
                    };

                    // set the Home image or symbol
                    tt.HomeImageHLink.HomeImageType    = CommonConstants.HomeImageTypeSymbol;
                    tt.HomeImageHLink.HomeSymbol       = IconFont.Link;
                    tt.HomeImageHLink.HomeSymbolColour = cardColour;

                    t.Add(tt);
                }
            }

            // Return sorted by the default text
            t.Sort(T => T.DeRef.GetDefaultText);

            return(t);
        }
コード例 #2
0
        /// <summary>
        /// Load zero or more url content xml elements into alist of url models.
        /// </summary>
        /// <param name="xmlData">
        /// the xElement containing the url references.
        /// </param>
        private OCURLModelCollection GetURLCollection(XElement xmlData)
        {
            OCURLModelCollection t = new OCURLModelCollection();

            // Run query
            var theERElement =
                from orElementEl
                in xmlData.Elements(ns + "url")
                select orElementEl;

            if (theERElement.Any())
            {
                HLinkHomeImageModel newHomeLink = new HLinkHomeImageModel
                {
                    HomeImageType = CommonEnums.HomeImageType.Symbol,
                    HomeSymbol    = CommonConstants.IconBookMark // TODO  Windows.UI.Xaml.Controls.Symbol.World,
                };

                // load event object references
                foreach (XElement theLoadORElement in theERElement)
                {
                    URLModel tt = new URLModel
                    {
                        Handle = "URL Collection",

                        HomeImageHLink = newHomeLink,

                        Priv = SetPrivateObject(GetAttribute(theLoadORElement.Attribute("priv"))),

                        GType = GetAttribute(theLoadORElement.Attribute("type")),

                        GHRef = GetUri(GetAttribute(theLoadORElement.Attribute("href"))),

                        GDescription = GetAttribute(theLoadORElement.Attribute("description")),
                    };

                    t.Add(tt);
                }
            }

            // Return sorted by the default text
            t.Sort(T => T.DeRef.GetDefaultText);

            return(t);
        }