• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Dom.XmlDocument类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Windows.Data.Xml.Dom.XmlDocument的典型用法代码示例。如果您正苦于以下问题:C# XmlDocument类的具体用法?C# XmlDocument怎么用?C# XmlDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XmlDocument类属于Windows.Data.Xml.Dom命名空间,在下文中一共展示了XmlDocument类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnSendNotification

        private void OnSendNotification(object sender, RoutedEventArgs e)
        {
            string xml = @"<toast launch=""developer-defined-string"">
                          <visual>
                            <binding template=""ToastGeneric"">
                              <image placement=""appLogoOverride"" src=""Assets/MicrosoftLogo.png"" />
                              <text>DotNet Spain Conference</text>
                              <text>How much do you like my session?</text>
                            </binding>
                          </visual>
                          <actions>
                            <input id=""rating"" type=""selection"" defaultInput=""5"" >
                          <selection id=""1"" content=""1 (Not very much)"" />
                          <selection id=""2"" content=""2"" />
                          <selection id=""3"" content=""3"" />
                          <selection id=""4"" content=""4"" />
                          <selection id=""5"" content=""5 (A lot!)"" />
                            </input>
                            <action activationType=""background"" content=""Vote"" arguments=""vote"" />
                          </actions>
                        </toast>";

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(xml);

            ToastNotification toast = new ToastNotification(doc);
            ToastNotificationManager.CreateToastNotifier().Show(toast);

        }
开发者ID:qmatteoq,项目名称:dotNetSpainConference2016,代码行数:29,代码来源:MainPage.xaml.cs


示例2: UpdateTileAsync

        // Windows Live Tile 
        private async static Task UpdateTileAsync()
        {
            var todayNames = await NamedayRepository.GetTodaysNamesAsStringAsync();
            if (todayNames == null)
                return;
            // Hardcoded XML template for Tile with 2 bindings
            var template =
@"<tile>
 <visual version=""4"">
  <binding template=""TileMedium"">
   <text hint-wrap=""true"">{0}</text>
  </binding>
  <binding template=""TileWide"">
   <text hint-wrap=""true"">{0}</text>
  </binding>
 </visual>
</tile>";
            var content = string.Format(template,todayNames);
            var doc = new Windows.Data.Xml.Dom.XmlDocument();
            doc.LoadXml(content);

            // Create and Update Tile Notification
            TileUpdateManager.CreateTileUpdaterForApplication().
                Update(new TileNotification(doc));
            

        }
开发者ID:yigityesilpinar,项目名称:Polish-Namedays-Windows-Store-Application,代码行数:28,代码来源:MyBackgroundTask.cs


示例3: CompleteTemplate

        public static void CompleteTemplate(XmlDocument xml, string[] text, string[] images = null, string sound = null)
        {
            XmlNodeList slots = xml.SelectNodes("descendant-or-self::image");
            int index = 0;

            if ((images != null) && (slots != null))
            {
                while ((index < images.Length) && (index < slots.Length))
                {
                    ((XmlElement)slots[index]).SetAttribute("src", images[index]);
                    index++;
                }
            }

            if (text != null)
            {
                slots = xml.SelectNodes("descendant-or-self::text");
                index = 0;

                while ((slots != null) && ((index < text.Length) && (index < slots.Length)))
                {
                    slots[index].AppendChild(xml.CreateTextNode(text[index]));
                    index++;
                }
            }

            if (!string.IsNullOrEmpty(sound))
            {
                var audioElement = xml.CreateElement("audio");
                audioElement.SetAttribute("src", sound);
                xml.DocumentElement.AppendChild(audioElement);
            }
        }
开发者ID:chrissimusokwe,项目名称:TrainingContent,代码行数:33,代码来源:TemplateUtility.cs


示例4: NotifyNow

        /// <summary>
        /// Notify immediately using the type of notification
        /// </summary>
        /// <param name="noticeText"></param>
        /// <param name="notificationType"></param>
        public static void NotifyNow(string noticeText, NotificationType notificationType)
        {
            switch (notificationType)
            {
                case NotificationType.Toast:
                    //TODO: Make this hit and deserialize a real XML file
                    string toast = string.Format("<toast>"
                        + "<visual>"
                        + "<binding template = \"ToastGeneric\" >"
                        + "<image placement=\"appLogoOverride\" src=\"Assets\\CompanionAppIcon44x44.png\" />"
                        + "<text>{0}</text>"
                        + "</binding>"
                        + "</visual>"
                        + "</toast>", noticeText);

                    XmlDocument toastDOM = new XmlDocument();
                    toastDOM.LoadXml(toast);
                    ToastNotificationManager.CreateToastNotifier().Show(
                        new ToastNotification(toastDOM));
                    break;
                case NotificationType.Tile:
                    break;
                default:
                    break;
            }
        }
