mirror of
https://github.com/ckaczor/FeedCenter.git
synced 2026-01-13 17:22:48 -05:00
Move update message logic to common and remove restarting on update (installer will do that)
This commit is contained in:
@@ -66,6 +66,14 @@ namespace FeedCenter
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
// Setup the update message properties and callbacks
|
||||
UpdateCheck.ApplicationName = Properties.Resources.ApplicationDisplayName;
|
||||
UpdateCheck.UpdateServer = Settings.Default.VersionLocation;
|
||||
UpdateCheck.UpdateFile = Settings.Default.VersionFile;
|
||||
UpdateCheck.ApplicationShutdown = ApplicationShutdown;
|
||||
UpdateCheck.ApplicationCurrentMessage = ApplicationCurrentMessage;
|
||||
UpdateCheck.ApplicationUpdateMessage = ApplicationUpdateMessage;
|
||||
|
||||
// Show the notification icon
|
||||
NotificationIcon.Initialize(this);
|
||||
|
||||
@@ -105,6 +113,21 @@ namespace FeedCenter
|
||||
Tracer.WriteLine("MainForm creation finished");
|
||||
}
|
||||
|
||||
private static bool ApplicationUpdateMessage(string title, string message)
|
||||
{
|
||||
return MessageBox.Show(message, title, MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes;
|
||||
}
|
||||
|
||||
private static void ApplicationCurrentMessage(string title, string message)
|
||||
{
|
||||
MessageBox.Show(message, title, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
|
||||
private static void ApplicationShutdown()
|
||||
{
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Window overrides
|
||||
@@ -385,7 +408,7 @@ namespace FeedCenter
|
||||
// Increment the index and adjust if we've gone around the end
|
||||
_feedIndex = (_feedIndex + 1) % feedCount;
|
||||
}
|
||||
while (startIndex != _feedIndex);
|
||||
while (_feedIndex != startIndex);
|
||||
|
||||
// If nothing was found then clear the current feed
|
||||
if (!found)
|
||||
@@ -456,7 +479,7 @@ namespace FeedCenter
|
||||
if (_feedIndex < 0)
|
||||
_feedIndex = feedCount - 1;
|
||||
}
|
||||
while (startIndex != _feedIndex);
|
||||
while (_feedIndex != startIndex);
|
||||
|
||||
// If nothing was found then clear the current feed
|
||||
if (!found)
|
||||
@@ -690,7 +713,7 @@ namespace FeedCenter
|
||||
if (DateTime.Now - Settings.Default.LastVersionCheck >= Settings.Default.VersionCheckInterval)
|
||||
{
|
||||
// Get the update information
|
||||
UpdateCheck.CheckForUpdate(Settings.Default.VersionLocation, Settings.Default.VersionFile);
|
||||
UpdateCheck.CheckForUpdate();
|
||||
|
||||
// Update the last check time
|
||||
Settings.Default.LastVersionCheck = DateTime.Now;
|
||||
@@ -1192,7 +1215,7 @@ namespace FeedCenter
|
||||
|
||||
private void HandleOpenAllToolbarButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var multipleOpenAction = (MultipleOpenAction) _currentFeed.MultipleOpenAction;
|
||||
var multipleOpenAction = _currentFeed.MultipleOpenAction;
|
||||
|
||||
switch (multipleOpenAction)
|
||||
{
|
||||
@@ -1321,7 +1344,7 @@ namespace FeedCenter
|
||||
private void HandleNewVersionLinkClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Display update information
|
||||
VersionCheck.DisplayUpdateInformation(true);
|
||||
UpdateCheck.DisplayUpdateInformation(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user