SetAttribute() 공개 메소드

public SetAttribute ( [ attributeName, [ attributeValue ) : void
attributeName [
attributeValue [
리턴 void
            public override XmlElement HtmlToTextNode(XmlDocument ownerDoc, string html)
            {
                XmlElement el = ownerDoc.CreateElementNS(NamespaceUri, "atom:content");

                el.SetAttribute("type", "text/html");
                el.SetAttribute("mode", "escaped");
                el.InnerText = html;
                return(el);
            }
            public override XmlElement PlaintextToTextNode(XmlDocument ownerDoc, string text)
            {
                XmlElement el = ownerDoc.CreateElementNS(NamespaceUri, "atom:content");

                el.SetAttribute("type", "text/plain");
                el.SetAttribute("mode", "escaped");
                el.InnerText = text;
                return(el);
            }
예제 #3
0
        public void SetImageAttribute(XmlElement imageElement)
        {
            if (imageElement == null) return;

            imageElement.SetAttribute("src", GetImageSource());
            if (!string.IsNullOrWhiteSpace(Alt))
            {
                imageElement.SetAttribute("alt", Alt);
            }
        }
예제 #4
0
        public static void Toast(string msg)
        {
            //1. create element
            ToastTemplateType toastTemplate = ToastTemplateType.ToastImageAndText01;
            XmlDocument       toastXml      = ToastNotificationManager.GetTemplateContent(toastTemplate);
            //2.设置消息文本
            XmlNodeList toastTextElements = toastXml.GetElementsByTagName("text");

            toastTextElements[0].AppendChild(toastXml.CreateTextNode(msg));
            //3. 图标
            Windows.Data.Xml.Dom.XmlNodeList toastImageAttributes = toastXml.GetElementsByTagName("image");
            ((XmlElement)toastImageAttributes[0]).SetAttribute("src", $"ms-appx:///Assets/StoreLogo.png");
            ((XmlElement)toastImageAttributes[0]).SetAttribute("alt", "logo");
            // 4. duration
            IXmlNode toastNode = toastXml.SelectSingleNode("/toast");

            ((XmlElement)toastNode).SetAttribute("duration", "short");

            // 5. audio
            XmlElement audio = toastXml.CreateElement("audio");

            audio.SetAttribute("src", $"ms-winsoundevent:Notification.SMS");
            toastNode.AppendChild(audio);

            ToastNotification toast = new ToastNotification(toastXml);

            ToastNotificationManager.CreateToastNotifier().Show(toast);
        }
            public override XmlElement CreateCategoryElement(XmlDocument ownerDoc, string category, string categoryScheme, string categoryLabel)
            {
                if (categoryScheme == null)
                {
                    throw new ArgumentException("Null category scheme not supported");
                }

                XmlElement element = ownerDoc.CreateElementNS(NamespaceUri, "atom:category");

                element.SetAttribute("term", category);
                if (categoryScheme.Length > 0)
                {
                    element.SetAttribute("scheme", categoryScheme);
                }
                element.SetAttribute("label", categoryLabel);
                return(element);
            }
예제 #6
0
 private void ShowToastNotification()
 {
     for (int i = 0; i < ViewModel.AllItems.Count; i++)
     {
         if (ViewModel.AllItems[i].date.Day == DateTime.Now.Day)
         {
             ToastTemplateType toastTemplate                    = ToastTemplateType.ToastImageAndText01;
             Windows.Data.Xml.Dom.XmlDocument toastXml          = ToastNotificationManager.GetTemplateContent(toastTemplate);
             Windows.Data.Xml.Dom.XmlNodeList toastTextElements = toastXml.GetElementsByTagName("text");
             toastTextElements[0].AppendChild(toastXml.CreateTextNode(ViewModel.AllItems[i].title + "\n" + ViewModel.AllItems[i].description));
             Windows.Data.Xml.Dom.XmlNodeList toastImageAttributes = toastXml.GetElementsByTagName("image");
             IXmlNode toastNode = toastXml.SelectSingleNode("/toast");
             ((Windows.Data.Xml.Dom.XmlElement)toastImageAttributes[0]).SetAttribute("src", "Assets//2015071504.jpg");
             Windows.Data.Xml.Dom.XmlElement audio = toastXml.CreateElement("audio");
             ((Windows.Data.Xml.Dom.XmlElement)toastNode).SetAttribute("duration", "long");
             audio.SetAttribute("silent", "true");
             ToastNotification toast = new ToastNotification(toastXml);
             ToastNotificationManager.CreateToastNotifier().Show(toast);
         }
     }
 }
예제 #7
0
        private static void SetPropertyValue(XmlElement xamlElement, string property, string stringValue)
        {
            try
            {

                    xamlElement.SetAttribute(property, stringValue);
            }
            catch(Exception)
            {
            }
        }
예제 #8
0
        // Create syntactically optimized four-value Thickness
        private static void ComposeThicknessProperty(XmlElement xamlElement, string propertyName, string left, string right, string top, string bottom)
        {
            // Xaml syntax:
            // We have a reasonable interpreation for one value (all four edges), two values (horizontal, vertical),
            // and four values (left, top, right, bottom).
            //  switch (i) {
            //    case 1: return new Thickness(lengths[0]);
            //    case 2: return new Thickness(lengths[0], lengths[1], lengths[0], lengths[1]);
            //    case 4: return new Thickness(lengths[0], lengths[1], lengths[2], lengths[3]);
            //  }
            string thickness;

            // We do not accept negative margins
            if (left[0] == '0' || left[0] == '-') left = "0";
            if (right[0] == '0' || right[0] == '-') right = "0";
            if (top[0] == '0' || top[0] == '-') top = "0";
            if (bottom[0] == '0' || bottom[0] == '-') bottom = "0";

            if (left == right && top == bottom)
            {
                if (left == top)
                {
                    thickness = left;
                }
                else
                {
                    thickness = left + "," + top;
                }
            }
            else
            {
                thickness = left + "," + top + "," + right + "," + bottom;
            }

            //  Need safer processing for a thickness value
            xamlElement.SetAttribute(propertyName, thickness);
        }
예제 #9
0
        /// <summary>
        /// Applies properties to xamlTableCellElement based on the html td element it is converted from.
        /// </summary>
        /// <param name="htmlChildNode">
        /// Html td/th element to be converted to xaml
        /// </param>
        /// <param name="xamlTableCellElement">
        /// XmlElement representing Xaml element for which properties are to be processed
        /// </param>
        /// <remarks>
        /// TODO: Use the processed properties for htmlChildNode instead of using the node itself 
        /// </remarks>
        private static void ApplyPropertiesToTableCellElement(XmlElement htmlChildNode, XmlElement xamlTableCellElement)
        {
            // Parameter validation
            Debug.Assert(htmlChildNode.LocalName.ToLower() == "td" || htmlChildNode.LocalName.ToLower() == "th");
            Debug.Assert(xamlTableCellElement.LocalName.ToString() == Xaml_TableCell);

            // set default border thickness for xamlTableCellElement to enable gridlines
            xamlTableCellElement.SetAttribute(Xaml_TableCell_BorderThickness, "1,1,1,1");
            xamlTableCellElement.SetAttribute(Xaml_TableCell_BorderBrush, Xaml_Brushes_Black);
            string rowSpanString = GetAttribute((XmlElement)htmlChildNode, "rowspan");
            if (rowSpanString != null)
            {
                xamlTableCellElement.SetAttribute(Xaml_TableCell_RowSpan, rowSpanString);
            }
        }
예제 #10
0
        // .............................................................
        //
        // Attributes and Properties
        //
        // .............................................................
        /// <summary>
        /// Analyzes local properties of Html element, converts them into Xaml equivalents, and applies them to xamlElement
        /// </summary>
        /// <param name="xamlElement">
        /// XmlElement representing Xaml element to which properties are to be applied
        /// </param>
        /// <param name="localProperties">
        /// Hashtable representing local properties of Html element that is converted into xamlElement
        /// </param>
        private static void ApplyLocalProperties(XmlElement xamlElement, IDictionary localProperties, bool isBlock)
        {
            bool marginSet = false;
            string marginTop = "0";
            string marginBottom = "0";
            string marginLeft = "0";
            string marginRight = "0";

            bool paddingSet = false;
            string paddingTop = "0";
            string paddingBottom = "0";
            string paddingLeft = "0";
            string paddingRight = "0";

            string borderColor = null;

            bool borderThicknessSet = false;
            string borderThicknessTop = "0";
            string borderThicknessBottom = "0";
            string borderThicknessLeft = "0";
            string borderThicknessRight = "0";

            IDictionaryEnumerator propertyEnumerator = localProperties.GetEnumerator();
            while (propertyEnumerator.MoveNext())
            {
                switch ((string)propertyEnumerator.Key)
                {
                    case "font-family":
                        //  Convert from font-family value list into xaml FontFamily value
                        xamlElement.SetAttribute(Xaml_FontFamily, (string)propertyEnumerator.Value);
                        break;
                    case "font-style":
                        xamlElement.SetAttribute(Xaml_FontStyle, (string)propertyEnumerator.Value);
                        break;
                    case "font-variant":
                        //  Convert from font-variant into xaml property
                        break;
                    case "font-weight":
                        xamlElement.SetAttribute(Xaml_FontWeight, (string)propertyEnumerator.Value);
                        break;
                    case "font-size":
                        //  Convert from css size into FontSize
                        xamlElement.SetAttribute(Xaml_FontSize, (string)propertyEnumerator.Value);
                        break;
                    case "color":
                        SetPropertyValue(xamlElement, "Foreground", (string)propertyEnumerator.Value);
                        break;
                    case "background-color":
                        //SetPropertyValue(xamlElement, TextElement.BackgroundProperty, (string)propertyEnumerator.Value);
                        break;
                    case "text-decoration-underline":
                        if (!isBlock)
                        {
                            if ((string)propertyEnumerator.Value == "true")
                            {
                                xamlElement.SetAttribute(Xaml_TextDecorations, Xaml_TextDecorations_Underline);
                            }
                        }
                        break;
                    case "text-decoration-none":
                    case "text-decoration-overline":
                    case "text-decoration-line-through":
                    case "text-decoration-blink":
                        //  Convert from all other text-decorations values
                        if (!isBlock)
                        {
                        }
                        break;
                    case "text-transform":
                        //  Convert from text-transform into xaml property
                        break;

                    case "text-indent":
                        if (isBlock)
                        {
                            xamlElement.SetAttribute(Xaml_TextIndent, (string)propertyEnumerator.Value);
                        }
                        break;

                    case "text-align":
                        if (isBlock)
                        {
                            xamlElement.SetAttribute(Xaml_TextAlignment, (string)propertyEnumerator.Value);
                        }
                        break;

                    case "width":
                    case "height":
                        //  Decide what to do with width and height propeties
                        break;

                    case "margin-top":
                        marginSet = true;
                        marginTop = (string)propertyEnumerator.Value;
                        break;
                    case "margin-right":
                        marginSet = true;
                        marginRight = (string)propertyEnumerator.Value;
                        break;
                    case "margin-bottom":
                        marginSet = true;
                        marginBottom = (string)propertyEnumerator.Value;
                        break;
                    case "margin-left":
                        marginSet = true;
                        marginLeft = (string)propertyEnumerator.Value;
                        break;

                    case "padding-top":
                        paddingSet = true;
                        paddingTop = (string)propertyEnumerator.Value;
                        break;
                    case "padding-right":
                        paddingSet = true;
                        paddingRight = (string)propertyEnumerator.Value;
                        break;
                    case "padding-bottom":
                        paddingSet = true;
                        paddingBottom = (string)propertyEnumerator.Value;
                        break;
                    case "padding-left":
                        paddingSet = true;
                        paddingLeft = (string)propertyEnumerator.Value;
                        break;

                    // NOTE: css names for elementary border styles have side indications in the middle (top/bottom/left/right)
                    // In our internal notation we intentionally put them at the end - to unify processing in ParseCssRectangleProperty method
                    case "border-color-top":
                        borderColor = (string)propertyEnumerator.Value;
                        break;
                    case "border-color-right":
                        borderColor = (string)propertyEnumerator.Value;
                        break;
                    case "border-color-bottom":
                        borderColor = (string)propertyEnumerator.Value;
                        break;
                    case "border-color-left":
                        borderColor = (string)propertyEnumerator.Value;
                        break;
                    case "border-style-top":
                    case "border-style-right":
                    case "border-style-bottom":
                    case "border-style-left":
                        //  Implement conversion from border style
                        break;
                    case "border-width-top":
                        borderThicknessSet = true;
                        borderThicknessTop = (string)propertyEnumerator.Value;
                        break;
                    case "border-width-right":
                        borderThicknessSet = true;
                        borderThicknessRight = (string)propertyEnumerator.Value;
                        break;
                    case "border-width-bottom":
                        borderThicknessSet = true;
                        borderThicknessBottom = (string)propertyEnumerator.Value;
                        break;
                    case "border-width-left":
                        borderThicknessSet = true;
                        borderThicknessLeft = (string)propertyEnumerator.Value;
                        break;

                    case "list-style-type":
                        if (xamlElement.LocalName.ToString() == Xaml_List)
                        {
                            string markerStyle;
                            switch (((string)propertyEnumerator.Value).ToLower())
                            {
                                case "disc":
                                    markerStyle = HtmlToXamlConverter.Xaml_List_MarkerStyle_Disc;
                                    break;
                                case "circle":
                                    markerStyle = HtmlToXamlConverter.Xaml_List_MarkerStyle_Circle;
                                    break;
                                case "none":
                                    markerStyle = HtmlToXamlConverter.Xaml_List_MarkerStyle_None;
                                    break;
                                case "square":
                                    markerStyle = HtmlToXamlConverter.Xaml_List_MarkerStyle_Square;
                                    break;
                                case "box":
                                    markerStyle = HtmlToXamlConverter.Xaml_List_MarkerStyle_Box;
                                    break;
                                case "lower-latin":
                                    markerStyle = HtmlToXamlConverter.Xaml_List_MarkerStyle_LowerLatin;
                                    break;
                                case "upper-latin":
                                    markerStyle = HtmlToXamlConverter.Xaml_List_MarkerStyle_UpperLatin;
                                    break;
                                case "lower-roman":
                                    markerStyle = HtmlToXamlConverter.Xaml_List_MarkerStyle_LowerRoman;
                                    break;
                                case "upper-roman":
                                    markerStyle = HtmlToXamlConverter.Xaml_List_MarkerStyle_UpperRoman;
                                    break;
                                case "decimal":
                                    markerStyle = HtmlToXamlConverter.Xaml_List_MarkerStyle_Decimal;
                                    break;
                                default:
                                    markerStyle = HtmlToXamlConverter.Xaml_List_MarkerStyle_Disc;
                                    break;
                            }
                            xamlElement.SetAttribute(HtmlToXamlConverter.Xaml_List_MarkerStyle, markerStyle);
                        }
                        break;

                    case "float":
                    case "clear":
                        if (isBlock)
                        {
                            //  Convert float and clear properties
                        }
                        break;

                    case "display":
                        break;
                }
            }

            if (isBlock)
            {
                if (marginSet)
                {
                    ComposeThicknessProperty(xamlElement, Xaml_Margin, marginLeft, marginRight, marginTop, marginBottom);
                }

                if (paddingSet)
                {
                    ComposeThicknessProperty(xamlElement, Xaml_Padding, paddingLeft, paddingRight, paddingTop, paddingBottom);
                }

                if (borderColor != null)
                {
                    //  We currently ignore possible difference in brush colors on different border sides. Use the last colored side mentioned
                    xamlElement.SetAttribute(Xaml_BorderBrush, borderColor);
                }

                if (borderThicknessSet)
                {
                    ComposeThicknessProperty(xamlElement, Xaml_BorderThickness, borderThicknessLeft, borderThicknessRight, borderThicknessTop, borderThicknessBottom);
                }
            }
        }
예제 #11
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e != null && e.Parameter != null)
            {
                CurrentCode = e.Parameter as Code;
                if (CurrentCode != null)
                {
                    Report = new XmlDocument();
                    CodeElement = Report.CreateElement("Code");
                    CodeElement.SetAttribute("CPRStartTime", CurrentCode.CPRStartTime.ToString());
                    CodeElement.SetAttribute("CPREndTime", CurrentCode.CPREndTime.ToString());
                    DefibElement = Report.CreateElement("Defibrillation");
                    PatientInfoElement = Report.CreateElement("PatientInformation");
                    CodeElement.AppendChild(DefibElement);
                    CodeElement.AppendChild(PatientInfoElement);
                    Report.AppendChild(CodeElement);
                }
            }

            if (CurrentDefibrillation == null)
            {
                CurrentDefibrillation = new Defibrillation();
            }
            if (CurrentPatientInfo == null)
            {
                CurrentPatientInfo = new PatientInformation();
            }
            base.OnNavigatedTo(e);
        }
예제 #12
0
 public static void AddAttribute(this Windows.Data.Xml.Dom.XmlElement node, string name, string value)
 {
     node.SetAttribute(name, value);
 }
예제 #13
0
        private async void CyclicToggleSwitch_Toggled(object sender, RoutedEventArgs e)
        {
            if (Cyclic.IsOn)
            {
                cyclicTile = new SecondaryTile(
                            "Cyclic",
                            "Cyclic",
                            "Arguments",
                            new Uri("ms-appx:///Assets/blue.150x150.png", UriKind.Absolute),
                            TileSize.Square150x150);
                await cyclicTile.RequestCreateAsync();
                TileUpdateManager.CreateTileUpdaterForSecondaryTile(cyclicTile.TileId).EnableNotificationQueueForSquare150x150(true);

                tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare150x150Image);
                tileImage = tileXml.GetElementsByTagName("image")[0] as XmlElement;

                tileImage.SetAttribute("src", "ms-appx:///Assets/blue.150x150.png");
                notif = new TileNotification(tileXml);
                TileUpdateManager.CreateTileUpdaterForSecondaryTile(cyclicTile.TileId).Update(notif);
                tileImage.SetAttribute("src", "ms-appx:///Assets/red.150x150.png");
                notif = new TileNotification(tileXml);
                TileUpdateManager.CreateTileUpdaterForSecondaryTile(cyclicTile.TileId).Update(notif);
                tileImage.SetAttribute("src", "ms-appx:///Assets/green.150x150.png");
                notif = new TileNotification(tileXml);
                TileUpdateManager.CreateTileUpdaterForSecondaryTile(cyclicTile.TileId).Update(notif);
                tileImage.SetAttribute("src", "ms-appx:///Assets/yellow.150x150.png");
                notif = new TileNotification(tileXml);
                TileUpdateManager.CreateTileUpdaterForSecondaryTile(cyclicTile.TileId).Update(notif);
                tileImage.SetAttribute("src", "ms-appx:///Assets/orange.150x150.png");
                notif = new TileNotification(tileXml);
                TileUpdateManager.CreateTileUpdaterForSecondaryTile(cyclicTile.TileId).Update(notif);

                tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150Image);
                tileImage = tileXml.GetElementsByTagName("image")[0] as XmlElement;

                tileImage.SetAttribute("src", "ms-appx:///Assets/blue.310x150.png");
                notif = new TileNotification(tileXml);
                TileUpdateManager.CreateTileUpdaterForApplication().Update(notif);
                tileImage.SetAttribute("src", "ms-appx:///Assets/red.310x150.png");
                notif = new TileNotification(tileXml);
                TileUpdateManager.CreateTileUpdaterForApplication().Update(notif);
                tileImage.SetAttribute("src", "ms-appx:///Assets/green.310x150.png");
                notif = new TileNotification(tileXml);
                TileUpdateManager.CreateTileUpdaterForApplication().Update(notif);
                tileImage.SetAttribute("src", "ms-appx:///Assets/yellow.310x150.png");
                notif = new TileNotification(tileXml);
                TileUpdateManager.CreateTileUpdaterForApplication().Update(notif);
                tileImage.SetAttribute("src", "ms-appx:///Assets/orange.310x150.png");
                notif = new TileNotification(tileXml);
                TileUpdateManager.CreateTileUpdaterForApplication().Update(notif);
            }
            else
            {
                TileUpdateManager.CreateTileUpdaterForApplication().Clear();
                await cyclicTile.RequestDeleteAsync();
            }
        }
  private void RecordResuscitation(IUICommand command)
  {
      var resuscitation = new Resuscitation
      {
          TimeRecorded = confirmationPage.TimeRecorded,
          TypeOfResuscitation = (ResuscitationType)Enum.Parse(typeof(ResuscitationType), confirmationPage.ResusicationType, true),
          Placed = "RightAC",
          Amount = 18
      };
      CurrentDefibrillation.Resuscitations.Add(resuscitation);
      childElement = Report.CreateElement("Resuscitation");
      childElement.SetAttribute("TimeRecorded", resuscitation.TimeRecorded);
      childElement.SetAttribute("TypeOfResuscitation", resuscitation.TypeOfResuscitation.ToString());
      childElement.SetAttribute("Placed", resuscitation.Placed);
      childElement.SetAttribute("Amount", resuscitation.Amount.ToString());
 }