开发者ID:scottroot2,项目名称:MagicMirror,代码行数:31,代码来源:NotificationManager.cs


示例5: actionsToast

 public static async void actionsToast(string title, string content, string id)
 {
     string xml = "<toast>" +
                     "<visual>" +
                         "<binding template=\"ToastGeneric\">" +
                             "<text></text>" +
                             "<text></text>" +
                         "</binding>" +
                     "</visual>" +
                     "<actions>" +
                         "<input id=\"content\" type=\"text\" placeHolderContent=\"请输入评论\" />" +
                         "<action content = \"确定\" arguments = \"ok" + id + "\" activationType=\"background\" />" +
                         "<action content = \"取消\" arguments = \"cancel\" activationType=\"background\"/>" +
                     "</actions >" +
                  "</toast>";
     // 创建并加载XML文档
     XmlDocument doc = new XmlDocument();
     doc.LoadXml(xml);
     XmlNodeList elements = doc.GetElementsByTagName("text");
     elements[0].AppendChild(doc.CreateTextNode(title));
     elements[1].AppendChild(doc.CreateTextNode(content));
     // 创建通知实例
     ToastNotification notification = new ToastNotification(doc);
     //// 显示通知
     //DateTime statTime = DateTime.Now.AddSeconds(10);  //指定应传递 Toast 通知的时间
     //ScheduledToastNotification recurringToast = new ScheduledToastNotification(doc, statTime);  //创建计划的 Toast 通知对象
     //ToastNotificationManager.CreateToastNotifier().AddToSchedule(recurringToast); //向计划中添加 Toast 通知
     ToastNotifier nt = ToastNotificationManager.CreateToastNotifier();
     nt.Show(notification);
 }
开发者ID:RedrockMobile,项目名称:CyxbsMobile_Win,代码行数:30,代码来源:Utils.cs


示例6: PopToast

        public static ToastNotification PopToast(string title, string content, string tag, string group)
        {
            string xml = [email protected]"<toast activationType='foreground'>
                                            <visual>
                                                <binding template='ToastGeneric'>
                                                </binding>
                                            </visual>
                                        </toast>";

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(xml);

            var binding = doc.SelectSingleNode("//binding");

            var el = doc.CreateElement("text");
            el.InnerText = title;

            binding.AppendChild(el);

            el = doc.CreateElement("text");
            el.InnerText = content;
            binding.AppendChild(el);

            return PopCustomToast(doc, tag, group);
        }
开发者ID:RasmusTG,项目名称:Windows-universal-samples,代码行数:25,代码来源:ToastHelper.cs


示例7: UpdateTile

        private void UpdateTile()
        {
            var now = DateTime.Now.ToString("HH:mm:ss");
            var xml =
                "<tile>" +
                "  <visual>" +
                "    <binding template='TileSmall'>" +
                "      <text>" + now + "</text>" +
                "    </binding>" +
                "    <binding template='TileMedium'>" +
                "      <text>" + now + "</text>" +
                "    </binding>" +
                "    <binding template='TileWide'>" +
                "      <text>" + now + "</text>" +
                "    </binding>" +
                "    <binding template='TileLarge'>" +
                "      <text>" + now + "</text>" +
                "    </binding>" +
                "  </visual>" +
                "</tile>";

            var tileDom = new XmlDocument();
            tileDom.LoadXml(xml);
            var tile = new TileNotification(tileDom);
            TileUpdateManager.CreateTileUpdaterForApplication().Update(tile);
        }
开发者ID:secavian,项目名称:BackgroundTimerLiveTile,代码行数:26,代码来源:BackgroundTask.cs


示例8: Hack

 public static void Hack()
 {
     var tileUpdater = TileUpdateManager.CreateTileUpdaterForApplication();
     XmlDocument document = new XmlDocument();
     document.LoadXml(xml);
     tileUpdater.Update(new TileNotification(document));
 }
开发者ID:Mordonus,项目名称:MALClient,代码行数:7,代码来源:StoreLogoWorkaroundHacker.cs


