Remove WinForms references and start on installer

This commit is contained in:
2023-04-22 09:05:41 -04:00
parent d6a2fd5a46
commit 586a0497d6
14 changed files with 572 additions and 676 deletions

View File

@@ -1,6 +1,7 @@
using FeedCenter.Properties;
using System;
using System.Windows.Forms;
using System.Timers;
using System.Windows.Threading;
namespace FeedCenter;
@@ -9,11 +10,14 @@ public partial class MainWindow
private Timer _mainTimer;
private DateTime _lastFeedRead;
private DateTime _lastFeedDisplay;
private Dispatcher _dispatcher;
private void InitializeTimer()
{
_dispatcher = Dispatcher.CurrentDispatcher;
_mainTimer = new Timer { Interval = 1000 };
_mainTimer.Tick += HandleMainTimerTick;
_mainTimer.Elapsed += HandleMainTimerElapsed;
}
private void TerminateTimer()
@@ -33,26 +37,29 @@ public partial class MainWindow
_mainTimer.Stop();
}
private void HandleMainTimerTick(object sender, EventArgs e)
private void HandleMainTimerElapsed(object sender, EventArgs e)
{
// If the background worker is busy then don't do anything
if (_feedReadWorker.IsBusy)
return;
_dispatcher.Invoke(() =>
{
// If the background worker is busy then don't do anything
if (_feedReadWorker.IsBusy)
return;
// Stop the timer for now
StopTimer();
// Stop the timer for now
StopTimer();
// Move to the next feed if the scroll interval has expired and the mouse isn't hovering
if (LinkTextList.IsMouseOver)
_lastFeedDisplay = DateTime.Now;
else if (DateTime.Now - _lastFeedDisplay >= Settings.Default.FeedScrollInterval)
NextFeed();
// Move to the next feed if the scroll interval has expired and the mouse isn't hovering
if (LinkTextList.IsMouseOver)
_lastFeedDisplay = DateTime.Now;
else if (DateTime.Now - _lastFeedDisplay >= Settings.Default.FeedScrollInterval)
NextFeed();
// Check to see if we should try to read the feeds
if (DateTime.Now - _lastFeedRead >= Settings.Default.FeedCheckInterval)
ReadFeeds();
// Check to see if we should try to read the feeds
if (DateTime.Now - _lastFeedRead >= Settings.Default.FeedCheckInterval)
ReadFeeds();
// Get the timer going again
StartTimer();
// Get the timer going again
StartTimer();
});
}
}