Exemplo n.º 1
0
        public Task Show(ToastNotificationOptions options)
        {
            var toastXml      = BuildToast(options);
            var toast         = new ToastNotification(toastXml);
            var toastNotifier = ToastNotificationManager.CreateToastNotifier();

            return(Task.Factory.StartNew(() => toastNotifier.Show(toast)));
        }
        public Task Show(ToastNotificationOptions options)
        {
            var toastXml = BuildToast(options);
            var toast = new ToastNotification(toastXml);
            var toastNotifier = ToastNotificationManager.CreateToastNotifier();

            return Task.Factory.StartNew(() => toastNotifier.Show(toast));
        }
        public void SubtitleReturnsUnknownIfSetToEmpty()
        {
            var options = new ToastNotificationOptions
            {
                Subtitle = string.Empty
            };

            options.Subtitle.Should().Be("Unknown");
        }
        public void SubtitleReturnsUnknownIfSetToNull()
        {
            var options = new ToastNotificationOptions
            {
                Subtitle = null
            };

            options.Subtitle.Should().Be("Unknown");
        }
        public void TitleReturnsUnknownIfItIsSetToNull()
        {
            var options = new ToastNotificationOptions
                              {
                                  Title = null
                              };

            options.Title.Should().Be("Unknown");
        }
        public void SubtitleRerturnsValueSet()
        {
            const string subtitle = "subtitle";
            var options = new ToastNotificationOptions
            {
                Subtitle = subtitle
            };

            options.Subtitle.Should().Be(subtitle);
        }
        public void TitleRerturnsValueSet()
        {
            const string title = "title";
            var options = new ToastNotificationOptions
                              {
                                  Title = title
                              };

            options.Title.Should().Be(title);
        }
        private XmlDocument BuildToast(ToastNotificationOptions options)
        {
            var template = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastImageAndText02);

            // Build Image
            var images = template.GetElementsByTagName("image");
            ((XmlElement)images[0]).SetAttribute("src", options.ImageUrl);
            ((XmlElement)images[0]).SetAttribute("alt", "Cover Art");

            // Title and Subtitle
            var texts = template.GetElementsByTagName("text");
            texts[0].AppendChild(template.CreateTextNode(options.Title));
            texts[1].AppendChild(template.CreateTextNode(options.Subtitle));

            //Build audio
            var audioTag = template.CreateElement("audio");
            audioTag.SetAttribute("silent", (!UseSound).ToString().ToLowerInvariant());
            template.ChildNodes[0].AppendChild(audioTag);

            return template;
        }
Exemplo n.º 9
0
        private XmlDocument BuildToast(ToastNotificationOptions options)
        {
            var template = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastImageAndText02);

            // Build Image
            var images = template.GetElementsByTagName("image");

            ((XmlElement)images[0]).SetAttribute("src", options.ImageUrl);
            ((XmlElement)images[0]).SetAttribute("alt", "Cover Art");

            // Title and Subtitle
            var texts = template.GetElementsByTagName("text");

            texts[0].AppendChild(template.CreateTextNode(options.Title));
            texts[1].AppendChild(template.CreateTextNode(options.Subtitle));

            //Build audio
            var audioTag = template.CreateElement("audio");

            audioTag.SetAttribute("silent", (!UseSound).ToString().ToLowerInvariant());
            template.ChildNodes[0].AppendChild(audioTag);

            return(template);
        }
 public void Show(ToastNotificationOptions options)
 {
     ShowCallCount++;
 }
        public Task Show(ToastNotificationOptions options)
        {
            ShowCallCount++;

            return new Task(() => { });
        }