Beispiel #1
0
 public static int GetNumberOfNewFeedsOnChannel(string channelTitle, int numOfFeeds)
 {
     using (var context = new RSSFeedDatabaseEntities())
     {
         return(context.Feed.Count() - numOfFeeds);
     }
 }
Beispiel #2
0
        public static void AddFeedsToListbox(string channelTitle, ListBox feedListBox)
        {
            IQueryable <Feed> feedsOnChannel;

            using (var context = new RSSFeedDatabaseEntities())
            {
                feedsOnChannel          = context.Feed.Where(x => x.Channel.Title == channelTitle);
                feedListBox.ItemsSource = feedsOnChannel.ToList();
            }
        }
Beispiel #3
0
 public static void AddChannelsToCombobox(ComboBox channelsComboBox)
 {
     using (var context = new RSSFeedDatabaseEntities())
     {
         List <string> channels = new List <string>();
         foreach (var channel in context.Channel)
         {
             channels.Add(channel.Title);
         }
         channelsComboBox.ItemsSource = channels;
     }
 }
 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();
        }