예제 #15
0
        private async void IconicTile_Toggled(object sender, RoutedEventArgs e)
        {
            if (IconicTile.IsOn)
            {
                iconicTile = new SecondaryTile(
                            "IconicTile",
                            "Iconic",
                            "Arguments",
                            new Uri("ms-appx:///Assets/yellow.150x150.png", UriKind.Absolute),
                            TileSize.Square150x150);
                await iconicTile.RequestCreateAsync();

                tileXml = BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeNumber);
                tileImage = tileXml.SelectSingleNode("/badge") as XmlElement;
                tileImage.SetAttribute("value", "31");

                BadgeNotification badgeNotification = new BadgeNotification(tileXml);
                BadgeUpdateManager.CreateBadgeUpdaterForSecondaryTile(iconicTile.TileId).Update(badgeNotification);

                tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare150x150IconWithBadge);

                tileImage = tileXml.GetElementsByTagName("image")[0] as XmlElement;
                tileImage.SetAttribute("src", "ms-appx:///Assets/icon.130x202.png");

                notif = new TileNotification(tileXml);
                TileUpdateManager.CreateTileUpdaterForSecondaryTile(iconicTile.TileId).Update(notif);

                tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150IconWithBadgeAndText);

                tileImage = tileXml.GetElementsByTagName("image")[0] as XmlElement;
                tileImage.SetAttribute("src", "ms-appx:///Assets/icon.70x110.png");

                tileList = tileXml.GetElementsByTagName("text");
                (tileList[0] as XmlElement).InnerText = "Header text";
                (tileList[1] as XmlElement).InnerText = "First line of text";
                (tileList[2] as XmlElement).InnerText = "Second line of text";

                notif = new TileNotification(tileXml);
                TileUpdateManager.CreateTileUpdaterForApplication().Update(notif);
            }
            else
            {
                TileUpdateManager.CreateTileUpdaterForApplication().Clear();
                await iconicTile.RequestDeleteAsync();
            }
        }