示例9: UpdateTile

        private static void UpdateTile()
        {
            var updateManager = TileUpdateManager.CreateTileUpdaterForApplication();
            updateManager.Clear();
            updateManager.EnableNotificationQueue(true);

            //prepare collection
            List<HolidayItem> eventCollection = _manager.GetHolidayList(DateTime.Now);

            if (eventCollection.Count < 5)
            {
                DateTime dt = DateTime.Now.AddMonths(1);
                List<HolidayItem> s = _manager.GetHolidayList(dt);
                eventCollection.AddRange(s);
            }

            //finalize collection
            eventCollection = (eventCollection.Count <= 5) ? eventCollection : eventCollection.Take(5).ToList();
            
            if (eventCollection.Count > 0)
                foreach (var currEvent in eventCollection)
                {
                    //date to show
                    DateTime date = new DateTime((int)currEvent.Year, (int)currEvent.Month, currEvent.Day);

                    var xmlDocument = new XmlDocument();
                    xmlDocument.LoadXml(String.Format(DataBakgroundManager.XML_TEMPLATE, date.ToString("d"), currEvent.HolidayName));

                    var notification = new TileNotification(xmlDocument);
                    updateManager.Update(notification);
                }
        }
开发者ID:Syanne,项目名称:Holiday-Calendar,代码行数:32,代码来源:TileBackgroundTask.cs


示例10: OnNavigatedTo

        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            rootPage = MainPage.Current;
            listBox.Items.Add("Index");
            StorageFile storageFile;
            file = "history.xml";
           
            
                storageFile= await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(file);
                XmlLoadSettings loadSettings = new XmlLoadSettings();
                loadSettings.ProhibitDtd = false;
                loadSettings.ResolveExternals = false;
                doc = await XmlDocument.LoadFromFileAsync(storageFile, loadSettings);
                var results = doc.SelectNodes("descendant::result");
                int num_results = 1;
                foreach (var result in results)
                {
                    listBox.Items.Add(num_results.ToString());
                    num_results += 1;
                }

                if (num_results > 1) //show the first history result
                {
                    listBox.SelectedIndex = 1;
                    select_item(0);
                }
            
          


            //rootPage.NotifyUser(doc.InnerText.ToString(), NotifyType.StatusMessage);

        }
开发者ID:MengyuanZhu,项目名称:Pegasus,代码行数:33,代码来源:Previous_Result.xaml.cs


示例11: GetNotificacion

        public override TileNotification GetNotificacion()
        {
            tile = new XmlDocument();            
            tile.LoadXml(stile);

            //System.Diagnostics.Debug.Write(tile.GetXml());

            var nodevisual = tile.GetElementsByTagName("binding");
            if (Title != null && Title != "")
            {
                ((XmlElement)nodevisual[1]).SetAttribute("displayName", this.Title);
            }

            var nodeImage = tile.GetElementsByTagName("image");
            ((Windows.Data.Xml.Dom.XmlElement)nodeImage[0]).SetAttribute("src", BackgroundImage.OriginalString);
            ((Windows.Data.Xml.Dom.XmlElement)nodeImage[1]).SetAttribute("src", BackgroundImage.OriginalString);
            //((Windows.Data.Xml.Dom.XmlElement)nodeImage[2]).SetAttribute("src", BackgroundImage.OriginalString);

            var nodeText = tile.GetElementsByTagName("text");
            nodeText[0].InnerText = BackTitle.ToString();
            nodeText[1].InnerText = BackContent.ToString();
            //nodeText[2].InnerText = BackContent.ToString();

            //System.Diagnostics.Debug.Write(this.tile.GetXml());
            var tileNotc = new TileNotification(this.tile);           
            return tileNotc;
        }
开发者ID:karolzak,项目名称:MVA-Channel9,代码行数:27,代码来源:StandardTileData.cs


示例12: SetToatAudio

 private static void SetToatAudio(XmlDocument xml)
 {
     var node = xml.SelectSingleNode("/toast");
     var audio = xml.CreateElement("audio");
     audio.SetAttribute("src", "ms-winsoundevent:Notification.IM");
     node.AppendChild(audio);
 }
开发者ID:chao-zhou,项目名称:PomodoroTimer,代码行数:7,代码来源:NotificationManager.cs


