private void Tmr_Elapsed(object sender, ElapsedEventArgs e)
 {
     using (var context = new RSSFeedDatabaseEntities())
     {
         var newFeedsOnChannel = Utiles.GetNumberOfNewFeedsOnChannel(ChannelsList.Text, numOfFeeds);
         if (newFeedsOnChannel != 0)
         {
             MessageBox.Show($"Nowe wiadomości ({newFeedsOnChannel}) zostały pobrane, kliknij \"pokaż\" by odświeżyć", "TVN RSS Reader",
                             MessageBoxButton.OK, MessageBoxImage.Information);
             numOfFeeds = newFeedsOnChannel;
         }
     }
 }
        public MainWindow()
        {
            InitializeComponent();
            Utiles.StartParser();
            Hide();
            Utiles.ShowRefreshingCommunicateWindow();
            Show();
            Utiles.AddChannelsToCombobox(ChannelsList);
            Application.Current.MainWindow.Closing += MainWindow_Closing;
            using (var context = new RSSFeedDatabaseEntities())
            {
                numOfFeeds = context.Feed.Count();
            }

            System.Timers.Timer tmr = new System.Timers.Timer();
            tmr.Elapsed += Tmr_Elapsed;
            tmr.Interval = 320000;
            tmr.Start();
        }
예제 #3
0
        public static void GetDetailsOfSelectedFeed(ListBox feeds, TextBlock title, TextBlock date, TextBlock description, Canvas image, Hyperlink link)
        {
            image.Children.Clear();
            Feed currentFeed = (Feed)feeds.Items.CurrentItem;

            if (currentFeed != null)
            {
                title.Text = currentFeed.Title;
                if (currentFeed.Description.Length > 400)
                {
                    description.Text = currentFeed.Description.Substring(0, currentFeed.Description.Length - (currentFeed.Description.Length - 300));
                }
                else
                {
                    description.Text = currentFeed.Description;
                }
                date.Text = currentFeed.Date;
                image.Children.Add(Utiles.GetImage(currentFeed.Imagelink));
                link.NavigateUri = new Uri(currentFeed.Link);
            }
        }
 private void FeedList_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     Utiles.SortFeedsInList(FeedList);
     Utiles.GetDetailsOfSelectedFeed(FeedList, TitleBlock, DateBlock, DescriptionBlock, ImageCanvas, HyperlinkBox);
 }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     Utiles.AddFeedsToListbox(ChannelsList.Text, FeedList);
     Utiles.ClearUserControls(TitleBlock, DateBlock, DescriptionBlock, ImageCanvas);
 }