Example #1
0
        private void HandleOkayButtonClick(object sender, RoutedEventArgs e)
        {
            // Save the actual settings
            _database.SaveChanges();

            DialogResult = true;

            Close();
        }
Example #2
0
        private void MarkAllItemsAsRead()
        {
            // Loop over all items and mark them as read
            foreach (FeedItem feedItem in LinkTextList.Items)
            {
                feedItem.BeenRead = true;
            }

            // Save the changes
            _database.SaveChanges();

            // Clear the list
            LinkTextList.Items.Clear();
        }
Example #3
0
        private static void HandleFeedReadWorkerStart(object sender, DoWorkEventArgs e)
        {
            // Create a new database instance for just this thread
            var database = new FeedCenterEntities();

            // Get the worker
            var worker = (BackgroundWorker)sender;

            // Get the input information
            var workerInput = (FeedReadWorkerInput)e.Argument;

            // Setup for progress
            var currentProgress = 0;

            // Create the list of feeds to read
            var feedsToRead = new List <Feed>();

            // If we have a single feed then add it to the list - otherwise add them all
            if (workerInput.Feed != null)
            {
                feedsToRead.Add(database.Feeds.First(feed => feed.ID == workerInput.Feed.ID));
            }
            else
            {
                feedsToRead.AddRange(database.Feeds);
            }

            // Loop over each feed and read it
            foreach (var feed in feedsToRead)
            {
                // Read the feed
                feed.Read(database, workerInput.ForceRead);

                // Increment progress
                currentProgress += 1;

                // Report progress
                worker.ReportProgress(currentProgress);
            }

            // Save the changes
            database.SaveChanges();

            // Increment progress
            currentProgress += 1;

            // Report progress
            worker.ReportProgress(currentProgress);

            // See if we're due for a version check
            if (DateTime.Now - Settings.Default.LastVersionCheck >= Settings.Default.VersionCheckInterval)
            {
                // Get the update information
                UpdateCheck.CheckForUpdate();

                // Update the last check time
                Settings.Default.LastVersionCheck = DateTime.Now;
            }

            // Increment progress
            currentProgress += 1;

            // Report progress
            worker.ReportProgress(currentProgress);

            // Sleep for a little bit so the user can see the update
            Thread.Sleep(Settings.Default.ProgressSleepInterval * 3);
        }