예제 #16
0
        private async void BadgeToggleSwitch_Toggled(object sender, RoutedEventArgs e)
        {
            if (Badge.IsOn)
            {
                badgeTile = new SecondaryTile(
                            "BadgeTile",
                            "Badge",
                            "Arguments",
                            new Uri("ms-appx:///Assets/green.150x150.png", UriKind.Absolute),
                            TileSize.Square150x150);
                await badgeTile.RequestCreateAsync();

                tileXml = BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeGlyph);
                tileImage = tileXml.SelectSingleNode("/badge") as XmlElement;
                tileImage.SetAttribute("value", "alert");

                BadgeNotification badgeNotification = new BadgeNotification(tileXml);
                BadgeUpdateManager.CreateBadgeUpdaterForSecondaryTile(badgeTile.TileId).Update(badgeNotification);

                tileXml = BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeNumber);
                tileImage = tileXml.SelectSingleNode("/badge") as XmlElement;
                tileImage.SetAttribute("value", "31");
                badgeNotification = new BadgeNotification(tileXml);
                BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(badgeNotification);
            }
            else
            {
                BadgeUpdateManager.CreateBadgeUpdaterForApplication().Clear();
                await badgeTile.RequestDeleteAsync();
            }
        }
예제 #17
0
        private void ParseAttributes(XmlElement xmlElement)
        {
            while (_htmlLexicalAnalyzer.NextTokenType != HtmlTokenType.EOF && //
                _htmlLexicalAnalyzer.NextTokenType != HtmlTokenType.TagEnd && //
                _htmlLexicalAnalyzer.NextTokenType != HtmlTokenType.EmptyTagEnd)
            {
                // read next attribute (name=value)
                if (_htmlLexicalAnalyzer.NextTokenType == HtmlTokenType.Name)
                {
                    string attributeName = _htmlLexicalAnalyzer.NextToken;
                    _htmlLexicalAnalyzer.GetNextEqualSignToken();

                    _htmlLexicalAnalyzer.GetNextAtomToken();

                    string attributeValue = _htmlLexicalAnalyzer.NextToken;
                    xmlElement.SetAttribute(attributeName, attributeValue);
                }
                _htmlLexicalAnalyzer.GetNextTagToken();
            }
        }