示例13: NavigationHelper_LoadState

        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        async private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            try
            {
                Windows.Storage.StorageFile file = null;
                Windows.Storage.StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
                file = await local.GetFileAsync("profile.xml");

                Stream fStream = await file.OpenStreamForReadAsync();
                StreamReader sr = new StreamReader(fStream);
                string result2 = sr.ReadToEnd();
                sr.Dispose();
                fStream.Dispose();
                XmlDocument profile = new XmlDocument();
                profile.LoadXml(result2);
                input_email.Text = profile.DocumentElement.SelectSingleNode("email").InnerText;
                input_username.Text = profile.DocumentElement.SelectSingleNode("username").InnerText;
                input_phone.Text = profile.DocumentElement.SelectSingleNode("phone").InnerText;


            }
            catch
            {
              
            }

        }
开发者ID:bjhamltn,项目名称:mealaroni_phone_app_windows,代码行数:38,代码来源:profile.xaml.cs


示例14: SetTileImageButtonClick

        /// <summary>
        /// Set the application's tile to display a local image file.
        /// After clicking, go back to the start screen to watch your application's tile update.
        /// </summary>
        private void SetTileImageButtonClick(object sender, RoutedEventArgs e)
        {
            // It is possible to start from an existing template and modify what is needed.
            // Alternatively you can construct the XML from scratch.
            var tileXml = new XmlDocument();
            var title = tileXml.CreateElement("title");
            var visual = tileXml.CreateElement("visual");
            visual.SetAttribute("version", "1");
            visual.SetAttribute("lang", "en-US");

            // The template is set to be a TileSquareImage. This tells the tile update manager what to expect next.
            var binding = tileXml.CreateElement("binding");
            binding.SetAttribute("template", "TileSquareImage");
            // An image element is then created under the TileSquareImage XML node. The path to the image is specified
            var image = tileXml.CreateElement("image");
            image.SetAttribute("id", "1");
            image.SetAttribute("src", @"ms-appx:///Assets/DemoImage.png");

            // All the XML elements are chained up together.
            title.AppendChild(visual);
            visual.AppendChild(binding);
            binding.AppendChild(image);
            tileXml.AppendChild(title);

            // The XML is used to create a new TileNotification which is then sent to the TileUpdateManager
            var tileNotification = new TileNotification(tileXml);
            TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification);
        }
开发者ID:DavidBurela,项目名称:Win8Demo-Tiles,代码行数:32,代码来源:BlankPage.xaml.cs


示例15: ButtonPinTile_Click

        private async void ButtonPinTile_Click(object sender, RoutedEventArgs e)
        {
            base.IsEnabled = false;

            string ImageUrl = _imagePath.ToString();

            SecondaryTile tile = TilesHelper.GenerateSecondaryTile("App Package Image");
            await tile.RequestCreateAsync();

            string tileXmlString =
                "<tile>"
                + "<visual>"
                + "<binding template='TileSmall'>"
                + "<image src='" + ImageUrl + "' alt='image'/>"
                + "</binding>"
                + "<binding template='TileMedium'>"
                + "<image src='" + ImageUrl + "' alt='image'/>"
                + "</binding>"
                + "<binding template='TileWide'>"
                + "<image src='" + ImageUrl + "' alt='image'/>"
                + "</binding>"
                + "<binding template='TileLarge'>"
                + "<image src='" + ImageUrl + "' alt='image'/>"
                + "</binding>"
                + "</visual>"
                + "</tile>";

            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(tileXmlString);
            TileNotification notifyTile = new TileNotification(xmlDoc);
            TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId).Update(notifyTile);

            base.IsEnabled = true;
        }
开发者ID:RasmusTG,项目名称:Windows-universal-samples,代码行数:34,代码来源:ScenarioElement.xaml.cs


