enable update check

This commit is contained in:
Sean Kaim
2016-10-07 17:50:22 -04:00
parent d6a6cf6a59
commit 41fcbb2989
2 changed files with 43 additions and 40 deletions

View File

@@ -156,12 +156,12 @@ namespace mRemoteNG.App
private void LogApplicationData()
{
#if !PORTABLE
#if !PORTABLE
Logger.Instance.InfoFormat($"{Application.ProductName} {Application.ProductVersion} starting.");
#else
#else
Logger.Instance.InfoFormat(
$"{Application.ProductName} {Application.ProductVersion} {Language.strLabelPortableEdition} starting.");
#endif
#endif
}
private void LogCmdLineArgs()
@@ -189,7 +189,7 @@ namespace mRemoteNG.App
Runtime.RemoteConnectionsSyncronizer.Enable();
}
private void CheckForUpdate()
public void CheckForUpdate()
{
if (_appUpdate == null)
{

View File

@@ -9,6 +9,7 @@ using System.Windows.Forms;
using System.Collections.Generic;
using System.Linq;
using mRemoteNG.App;
using mRemoteNG.App.Info;
using mRemoteNG.Config;
using mRemoteNG.Config.Putty;
using mRemoteNG.Config.Settings;
@@ -285,42 +286,44 @@ namespace mRemoteNG.UI.Forms
}
private void frmMain_Shown(object sender, EventArgs e)
{
#if PORTABLE
// ReSharper disable once RedundantJumpStatement
return ;
#endif
// if (!mRemoteNG.Settings.Default.CheckForUpdatesAsked)
// {
// string[] commandButtons = new string[] {Language.strAskUpdatesCommandRecommended, Language.strAskUpdatesCommandCustom, Language.strAskUpdatesCommandAskLater};
// cTaskDialog.ShowTaskDialogBox(this, GeneralAppInfo.ProdName, Language.strAskUpdatesMainInstruction, string.Format(Language.strAskUpdatesContent, GeneralAppInfo.ProdName, "", "", "", "", string.Join("|", commandButtons), eTaskDialogButtons.None, eSysIcons.Question, eSysIcons.Question);
// if (cTaskDialog.CommandButtonResult == 0 | cTaskDialog.CommandButtonResult == 1)
// {
// mRemoteNG.Settings.Default.CheckForUpdatesAsked = true;
// }
// if (cTaskDialog.CommandButtonResult == 1)
// {
// Windows.ShowUpdatesTab();
// }
// return ;
// }
// if (!mRemoteNG.Settings.Default.CheckForUpdatesOnStartup)
// {
// return ;
// }
// DateTime nextUpdateCheck = System.Convert.ToDateTime(mRemoteNG.Settings.Default.CheckForUpdatesLastCheck.Add(TimeSpan.FromDays(System.Convert.ToDouble(mRemoteNG.Settings.Default.CheckForUpdatesFrequencyDays))));
// if (mRemoteNG.Settings.Default.UpdatePending || DateTime.UtcNow > nextUpdateCheck)
// {
// if (!IsHandleCreated)
// {
// CreateHandle(); // Make sure the handle is created so that InvokeRequired returns the correct result
// }
// Startup.CheckForUpdate();
// Startup.CheckForAnnouncement();
// }
}
{
#if PORTABLE
// ReSharper disable once RedundantJumpStatement
return;
#endif
if (!Settings.Default.CheckForUpdatesAsked)
{
string[] commandButtons =
{
Language.strAskUpdatesCommandRecommended, Language.strAskUpdatesCommandCustom,
Language.strAskUpdatesCommandAskLater
};
CTaskDialog.ShowTaskDialogBox(this, GeneralAppInfo.ProdName, Language.strAskUpdatesMainInstruction, string.Format(Language.strAskUpdatesContent, GeneralAppInfo.ProdName),
"", "", "", "", string.Join(" | ", commandButtons), ETaskDialogButtons.None, ESysIcons.Question, ESysIcons.Question);
if (CTaskDialog.CommandButtonResult == 0 | CTaskDialog.CommandButtonResult == 1)
{
Settings.Default.CheckForUpdatesAsked = true;
}
if (CTaskDialog.CommandButtonResult == 1)
{
Windows.Show(WindowType.Update);
}
return;
}
if (!Settings.Default.CheckForUpdatesOnStartup) return;
DateTime nextUpdateCheck = Convert.ToDateTime(
Settings.Default.CheckForUpdatesLastCheck.Add(
TimeSpan.FromDays(Convert.ToDouble(Settings.Default.CheckForUpdatesFrequencyDays))));
if (!Settings.Default.UpdatePending && DateTime.UtcNow <= nextUpdateCheck) return;
if (!IsHandleCreated) CreateHandle(); // Make sure the handle is created so that InvokeRequired returns the correct result
Startup.Instance.CheckForUpdate();
}
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
{