예제 #18
0
        private async void ImageAndText_Toggled(object sender, RoutedEventArgs e)
        {
            if (ImageAndText.IsOn)
            {
                imageTile = new SecondaryTile(
                            "ImageAndText",
                            "Image and Text",
                            "Arguments",
                            new Uri("ms-appx:///Assets/blue.150x150.png", UriKind.Absolute),
                            TileSize.Square150x150);
                await imageTile.RequestCreateAsync();

                tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare150x150PeekImageAndText01);

                tileImage = tileXml.GetElementsByTagName("image")[0] as XmlElement;
                tileImage.SetAttribute("src", "ms-appx:///Assets/blue.150x150.png");

                tileList = tileXml.GetElementsByTagName("text");
                (tileList[0] as XmlElement).InnerText = "Header text";
                (tileList[1] as XmlElement).InnerText = "First line of text";
                (tileList[2] as XmlElement).InnerText = "Second line of text";
                (tileList[3] as XmlElement).InnerText = "Third line of text";

                notif = new TileNotification(tileXml);
                TileUpdateManager.CreateTileUpdaterForSecondaryTile(imageTile.TileId).Update(notif);

                tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150PeekImage02);

                tileImage = tileXml.GetElementsByTagName("image")[0] as XmlElement;
                tileImage.SetAttribute("src", "ms-appx:///Assets/blue.310x150.png");

                tileList = tileXml.GetElementsByTagName("text");
                (tileList[0] as XmlElement).InnerText = "Header text";
                (tileList[1] as XmlElement).InnerText = "First line of text";
                (tileList[2] as XmlElement).InnerText = "Second line of text";
                (tileList[3] as XmlElement).InnerText = "Third line of text";
                (tileList[4] as XmlElement).InnerText = "Fourth line of text";

                notif = new TileNotification(tileXml);
                TileUpdateManager.CreateTileUpdaterForApplication().Update(notif);
            }
            else
            {
                TileUpdateManager.CreateTileUpdaterForApplication().Clear();
                await imageTile.RequestDeleteAsync();
            }
        }