示例16: ShowToast

        public static void ShowToast(string title, string message, [NotNull] Uri icon, Action click) {
            var tempIcon = FilesStorage.Instance.GetFilename("Temporary", "Icon.png");

            if (!File.Exists(tempIcon)) {
                using (var iconStream = Application.GetResourceStream(icon)?.Stream) {
                    if (iconStream != null) {
                        using (var file = new FileStream(tempIcon, FileMode.Create)) {
                            iconStream.CopyTo(file);
                        }
                    }
                }
            }

            var content = new XmlDocument();
            content.LoadXml([email protected]"<toast>
    <visual>
        <binding template=""ToastImageAndText02"">
            <image id=""1"" src=""file://{tempIcon}""/>
            <text id=""1"">{title}</text>
            <text id=""2"">{message}</text>
        </binding>
    </visual>
</toast>");

            var toast = new ToastNotification(content);
            if (click != null) {
                toast.Activated += (sender, args) => {
                    Application.Current.Dispatcher.Invoke(click);
                };
            }

            ToastNotifier.Show(toast);
        }
开发者ID:gro-ove,项目名称:actools,代码行数:33,代码来源:ToastWin8Helper.cs


示例17: ShowCore

        static async Task<bool?> ShowCore(XmlDocument rpDocument)
        {
            var rCompletionSource = new TaskCompletionSource<bool?>();

            var rNotification = new ToastNotification(rpDocument);

            TypedEventHandler<ToastNotification, object> rActivated = (s, e) => rCompletionSource.SetResult(true);
            rNotification.Activated += rActivated;

            TypedEventHandler<ToastNotification, ToastDismissedEventArgs> rDismissed = (s, e) => rCompletionSource.SetResult(false);
            rNotification.Dismissed += rDismissed;

            TypedEventHandler<ToastNotification, ToastFailedEventArgs> rFailed = (s, e) => rCompletionSource.SetResult(null);
            rNotification.Failed += rFailed;

            r_Notifier.Show(rNotification);

            var rResult = await rCompletionSource.Task;

            rNotification.Activated -= rActivated;
            rNotification.Dismissed -= rDismissed;
            rNotification.Failed -= rFailed;

            return rResult;
        }
开发者ID:KodamaSakuno,项目名称:Sakuno.Toast,代码行数:25,代码来源:ToastNotificationUtil.cs


示例18: Run

        public void Run(IBackgroundTaskInstance taskInstance)
        {
            var details = taskInstance.TriggerDetails as ToastNotificationActionTriggerDetail;
            string arguments = details.Argument;
            var result = details.UserInput;

            if (arguments == "check")
            {
                int sum = int.Parse(result["message"].ToString());
                string message = sum == 15 ? "Congratulations, the answer is correct!" : "Sorry, wrong answer!";

                string xml = [email protected]"<toast>
                              <visual>
                                <binding template=""ToastGeneric"">
                                  <image placement=""appLogoOverride"" src=""Assets/MicrosoftLogo.png"" />
                                  <text>{message}</text>
                                </binding>
                              </visual>
                            </toast>";

                XmlDocument doc = new XmlDocument();
                doc.LoadXml(xml);

                ToastNotification notification = new ToastNotification(doc);
                ToastNotificationManager.CreateToastNotifier().Show(notification);
            }
        }
开发者ID:Janisku7,项目名称:Windows10-Samples,代码行数:27,代码来源:CheckAnswerTask.cs


示例19: OnNavigatedTo

        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            rootPage = MainPage.Current;
            file = "status.xml";
            StorageFile storageFile = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(file);
            XmlLoadSettings loadSettings = new XmlLoadSettings();
            loadSettings.ProhibitDtd = false;
            loadSettings.ResolveExternals = false;
            doc = await XmlDocument.LoadFromFileAsync(storageFile, loadSettings);
            try
            {
                var results = doc.SelectNodes("descendant::result");                
                int num_results = 1;
                foreach (var result in results)
                {
                    String id = results[num_results - 1].SelectSingleNode("descendant::id").FirstChild.NodeValue.ToString();
                    String status = results[num_results-1].SelectSingleNode("descendant::status").FirstChild.NodeValue.ToString();
                    listBox.Items.Add("ID: "+id+" "+ status);
                    num_results += 1;
                }
                if (num_results==1)
                    listBox.Items.Add("You don't have pending jobs.");
            }
            
            catch(Exception)
            { 
            listBox.Items.Add("You don't have pending jobs.");
            }

        }
开发者ID:MengyuanZhu,项目名称:Pegasus,代码行数:30,代码来源:Pending_Result.xaml.cs


示例20: DisplayToast

        public static ToastNotification DisplayToast(string content)
        {
            string xml = [email protected]"<toast activationType='foreground'>
                                            <visual>
                                                <binding template='ToastGeneric'>
                                                    <text>Extended Execution</text>
                                                </binding>
                                            </visual>
                                        </toast>";

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(xml);

            var binding = doc.SelectSingleNode("//binding");

            var el = doc.CreateElement("text");
            el.InnerText = content;
            binding.AppendChild(el); //Add content to notification

            var toast = new ToastNotification(doc);

            ToastNotificationManager.CreateToastNotifier().Show(toast); //Show the toast

            return toast;
        }
开发者ID:AJ-COOL,项目名称:Windows-universal-samples,代码行数:25,代码来源:SampleConfiguration.cs



注:本文中的Windows.Data.Xml.Dom.XmlDocument类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Enumeration.DeviceInformation类代码示例发布时间:2022-05-26
下一篇:
C# Resources.ResourceLoader类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap