Example #1
0
        private void ListTapped(object sender, TappedRoutedEventArgs e)
        {
            Button    stack = (Button)sender;
            PFeedItem p     = (PFeedItem)stack.DataContext;

            ArticleFrame.Navigate(typeof(PArticle), p);
        }
Example #2
0
        private void ReadItem_Click(object sender, RoutedEventArgs e)
        {
            MenuFlyoutItem stack = (MenuFlyoutItem)sender;
            PFeedItem      p     = (PFeedItem)stack.DataContext;

            ArticleFrame.Navigate(typeof(PArticle), p);
        }
Example #3
0
        private async Task SearchArticleFromNotification(string theid, string website)
        {
            SyndicationFeed feed = await SyndicationConverter.RetrieveFeedAsync(website);

            foreach (SyndicationItem item in feed.Items)
            {
                try
                {
                    string itemid = (int)item.Title.Text.First()
                                    + item.PublishedDate.Second.ToString()
                                    + item.PublishedDate.Minute.ToString()
                                    + item.PublishedDate.Hour.ToString()
                                    + item.PublishedDate.Day.ToString();

                    if (theid == itemid)
                    {
                        PFeedItem target = new PFeedItem();
                        target.title         = Regex.Replace(item.Title.Text, @"(&.*?;)", " ");
                        target.link          = item.Links.FirstOrDefault().Uri.ToString();
                        target.feed          = feed.Title.Text;
                        target.PublishedDate = item.PublishedDate;
                        target.opacity       = 0.5;
                        App.Read             = App.Read + itemid + ';';
                        await FileIO.AppendTextAsync(await ApplicationData.Current.LocalFolder.GetFileAsync("read.txt"),
                                                     itemid + ';');

                        try
                        {
                            target.content = item.Summary.Text;
                            if (App.config.DownloadImages)
                            {
                                Match match = Regex.Match(target.content, @"<img(.*?)>", RegexOptions.Singleline);
                                if (match.Success)
                                {
                                    string val    = match.Groups[1].Value;
                                    Match  match2 = Regex.Match(val, @"src=\""(.*?)\""", RegexOptions.Singleline);
                                    if (match2.Success)
                                    {
                                        target.image       = match2.Groups[1].Value;
                                        target.iconopacity = 0;
                                    }
                                }
                            }
                        }
                        catch
                        {
                            target.content = string.Empty;
                        }

                        ArticleFrame.Navigate(typeof(PArticle), target);
                    }
                }
                catch (Exception ex)
                {
                    Debug.Write(ex.ToString());
                }
            }
        }
Example #4
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            ArticleFrame.Navigate(typeof(Page));
            App.CanNavigate = true;
            await Go(Display, e.Parameter);

            LoadStatus.IsIndeterminate = false;
            StatusBarDisabling.Begin();
        }
Example #5
0
 public PFeed()
 {
     this.InitializeComponent();
     App.ChosenIndex = 1;
     ArticleFrame.Navigate(typeof(BlankPage));
     SystemNavigationManager.GetForCurrentView().BackRequested += (s, a) =>
     {
         if (ArticleFrame.CanGoBack)
         {
             ArticleFrame.GoBack();
             a.Handled = true;
             if (!ArticleFrame.CanGoBack)
             {
                 App.CanNavigate = true;
             }
         }
     };
 }
Example #6
0
 public PFavorites()
 {
     this.InitializeComponent();
     App.ChosenIndex = 2;
     App.CanNavigate = false;
     Windows.UI.Core.SystemNavigationManager.GetForCurrentView().BackRequested += (s, a) =>
     {
         if (ArticleFrame.CanGoBack)
         {
             ArticleFrame.GoBack();
             a.Handled = true;
             if (!ArticleFrame.CanGoBack)
             {
                 App.CanNavigate = true;
             }
         }
     };
 }
Example #7
0
        private async Task Go(ItemsControl list, object NavUri)
        {
            await Task.Delay(300);

            StorageFolder favorites           = await(ApplicationData.Current.LocalFolder.GetFolderAsync("favorites"));
            IReadOnlyList <StorageFile> files = await favorites.GetFilesAsync();

            if (files.Count == 0)
            {
                Welcome.Visibility = Visibility.Visible;
            }

            foreach (StorageFile file in files)
            {
                itemlist.Add(await SerializerExtensions.DeSerializeObject <PFeedItem>(file));
            }
            await Task.Delay(TimeSpan.FromMilliseconds(5));

            if (NavUri != null)
            {
                foreach (PFeedItem item in itemlist)
                {
                    CompareAddTimeRead(item, list, false);
                    if (item.link == NavUri.ToString())
                    {
                        ArticleFrame.Navigate(typeof(PArticle), item);
                    }
                }
            }
            else
            {
                foreach (PFeedItem item in itemlist)
                {
                    CompareAddTimeRead(item, list, false);
                }
            }
        }