public void showGhostNotification(BookQuote bq)
        {
            quote = bq;

            var toastDescriptor = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02);

            var txtNodes = toastDescriptor.GetElementsByTagName("text");

            txtNodes[0].AppendChild(toastDescriptor.CreateTextNode(bq.Header));
            txtNodes[1].AppendChild(toastDescriptor.CreateTextNode(bq.Content));

            var toast = new ToastNotification(toastDescriptor);
            // add tag/group is needed
            Random r = new Random();

            toast.Group = r.Next().ToString();
            toast.Tag   = r.Next().ToString();

            // Ghost toast
            //toast.SuppressPopup = true;

            toast.Activated += toast_Activated;

            var toastNotifier = ToastNotificationManager.CreateToastNotifier();

            toastNotifier.Show(toast);
        }
Example #2
0
        private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            BookQuote temp = e.NavigationParameter as BookQuote;

            this.quoteHeader.Text  = temp.Header;
            this.quoteContent.Text = temp.Content;
        }
Example #3
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e.NavigationMode == NavigationMode.New)
            {
                var storageFile = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///VoiceCommandDefinition1.xml"));

                await Windows.Media.SpeechRecognition.VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(storageFile);
            }

            if (e.SourcePageType.GetType() == typeof(AddQuotePage))
            {
                ocBookQuotes = new ObservableCollection <BookQuote>(null);
            }


            //if(e.SourcePageType.)


            if (e.Parameter != null && e.Parameter.GetType() == typeof(BookQuote))
            {
                BookQuote temp = e.Parameter as BookQuote;
                ocBookQuotes.Add(temp);
                WriteData(ocBookQuotes.ToList());
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            BookQuote temp = new BookQuote()
            {
                Header = NewBookName.Text, Content = QContent.Text
            };

            this.Frame.Navigate(typeof(MainPage), temp);
        }
Example #5
0
        void registration_Completed(BackgroundTaskRegistration sender, BackgroundTaskCompletedEventArgs args)
        {
            Random r = new Random();

            BookQuote temp = ocBookQuotes[r.Next(0, ocBookQuotes.Count / 3)];

            showGhostNotification(temp);

            temp = ocBookQuotes[r.Next(ocBookQuotes.Count / 3, ocBookQuotes.Count * 2 / 3)];
            showGhostNotification(temp);

            temp = ocBookQuotes[r.Next(ocBookQuotes.Count * 2 / 3, ocBookQuotes.Count)];
            showGhostNotification(temp);
        }
Example #6
0
        private List <BookQuote> GetOriginalQuotes()
        {
            List <BookQuote> re = new List <BookQuote>();
            //var notesFolder = Windows.Storage.;
            //var xElem = XElement.Load(@"originalQuotes.xml");
            XDocument doc = XDocument.Load(@"originalQuotes.xml");

            IEnumerable <XElement> list = doc.Descendants("Header").ToList();

            foreach (var i in list)
            {
                BookQuote temp = new BookQuote();
                temp.Header  = i.Value;
                temp.Content = i.Parent.Element("Content").Value;
                re.Add(temp);
            }

            return(re.Distinct().ToList());
        }