Merge pull request #167 from mRemoteNG/137_Update_Check

137 update check
This commit is contained in:
Sean Kaim
2016-10-12 15:52:13 -04:00
committed by GitHub
38 changed files with 170 additions and 734 deletions

View File

@@ -5,7 +5,6 @@ using mRemoteNG.Connection;
using mRemoteNG.Messages;
using mRemoteNG.Tools;
using mRemoteNG.UI.Forms;
using mRemoteNG.UI.Window;
using System;
using System.ComponentModel;
using System.Diagnostics;
@@ -15,20 +14,17 @@ using System.IO;
using System.Management;
using System.Threading;
using System.Windows.Forms;
using mRemoteNG.UI;
using WeifenLuo.WinFormsUI.Docking;
namespace mRemoteNG.App
{
public class Startup
{
private static readonly Startup _singletonInstance = new Startup();
private CompatibilityChecker _compatibilityChecker;
private AppUpdater _appUpdate;
public static Startup Instance
{
get { return _singletonInstance; }
}
public static Startup Instance { get; } = new Startup();
private Startup()
{
@@ -156,12 +152,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 +185,7 @@ namespace mRemoteNG.App
Runtime.RemoteConnectionsSyncronizer.Enable();
}
private void CheckForUpdate()
public void CheckForUpdate()
{
if (_appUpdate == null)
{
@@ -242,48 +238,6 @@ namespace mRemoteNG.App
}
}
private void CheckForAnnouncement()
{
if (_appUpdate == null)
_appUpdate = new AppUpdater();
else if (_appUpdate.IsGetAnnouncementInfoRunning)
return;
_appUpdate.GetAnnouncementInfoCompletedEvent += GetAnnouncementInfoCompleted;
_appUpdate.GetAnnouncementInfoAsync();
}
private void GetAnnouncementInfoCompleted(object sender, AsyncCompletedEventArgs e)
{
if (frmMain.Default.InvokeRequired)
{
frmMain.Default.Invoke(new AsyncCompletedEventHandler(GetAnnouncementInfoCompleted), new object[] { sender, e });
return;
}
try
{
_appUpdate.GetAnnouncementInfoCompletedEvent -= GetAnnouncementInfoCompleted;
if (e.Cancelled)
{
return;
}
if (e.Error != null)
{
throw (e.Error);
}
if (_appUpdate.IsAnnouncementAvailable())
{
Windows.Show(WindowType.Announcement);
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage("GetAnnouncementInfoCompleted() failed.", ex, MessageClass.ErrorMsg, true);
}
}
private void ParseCommandLineArgs()
{

View File

@@ -1,32 +0,0 @@
using System;
namespace mRemoteNG.App.Update
{
public class AnnouncementInfo
{
#region Public Properties
public bool IsValid { get; set; }
public string Name { get; set; }
public Uri Address { get; set; }
#endregion
#region Public Methods
public static AnnouncementInfo FromString(string input)
{
AnnouncementInfo newInfo = new AnnouncementInfo();
if (string.IsNullOrEmpty(input))
{
newInfo.IsValid = false;
}
else
{
UpdateFile updateFile = new UpdateFile(input);
newInfo.Name = updateFile.GetString("Name");
newInfo.Address = updateFile.GetUri("URL");
newInfo.IsValid = true;
}
return newInfo;
}
#endregion
}
}

View File

@@ -15,65 +15,20 @@ namespace mRemoteNG.App.Update
{
private UpdateInfo _currentUpdateInfo;
private string _changeLog;
private AnnouncementInfo _currentAnnouncementInfo;
private WebProxy _webProxy;
private Thread _getUpdateInfoThread;
private Thread _getChangeLogThread;
private Thread _getAnnouncementInfoThread;
#region Public Properties
public UpdateInfo CurrentUpdateInfo => _currentUpdateInfo;
public string ChangeLog => _changeLog;
public AnnouncementInfo CurrentAnnouncementInfo => _currentAnnouncementInfo;
public bool IsGetUpdateInfoRunning => _getUpdateInfoThread != null && _getUpdateInfoThread.IsAlive;
public bool IsGetUpdateInfoRunning
{
get
{
if (_getUpdateInfoThread != null)
{
if (_getUpdateInfoThread.IsAlive)
{
return true;
}
}
return false;
}
}
public bool IsGetChangeLogRunning
{
get
{
if (_getChangeLogThread != null)
{
if (_getChangeLogThread.IsAlive)
{
return true;
}
}
return false;
}
}
public bool IsGetAnnouncementInfoRunning
{
get
{
if (_getAnnouncementInfoThread != null)
{
if (_getAnnouncementInfoThread.IsAlive)
{
return true;
}
}
return false;
}
}
public bool IsDownloadUpdateRunning => (_downloadUpdateWebClient != null);
private bool IsGetChangeLogRunning => _getChangeLogThread != null && _getChangeLogThread.IsAlive;
public bool IsDownloadUpdateRunning => (_downloadUpdateWebClient != null);
#endregion
@@ -120,16 +75,6 @@ namespace mRemoteNG.App.Update
return _currentUpdateInfo.Version > GeneralAppInfo.GetApplicationVersion();
}
public bool IsAnnouncementAvailable()
{
if (_currentAnnouncementInfo == null || (!_currentAnnouncementInfo.IsValid || string.IsNullOrEmpty(_currentAnnouncementInfo.Name)))
{
return false;
}
return (_currentAnnouncementInfo.Name != Settings.Default.LastAnnouncement);
}
public void GetUpdateInfoAsync()
{
if (IsGetUpdateInfoRunning)
@@ -161,19 +106,6 @@ namespace mRemoteNG.App.Update
_getChangeLogThread.Start();
}
public void GetAnnouncementInfoAsync()
{
if (IsGetAnnouncementInfoRunning)
{
_getAnnouncementInfoThread.Abort();
}
_getAnnouncementInfoThread = new Thread(GetAnnouncementInfo);
_getAnnouncementInfoThread.SetApartmentState(ApartmentState.STA);
_getAnnouncementInfoThread.IsBackground = true;
_getAnnouncementInfoThread.Start();
}
public void DownloadUpdateAsync()
{
if (_downloadUpdateWebClient != null)
@@ -215,7 +147,7 @@ namespace mRemoteNG.App.Update
#region Private Methods
private WebClient CreateWebClient()
{
WebClient webClient = new WebClient();
var webClient = new WebClient();
webClient.Headers.Add("user-agent", GeneralAppInfo.UserAgent);
webClient.Proxy = _webProxy;
return webClient;
@@ -286,24 +218,6 @@ namespace mRemoteNG.App.Update
GetChangeLogCompletedEventEvent?.Invoke(this, e);
}
private void GetAnnouncementInfo()
{
Uri announcementFileUri = new Uri(Convert.ToString(Settings.Default.AnnouncementAddress));
DownloadStringCompletedEventArgs e = DownloadString(announcementFileUri);
if (!e.Cancelled && e.Error == null)
{
_currentAnnouncementInfo = AnnouncementInfo.FromString(e.Result);
if (!string.IsNullOrEmpty(_currentAnnouncementInfo.Name))
{
Settings.Default.LastAnnouncement = _currentAnnouncementInfo.Name;
}
}
GetAnnouncementInfoCompletedEventEvent?.Invoke(this, e);
}
private void DownloadUpdateProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
DownloadUpdateProgressChangedEventEvent?.Invoke(sender, e);
@@ -317,21 +231,21 @@ namespace mRemoteNG.App.Update
{
try
{
Authenticode updateAuthenticode = new Authenticode(_currentUpdateInfo.UpdateFilePath);
updateAuthenticode.RequireThumbprintMatch = true;
updateAuthenticode.ThumbprintToMatch = _currentUpdateInfo.CertificateThumbprint;
if (updateAuthenticode.Verify() != Authenticode.StatusValue.Verified)
{
if (updateAuthenticode.Status == Authenticode.StatusValue.UnhandledException)
Authenticode updateAuthenticode = new Authenticode(_currentUpdateInfo.UpdateFilePath)
{
RequireThumbprintMatch = true,
ThumbprintToMatch = _currentUpdateInfo.CertificateThumbprint
};
if (updateAuthenticode.Verify() != Authenticode.StatusValue.Verified)
{
if (updateAuthenticode.Status == Authenticode.StatusValue.UnhandledException)
{
throw (updateAuthenticode.Exception);
}
else
{
throw (new Exception(updateAuthenticode.StatusMessage));
}
}
throw (new Exception(updateAuthenticode.StatusMessage));
}
}
catch (Exception ex)
{
@@ -378,20 +292,7 @@ namespace mRemoteNG.App.Update
}
}
private AsyncCompletedEventHandler GetAnnouncementInfoCompletedEventEvent;
public event AsyncCompletedEventHandler GetAnnouncementInfoCompletedEvent
{
add
{
GetAnnouncementInfoCompletedEventEvent = (AsyncCompletedEventHandler)Delegate.Combine(GetAnnouncementInfoCompletedEventEvent, value);
}
remove
{
GetAnnouncementInfoCompletedEventEvent = (AsyncCompletedEventHandler)Delegate.Remove(GetAnnouncementInfoCompletedEventEvent, value);
}
}
private DownloadProgressChangedEventHandler DownloadUpdateProgressChangedEventEvent;
private DownloadProgressChangedEventHandler DownloadUpdateProgressChangedEventEvent;
public event DownloadProgressChangedEventHandler DownloadUpdateProgressChangedEvent
{
add

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
namespace mRemoteNG.App.Update
{
@@ -23,36 +24,33 @@ namespace mRemoteNG.App.Update
// ReSharper disable once MemberCanBePrivate.Global
public void FromString(string content)
{
// ReSharper restore MemberCanBePrivate.Local
if (string.IsNullOrEmpty(content))
{
}
else
{
char[] lineSeparators = { '\n', '\r' };
char[] keyValueSeparators = { ':', '=' };
char[] commentCharacters = { '#', ';', '\'' };
if (string.IsNullOrEmpty(content)) return;
string[] lines = content.Split(lineSeparators.ToString().ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
foreach (string line in lines)
char[] keyValueSeparators = { ':', '=' };
char[] commentCharacters = { '#', ';', '\'' };
using (var sr = new StringReader(content))
{
string line;
while ((line = sr.ReadLine()) != null)
{
string trimmedLine = line.Trim();
var trimmedLine = line.Trim();
if (trimmedLine.Length == 0)
{
continue;
}
if (trimmedLine.Substring(0, 1).IndexOfAny(commentCharacters.ToString().ToCharArray()) != -1)
if (trimmedLine.Substring(0, 1).IndexOfAny(commentCharacters) != -1)
{
continue;
}
string[] parts = trimmedLine.Split(keyValueSeparators.ToString().ToCharArray(), 2);
var parts = trimmedLine.Split(keyValueSeparators, 2);
if (parts.Length != 2)
{
continue;
}
string key = Convert.ToString(parts[0].Trim());
string value = Convert.ToString(parts[1].Trim());
var key = parts[0].Trim();
var value = parts[1].Trim();
_items.Add(key, value);
}
@@ -60,7 +58,7 @@ namespace mRemoteNG.App.Update
}
// ReSharper disable MemberCanBePrivate.Local
public string GetString(string key)
private string GetString(string key)
{
// ReSharper restore MemberCanBePrivate.Local
return !Items.ContainsKey(key) ? string.Empty : this._items[key];

View File

@@ -4,25 +4,25 @@ namespace mRemoteNG.App.Update
{
public class UpdateInfo
{
public bool IsValid { get; set; }
public Version Version { get; set; }
public Uri DownloadAddress { get; set; }
public bool IsValid { get; private set; }
public Version Version { get; private set; }
public Uri DownloadAddress { get; private set; }
public string UpdateFilePath { get; set; }
public Uri ChangeLogAddress { get; set; }
public Uri ImageAddress { get; set; }
public Uri ImageLinkAddress { get; set; }
public string CertificateThumbprint { get; set; }
public Uri ChangeLogAddress { get; private set; }
public Uri ImageAddress { get; private set; }
public Uri ImageLinkAddress { get; private set; }
public string CertificateThumbprint { get; private set; }
public static UpdateInfo FromString(string input)
{
UpdateInfo newInfo = new UpdateInfo();
var newInfo = new UpdateInfo();
if (string.IsNullOrEmpty(input))
{
newInfo.IsValid = false;
}
else
{
UpdateFile updateFile = new UpdateFile(input);
var updateFile = new UpdateFile(input);
newInfo.Version = updateFile.GetVersion("Version");
newInfo.DownloadAddress = updateFile.GetUri("dURL");
newInfo.ChangeLogAddress = updateFile.GetUri("clURL");

View File

@@ -1,6 +1,7 @@
using mRemoteNG.UI.Forms;
using mRemoteNG.UI.Window;
using System;
using mRemoteNG.UI;
using WeifenLuo.WinFormsUI.Docking;
namespace mRemoteNG.App
@@ -31,8 +32,6 @@ namespace mRemoteNG.App
public static DockContent ErrorsPanel { get; set; } = new DockContent();
public static ScreenshotManagerWindow ScreenshotForm { get; set; }
public static DockContent ScreenshotPanel { get; set; } = new DockContent();
public static AnnouncementWindow AnnouncementForm { get; set; }
public static DockContent AnnouncementPanel { get; set; } = new DockContent();
public static UpdateWindow UpdateForm { get; set; }
public static DockContent UpdatePanel { get; set; } = new DockContent();
public static SSHTransferWindow SshtransferForm { get; set; }
@@ -124,15 +123,6 @@ namespace mRemoteNG.App
}
_componentscheckForm.Show(frmMain.Default.pnlDock);
}
else if (windowType.Equals(WindowType.Announcement))
{
if (AnnouncementForm == null || AnnouncementForm.IsDisposed)
{
AnnouncementForm = new AnnouncementWindow(AnnouncementPanel);
AnnouncementPanel = AnnouncementForm;
}
AnnouncementForm.Show(frmMain.Default.pnlDock);
}
}
catch (Exception ex)
{

View File

@@ -85,7 +85,7 @@ namespace mRemoteNG.Config.Settings
return null;
}
public void CreatePanels()
private void CreatePanels()
{
Windows.ConfigForm = new ConfigWindow(Windows.ConfigPanel);
Windows.ConfigPanel = Windows.ConfigForm;
@@ -101,9 +101,6 @@ namespace mRemoteNG.Config.Settings
Windows.UpdateForm = new UpdateWindow(Windows.UpdatePanel);
Windows.UpdatePanel = Windows.UpdateForm;
Windows.AnnouncementForm = new AnnouncementWindow(Windows.AnnouncementPanel);
Windows.AnnouncementPanel = Windows.AnnouncementForm;
}
}
}

View File

@@ -1691,18 +1691,6 @@ namespace mRemoteNG {
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string LastAnnouncement {
get {
return ((string)(this["LastAnnouncement"]));
}
set {
this["LastAnnouncement"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
@@ -2179,15 +2167,6 @@ namespace mRemoteNG {
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("https://update.mremoteng.org/announcement.txt")]
public string AnnouncementAddress {
get {
return ((string)(this["AnnouncementAddress"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("https://update.mremoteng.org/")]

View File

@@ -419,9 +419,6 @@
<Setting Name="InhDefaultExtApp" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="LastAnnouncement" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="CheckForUpdatesAsked" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
@@ -542,9 +539,6 @@
<Setting Name="CompatibilityWarnLenovoAutoScrollUtility" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="AnnouncementAddress" Type="System.String" Scope="Application">
<Value Profile="(Default)">https://update.mremoteng.org/announcement.txt</Value>
</Setting>
<Setting Name="UpdateAddress" Type="System.String" Scope="Application">
<Value Profile="(Default)">https://update.mremoteng.org/</Value>
</Setting>

View File

@@ -1,2 +0,0 @@
Name: mRemote goes Commercial
URL: http://mremote.org/wiki/Commercial.ashx

View File

@@ -815,7 +815,7 @@ namespace mRemoteNG {
}
/// <summary>
/// Looks up a localized string similar to Check for updates and announcements at startup.
/// Looks up a localized string similar to Check for updates at startup.
/// </summary>
internal static string strCheckForUpdatesOnStartup {
get {
@@ -2748,15 +2748,6 @@ namespace mRemoteNG {
}
}
/// <summary>
/// Looks up a localized string similar to Announcements.
/// </summary>
internal static string strMenuAnnouncements {
get {
return ResourceManager.GetString("strMenuAnnouncements", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Check for Updates.
/// </summary>
@@ -6515,7 +6506,7 @@ namespace mRemoteNG {
}
/// <summary>
/// Looks up a localized string similar to mRemoteNG can periodically connect to the mRemoteNG website to check for updates and product announcements..
/// Looks up a localized string similar to mRemoteNG can periodically connect to the mRemoteNG website to check for updates..
/// </summary>
internal static string strUpdateCheck {
get {
@@ -6623,15 +6614,6 @@ namespace mRemoteNG {
}
}
/// <summary>
/// Looks up a localized string similar to The announcement information could not be downloaded..
/// </summary>
internal static string strUpdateGetAnnouncementInfoFailed {
get {
return ResourceManager.GetString("strUpdateGetAnnouncementInfoFailed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The change log could not be downloaded..
/// </summary>

View File

@@ -915,9 +915,6 @@ Starte mit neuer Datei.</value>
<data name="strMenuAddConnectionPanel" xml:space="preserve">
<value>Verbindungs-Panel hinzufügen</value>
</data>
<data name="strMenuAnnouncements" xml:space="preserve">
<value>Ankündigungen</value>
</data>
<data name="strMenuCheckForUpdates" xml:space="preserve">
<value>Suche nach Updates</value>
</data>

View File

@@ -904,9 +904,6 @@ Ver el articulo de soporte de Microsoft en http://support.microsoft.com/kb/81183
<data name="strMenuAddConnectionPanel" xml:space="preserve">
<value>Agregar Panel de Conexión</value>
</data>
<data name="strMenuAnnouncements" xml:space="preserve">
<value>Novedades</value>
</data>
<data name="strMenuCheckForUpdates" xml:space="preserve">
<value>Comprobar Actualizaciones</value>
</data>

View File

@@ -896,9 +896,6 @@ Consultez l'article du support de Microsoft pour plus d'informations http://supp
<data name="strMenuAddConnectionPanel" xml:space="preserve">
<value>Ajouter un panneau de connexion</value>
</data>
<data name="strMenuAnnouncements" xml:space="preserve">
<value>Annonces</value>
</data>
<data name="strMenuCheckForUpdates" xml:space="preserve">
<value>Rechercher des mises à jour</value>
</data>

View File

@@ -899,9 +899,6 @@ Visualizza il supporto Microsoft http://support.microsoft.com/kb/811833/it per o
<data name="strMenuAddConnectionPanel" xml:space="preserve">
<value>Aggiungi pannello delle connessioni</value>
</data>
<data name="strMenuAnnouncements" xml:space="preserve">
<value>Segnalazioni</value>
</data>
<data name="strMenuCheckForUpdates" xml:space="preserve">
<value>Verifica la presenza di aggiornamenti</value>
</data>

View File

@@ -385,7 +385,7 @@ VncSharp Control Version {0}</value>
<value>もう一度点検する</value>
</data>
<data name="strCheckForUpdatesOnStartup" xml:space="preserve">
<value>Check for updates and announcements at startup</value>
<value>Check for updates at startup</value>
</data>
<data name="strCheckNow" xml:space="preserve">
<value>点検する</value>
@@ -1037,9 +1037,6 @@ See the Microsoft Support article at http://support.microsoft.com/kb/811833 for
<data name="strMenuAddConnectionPanel" xml:space="preserve">
<value>接続表示パネルの追加</value>
</data>
<data name="strMenuAnnouncements" xml:space="preserve">
<value>お知らせ</value>
</data>
<data name="strMenuCheckForUpdates" xml:space="preserve">
<value>最新バージョンをチェック</value>
</data>
@@ -2291,7 +2288,7 @@ Message:
<value>mRemoteNG requires an update</value>
</data>
<data name="strUpdateCheck" xml:space="preserve">
<value>mRemoteNG can periodically connect to the mRemoteNG website to check for updates and product announcements.</value>
<value>mRemoteNG can periodically connect to the mRemoteNG website to check for updates.</value>
</data>
<data name="strUpdateCheckCompleteFailed" xml:space="preserve">
<value>The update information could not be downloaded.</value>
@@ -2327,9 +2324,6 @@ mRemoteNGを終了してインストールを開始します</value>
<data name="strUpdateFrequencyWeekly" xml:space="preserve">
<value>毎週</value>
</data>
<data name="strUpdateGetAnnouncementInfoFailed" xml:space="preserve">
<value>The announcement information could not be downloaded.</value>
</data>
<data name="strUpdateGetChangeLogFailed" xml:space="preserve">
<value>The change log could not be downloaded.</value>
</data>

View File

@@ -914,9 +914,6 @@ Se Microsoft Support-artikkelen på http://support.microsoft.com/kb/811833 for m
<data name="strMenuAddConnectionPanel" xml:space="preserve">
<value>Legg til tilkoblingspanel</value>
</data>
<data name="strMenuAnnouncements" xml:space="preserve">
<value>Kunngjøringer</value>
</data>
<data name="strMenuCheckForUpdates" xml:space="preserve">
<value>Se etter oppdateringer</value>
</data>

View File

@@ -914,9 +914,6 @@ Zie het Microsoft Support artikel op http://support.microsoft.com/kb/811833 voor
<data name="strMenuAddConnectionPanel" xml:space="preserve">
<value>Voeg Connectie Paneel toe</value>
</data>
<data name="strMenuAnnouncements" xml:space="preserve">
<value>Aankondigingen</value>
</data>
<data name="strMenuCheckForUpdates" xml:space="preserve">
<value>Controleer voor beschikbare Updates</value>
</data>

View File

@@ -834,9 +834,6 @@ Załadowano nowy plik połączeń.</value>
<data name="strMenuAddConnectionPanel" xml:space="preserve">
<value>Dodaj panel połączenia</value>
</data>
<data name="strMenuAnnouncements" xml:space="preserve">
<value>Powiadomienia</value>
</data>
<data name="strMenuCheckForUpdates" xml:space="preserve">
<value>Sprawdź aktualizacje</value>
</data>

View File

@@ -885,9 +885,6 @@ Descrição do erro: {1}</value>
<data name="strMenuAddConnectionPanel" xml:space="preserve">
<value>Adicionar o Painel de Ligação</value>
</data>
<data name="strMenuAnnouncements" xml:space="preserve">
<value>Anúncios</value>
</data>
<data name="strMenuCheckForUpdates" xml:space="preserve">
<value>Verificar se há atualizações</value>
</data>

View File

@@ -381,7 +381,7 @@ VncSharp Control Version {0}</value>
<value>Check Again</value>
</data>
<data name="strCheckForUpdatesOnStartup" xml:space="preserve">
<value>Check for updates and announcements at startup</value>
<value>Check for updates at startup</value>
</data>
<data name="strCheckNow" xml:space="preserve">
<value>Check now</value>
@@ -1024,9 +1024,6 @@ See the Microsoft Support article at http://support.microsoft.com/kb/811833 for
<data name="strMenuAddConnectionPanel" xml:space="preserve">
<value>Add Connection Panel</value>
</data>
<data name="strMenuAnnouncements" xml:space="preserve">
<value>Announcements</value>
</data>
<data name="strMenuCheckForUpdates" xml:space="preserve">
<value>Check for Updates</value>
</data>
@@ -2262,7 +2259,7 @@ Message:
<value>mRemoteNG requires an update</value>
</data>
<data name="strUpdateCheck" xml:space="preserve">
<value>mRemoteNG can periodically connect to the mRemoteNG website to check for updates and product announcements.</value>
<value>mRemoteNG can periodically connect to the mRemoteNG website to check for updates.</value>
</data>
<data name="strUpdateCheckCompleteFailed" xml:space="preserve">
<value>The update information could not be downloaded.</value>
@@ -2298,9 +2295,6 @@ mRemoteNG will now quit and begin with the installation.</value>
<data name="strUpdateFrequencyWeekly" xml:space="preserve">
<value>Weekly</value>
</data>
<data name="strUpdateGetAnnouncementInfoFailed" xml:space="preserve">
<value>The announcement information could not be downloaded.</value>
</data>
<data name="strUpdateGetChangeLogFailed" xml:space="preserve">
<value>The change log could not be downloaded.</value>
</data>

View File

@@ -920,9 +920,6 @@
<data name="strMenuAddConnectionPanel" xml:space="preserve">
<value>Добавить Панель подключения</value>
</data>
<data name="strMenuAnnouncements" xml:space="preserve">
<value>Сообщения</value>
</data>
<data name="strMenuCheckForUpdates" xml:space="preserve">
<value>Проверка наличия обновлений</value>
</data>

View File

@@ -890,9 +890,6 @@ VncSharp Control Version {0}</value>
<data name="strMenuAddConnectionPanel" xml:space="preserve">
<value>Додати Панель з'єднання</value>
</data>
<data name="strMenuAnnouncements" xml:space="preserve">
<value>Повідомлення</value>
</data>
<data name="strMenuCheckForUpdates" xml:space="preserve">
<value>Перевірка наявності оновлень</value>
</data>

View File

@@ -903,9 +903,6 @@ VncSharp 版本 {0}</value>
<data name="strMenuAddConnectionPanel" xml:space="preserve">
<value>添加连接面板</value>
</data>
<data name="strMenuAnnouncements" xml:space="preserve">
<value>公告</value>
</data>
<data name="strMenuCheckForUpdates" xml:space="preserve">
<value>检查更新</value>
</data>

View File

@@ -881,9 +881,6 @@ VncSharp Control 版本 {0}</value>
<data name="strMenuAddConnectionPanel" xml:space="preserve">
<value>加入連線面板</value>
</data>
<data name="strMenuAnnouncements" xml:space="preserve">
<value>發佈</value>
</data>
<data name="strMenuCheckForUpdates" xml:space="preserve">
<value>檢查更新</value>
</data>

View File

@@ -67,8 +67,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
this.lblUpdatesExplanation.Name = "lblUpdatesExplanation";
this.lblUpdatesExplanation.Size = new System.Drawing.Size(536, 40);
this.lblUpdatesExplanation.TabIndex = 3;
this.lblUpdatesExplanation.Text = "mRemoteNG can periodically connect to the mRemoteNG website to check for updates " +
"and product announcements.";
this.lblUpdatesExplanation.Text = "mRemoteNG can periodically connect to the mRemoteNG website to check for updates.";
//
//pnlUpdateCheck
//
@@ -96,7 +95,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
this.chkCheckForUpdatesOnStartup.Name = "chkCheckForUpdatesOnStartup";
this.chkCheckForUpdatesOnStartup.Size = new System.Drawing.Size(213, 17);
this.chkCheckForUpdatesOnStartup.TabIndex = 0;
this.chkCheckForUpdatesOnStartup.Text = "Check for updates and announcements";
this.chkCheckForUpdatesOnStartup.Text = "Check for updates";
this.chkCheckForUpdatesOnStartup.UseVisualStyleBackColor = true;
//
//cboUpdateCheckFrequency

View File

@@ -88,7 +88,6 @@ namespace mRemoteNG.UI.Forms
this.mMenInfoForum = new System.Windows.Forms.ToolStripMenuItem();
this.mMenInfoBugReport = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.mMenInfoAnnouncements = new System.Windows.Forms.ToolStripMenuItem();
this.mMenToolsUpdate = new System.Windows.Forms.ToolStripMenuItem();
this.mMenInfoSep2 = new System.Windows.Forms.ToolStripSeparator();
this.mMenInfoAbout = new System.Windows.Forms.ToolStripMenuItem();
@@ -143,10 +142,10 @@ namespace mRemoteNG.UI.Forms
this.mMenView,
this.mMenTools,
this.mMenInfo});
this.msMain.Location = new System.Drawing.Point(5, 0);
this.msMain.Location = new System.Drawing.Point(3, 0);
this.msMain.Name = "msMain";
this.msMain.Padding = new System.Windows.Forms.Padding(2, 2, 0, 2);
this.msMain.Size = new System.Drawing.Size(269, 24);
this.msMain.Size = new System.Drawing.Size(176, 24);
this.msMain.Stretch = false;
this.msMain.TabIndex = 16;
this.msMain.Text = "Main Toolbar";
@@ -363,7 +362,7 @@ namespace mRemoteNG.UI.Forms
//
this.mMenViewAddConnectionPanel.Image = global::mRemoteNG.Resources.Panel_Add;
this.mMenViewAddConnectionPanel.Name = "mMenViewAddConnectionPanel";
this.mMenViewAddConnectionPanel.Size = new System.Drawing.Size(228, 22);
this.mMenViewAddConnectionPanel.Size = new System.Drawing.Size(227, 22);
this.mMenViewAddConnectionPanel.Text = "Add Connection Panel";
this.mMenViewAddConnectionPanel.Click += new System.EventHandler(this.mMenViewAddConnectionPanel_Click);
//
@@ -371,13 +370,13 @@ namespace mRemoteNG.UI.Forms
//
this.mMenViewConnectionPanels.Image = global::mRemoteNG.Resources.Panels;
this.mMenViewConnectionPanels.Name = "mMenViewConnectionPanels";
this.mMenViewConnectionPanels.Size = new System.Drawing.Size(228, 22);
this.mMenViewConnectionPanels.Size = new System.Drawing.Size(227, 22);
this.mMenViewConnectionPanels.Text = "Connection Panels";
//
// mMenViewSep1
//
this.mMenViewSep1.Name = "mMenViewSep1";
this.mMenViewSep1.Size = new System.Drawing.Size(225, 6);
this.mMenViewSep1.Size = new System.Drawing.Size(224, 6);
//
// mMenViewConnections
//
@@ -385,7 +384,7 @@ namespace mRemoteNG.UI.Forms
this.mMenViewConnections.CheckState = System.Windows.Forms.CheckState.Checked;
this.mMenViewConnections.Image = global::mRemoteNG.Resources.Root;
this.mMenViewConnections.Name = "mMenViewConnections";
this.mMenViewConnections.Size = new System.Drawing.Size(228, 22);
this.mMenViewConnections.Size = new System.Drawing.Size(227, 22);
this.mMenViewConnections.Text = "Connections";
this.mMenViewConnections.Click += new System.EventHandler(this.mMenViewConnections_Click);
//
@@ -395,7 +394,7 @@ namespace mRemoteNG.UI.Forms
this.mMenViewConfig.CheckState = System.Windows.Forms.CheckState.Checked;
this.mMenViewConfig.Image = global::mRemoteNG.Resources.cog;
this.mMenViewConfig.Name = "mMenViewConfig";
this.mMenViewConfig.Size = new System.Drawing.Size(228, 22);
this.mMenViewConfig.Size = new System.Drawing.Size(227, 22);
this.mMenViewConfig.Text = "Config";
this.mMenViewConfig.Click += new System.EventHandler(this.mMenViewConfig_Click);
//
@@ -405,7 +404,7 @@ namespace mRemoteNG.UI.Forms
this.mMenViewErrorsAndInfos.CheckState = System.Windows.Forms.CheckState.Checked;
this.mMenViewErrorsAndInfos.Image = global::mRemoteNG.Resources.ErrorsAndInfos;
this.mMenViewErrorsAndInfos.Name = "mMenViewErrorsAndInfos";
this.mMenViewErrorsAndInfos.Size = new System.Drawing.Size(228, 22);
this.mMenViewErrorsAndInfos.Size = new System.Drawing.Size(227, 22);
this.mMenViewErrorsAndInfos.Text = "Errors and Infos";
this.mMenViewErrorsAndInfos.Click += new System.EventHandler(this.mMenViewErrorsAndInfos_Click);
//
@@ -413,14 +412,14 @@ namespace mRemoteNG.UI.Forms
//
this.mMenViewScreenshotManager.Image = ((System.Drawing.Image)(resources.GetObject("mMenViewScreenshotManager.Image")));
this.mMenViewScreenshotManager.Name = "mMenViewScreenshotManager";
this.mMenViewScreenshotManager.Size = new System.Drawing.Size(228, 22);
this.mMenViewScreenshotManager.Size = new System.Drawing.Size(227, 22);
this.mMenViewScreenshotManager.Text = "Screenshot Manager";
this.mMenViewScreenshotManager.Click += new System.EventHandler(this.mMenViewScreenshotManager_Click);
//
// ToolStripSeparator1
//
this.ToolStripSeparator1.Name = "ToolStripSeparator1";
this.ToolStripSeparator1.Size = new System.Drawing.Size(225, 6);
this.ToolStripSeparator1.Size = new System.Drawing.Size(224, 6);
//
// mMenViewJumpTo
//
@@ -429,7 +428,7 @@ namespace mRemoteNG.UI.Forms
this.mMenViewJumpToErrorsInfos});
this.mMenViewJumpTo.Image = global::mRemoteNG.Resources.JumpTo;
this.mMenViewJumpTo.Name = "mMenViewJumpTo";
this.mMenViewJumpTo.Size = new System.Drawing.Size(228, 22);
this.mMenViewJumpTo.Size = new System.Drawing.Size(227, 22);
this.mMenViewJumpTo.Text = "Jump To";
//
// mMenViewJumpToConnectionsConfig
@@ -456,20 +455,20 @@ namespace mRemoteNG.UI.Forms
//
this.mMenViewResetLayout.Image = global::mRemoteNG.Resources.application_side_tree;
this.mMenViewResetLayout.Name = "mMenViewResetLayout";
this.mMenViewResetLayout.Size = new System.Drawing.Size(228, 22);
this.mMenViewResetLayout.Size = new System.Drawing.Size(227, 22);
this.mMenViewResetLayout.Text = "Reset Layout";
this.mMenViewResetLayout.Click += new System.EventHandler(this.mMenViewResetLayout_Click);
//
// mMenViewSep2
//
this.mMenViewSep2.Name = "mMenViewSep2";
this.mMenViewSep2.Size = new System.Drawing.Size(225, 6);
this.mMenViewSep2.Size = new System.Drawing.Size(224, 6);
//
// mMenViewQuickConnectToolbar
//
this.mMenViewQuickConnectToolbar.Image = global::mRemoteNG.Resources.Play_Quick;
this.mMenViewQuickConnectToolbar.Name = "mMenViewQuickConnectToolbar";
this.mMenViewQuickConnectToolbar.Size = new System.Drawing.Size(228, 22);
this.mMenViewQuickConnectToolbar.Size = new System.Drawing.Size(227, 22);
this.mMenViewQuickConnectToolbar.Text = "Quick Connect Toolbar";
this.mMenViewQuickConnectToolbar.Click += new System.EventHandler(this.mMenViewQuickConnectToolbar_Click);
//
@@ -477,21 +476,21 @@ namespace mRemoteNG.UI.Forms
//
this.mMenViewExtAppsToolbar.Image = global::mRemoteNG.Resources.ExtApp;
this.mMenViewExtAppsToolbar.Name = "mMenViewExtAppsToolbar";
this.mMenViewExtAppsToolbar.Size = new System.Drawing.Size(228, 22);
this.mMenViewExtAppsToolbar.Size = new System.Drawing.Size(227, 22);
this.mMenViewExtAppsToolbar.Text = "External Applications Toolbar";
this.mMenViewExtAppsToolbar.Click += new System.EventHandler(this.mMenViewExtAppsToolbar_Click);
//
// mMenViewSep3
//
this.mMenViewSep3.Name = "mMenViewSep3";
this.mMenViewSep3.Size = new System.Drawing.Size(225, 6);
this.mMenViewSep3.Size = new System.Drawing.Size(224, 6);
//
// mMenViewFullscreen
//
this.mMenViewFullscreen.Image = global::mRemoteNG.Resources.arrow_out;
this.mMenViewFullscreen.Name = "mMenViewFullscreen";
this.mMenViewFullscreen.ShortcutKeys = System.Windows.Forms.Keys.F11;
this.mMenViewFullscreen.Size = new System.Drawing.Size(228, 22);
this.mMenViewFullscreen.Size = new System.Drawing.Size(227, 22);
this.mMenViewFullscreen.Text = "Full Screen";
this.mMenViewFullscreen.Click += new System.EventHandler(this.mMenViewFullscreen_Click);
//
@@ -506,7 +505,7 @@ namespace mRemoteNG.UI.Forms
this.mMenToolsComponentsCheck,
this.mMenToolsOptions});
this.mMenTools.Name = "mMenTools";
this.mMenTools.Size = new System.Drawing.Size(48, 20);
this.mMenTools.Size = new System.Drawing.Size(47, 20);
this.mMenTools.Text = "&Tools";
//
// mMenToolsSSHTransfer
@@ -573,7 +572,6 @@ namespace mRemoteNG.UI.Forms
this.mMenInfoForum,
this.mMenInfoBugReport,
this.ToolStripSeparator2,
this.mMenInfoAnnouncements,
this.mMenToolsUpdate,
this.mMenInfoSep2,
this.mMenInfoAbout});
@@ -633,14 +631,6 @@ namespace mRemoteNG.UI.Forms
this.ToolStripSeparator2.Name = "ToolStripSeparator2";
this.ToolStripSeparator2.Size = new System.Drawing.Size(187, 6);
//
// mMenInfoAnnouncements
//
this.mMenInfoAnnouncements.Image = global::mRemoteNG.Resources.News;
this.mMenInfoAnnouncements.Name = "mMenInfoAnnouncements";
this.mMenInfoAnnouncements.Size = new System.Drawing.Size(190, 22);
this.mMenInfoAnnouncements.Text = "Announcements";
this.mMenInfoAnnouncements.Click += new System.EventHandler(this.mMenInfoAnnouncements_Click);
//
// mMenToolsUpdate
//
this.mMenToolsUpdate.Image = global::mRemoteNG.Resources.Update;
@@ -700,9 +690,9 @@ namespace mRemoteNG.UI.Forms
//
// tsContainer.TopToolStripPanel
//
this.tsContainer.TopToolStripPanel.Controls.Add(this.msMain);
this.tsContainer.TopToolStripPanel.Controls.Add(this.tsQuickConnect);
this.tsContainer.TopToolStripPanel.Controls.Add(this.tsExternalTools);
this.tsContainer.TopToolStripPanel.Controls.Add(this.msMain);
this.tsContainer.TopToolStripPanel.Controls.Add(this.ToolStrip1);
//
// tsQuickConnect
@@ -713,7 +703,7 @@ namespace mRemoteNG.UI.Forms
this.cmbQuickConnect,
this.btnQuickConnect,
this.btnConnections});
this.tsQuickConnect.Location = new System.Drawing.Point(274, 0);
this.tsQuickConnect.Location = new System.Drawing.Point(179, 0);
this.tsQuickConnect.MaximumSize = new System.Drawing.Size(0, 25);
this.tsQuickConnect.Name = "tsQuickConnect";
this.tsQuickConnect.Size = new System.Drawing.Size(387, 25);
@@ -772,14 +762,14 @@ namespace mRemoteNG.UI.Forms
this.cMenExtAppsToolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.cMenToolbarShowText});
this.cMenExtAppsToolbar.Name = "cMenToolbar";
this.cMenExtAppsToolbar.Size = new System.Drawing.Size(129, 26);
this.cMenExtAppsToolbar.Size = new System.Drawing.Size(128, 26);
//
// cMenToolbarShowText
//
this.cMenToolbarShowText.Checked = true;
this.cMenToolbarShowText.CheckState = System.Windows.Forms.CheckState.Checked;
this.cMenToolbarShowText.Name = "cMenToolbarShowText";
this.cMenToolbarShowText.Size = new System.Drawing.Size(128, 22);
this.cMenToolbarShowText.Size = new System.Drawing.Size(127, 22);
this.cMenToolbarShowText.Text = "Show Text";
this.cMenToolbarShowText.Click += new System.EventHandler(this.cMenToolbarShowText_Click);
//
@@ -933,7 +923,6 @@ namespace mRemoteNG.UI.Forms
internal System.Windows.Forms.ToolStripSeparator ToolStripSeparator1;
internal System.Windows.Forms.ToolStripMenuItem mMenToolsUVNCSC;
internal System.Windows.Forms.ToolStripMenuItem mMenToolsComponentsCheck;
internal System.Windows.Forms.ToolStripMenuItem mMenInfoAnnouncements;
internal System.Windows.Forms.ToolStripSeparator mMenInfoSep2;
internal System.Windows.Forms.ToolStripMenuItem mMenInfoBugReport;
internal System.Windows.Forms.ToolStripSeparator ToolStripSeparator2;

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;
@@ -176,7 +177,6 @@ namespace mRemoteNG.UI.Forms
private void ApplySpecialSettingsForPortableVersion()
{
#if PORTABLE
mMenInfoAnnouncements.Visible = false;
mMenToolsUpdate.Visible = false;
mMenInfoSep2.Visible = false;
#endif
@@ -228,7 +228,6 @@ namespace mRemoteNG.UI.Forms
mMenInfoDonate.Text = Language.strMenuDonate;
mMenInfoWebsite.Text = Language.strMenuWebsite;
mMenInfoAbout.Text = Language.strMenuAbout;
mMenInfoAnnouncements.Text = Language.strMenuAnnouncements;
lblQuickConnect.Text = Language.strLabelConnect;
btnQuickConnect.Text = Language.strMenuConnect;
@@ -285,42 +284,46 @@ 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
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) return;
using (var optionsForm = new frmOptions(Language.strTabUpdates))
{
optionsForm.ShowDialog(this);
}
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();
#endif
}
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
{
@@ -952,11 +955,6 @@ namespace mRemoteNG.UI.Forms
Runtime.GoToDonate();
}
private void mMenInfoAnnouncements_Click(object sender, EventArgs e)
{
Windows.Show(WindowType.Announcement);
}
private void mMenInfoAbout_Click(object sender, EventArgs e)
{
Windows.Show(WindowType.About);
@@ -973,20 +971,19 @@ namespace mRemoteNG.UI.Forms
MouseUpEventHandler = ConnectionsMenuItem_MouseUp
};
// ReSharper disable once CoVariantArrayConversion
ToolStripItem[] rootMenuItems = menuItemsConverter.CreateToolStripDropDownItems(Runtime.ConnectionTreeModel).ToArray();
btnConnections.DropDownItems.AddRange(rootMenuItems);
}
private static void ConnectionsMenuItem_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
var tag = ((ToolStripMenuItem)sender).Tag as ConnectionInfo;
if (tag != null)
{
ConnectionInitiator.OpenConnection(tag);
}
}
if (e.Button != MouseButtons.Left) return;
var tag = ((ToolStripMenuItem)sender).Tag as ConnectionInfo;
if (tag != null)
{
ConnectionInitiator.OpenConnection(tag);
}
}
#endregion

View File

@@ -12,10 +12,18 @@ namespace mRemoteNG.UI.Forms
{
private Dictionary<string, OptionsPage> _pages;
private ImageList _pageIconImageList;
private readonly string pageName;
public frmOptions()
{
InitializeComponent();
pageName = Language.strStartupExit;
}
public frmOptions(string pn)
{
InitializeComponent();
pageName = pn;
}
private void frmOptions_Load(object sender, EventArgs e)
@@ -72,7 +80,17 @@ namespace mRemoteNG.UI.Forms
private void SetInitiallyActivatedPage()
{
lstOptionPages.Items[0].Selected = true;
bool isSet = false;
for (int i = 0; i < lstOptionPages.Items.Count; i++)
{
if (!lstOptionPages.Items[i].Text.Equals(pageName)) continue;
lstOptionPages.Items[i].Selected = true;
isSet = true;
break;
}
if(!isSet)
lstOptionPages.Items[0].Selected = true;
}
private void btnOK_Click(object sender, EventArgs e)

View File

@@ -6,7 +6,7 @@ using System.Windows.Forms;
namespace mRemoteNG.UI.TaskDialog
{
public partial class CommandButton : Button
public sealed partial class CommandButton : Button
{
//--------------------------------------------------------------------------------
#region PRIVATE MEMBERS
@@ -40,10 +40,9 @@ namespace mRemoteNG.UI.TaskDialog
}
// SmallFont is the font used for secondary lines
Font m_smallFont;
public Font SmallFont { get { return m_smallFont; } set { m_smallFont = value; } }
private Font SmallFont { get; set; }
// AutoHeight determines whether the button automatically resizes itself to fit the Text
// AutoHeight determines whether the button automatically resizes itself to fit the Text
bool m_autoHeight = true;
[Browsable(true)]
[Category("Behavior")]
@@ -59,7 +58,7 @@ namespace mRemoteNG.UI.TaskDialog
{
InitializeComponent();
Font = new Font("Segoe UI", 11.75F, FontStyle.Regular, GraphicsUnit.Point, 0);
m_smallFont = new Font("Segoe UI", 8F, FontStyle.Regular, GraphicsUnit.Point, 0);
SmallFont = new Font("Segoe UI", 8F, FontStyle.Regular, GraphicsUnit.Point, 0);
}
#endregion
@@ -78,7 +77,7 @@ namespace mRemoteNG.UI.TaskDialog
//--------------------------------------------------------------------------------
string GetLargeText()
{
string[] lines = Text.Split(new char[] { '\n' });
string[] lines = Text.Split('\n');
return lines[0];
}
@@ -88,11 +87,11 @@ namespace mRemoteNG.UI.TaskDialog
return "";
string s = Text;
string[] lines = s.Split(new char[] { '\n' });
string[] lines = s.Split('\n');
s = "";
for (int i = 1; i < lines.Length; i++)
s += lines[i] + "\n";
return s.Trim(new char[] { '\n' });
return s.Trim('\n');
}
SizeF GetLargeTextSizeF()
@@ -111,7 +110,7 @@ namespace mRemoteNG.UI.TaskDialog
int x = LEFT_MARGIN + ARROW_WIDTH + 8; // <- indent small text slightly more
SizeF mzSize = new SizeF(Width - x - LEFT_MARGIN, 5000.0F); // presume RIGHT_MARGIN = LEFT_MARGIN
Graphics g = Graphics.FromHwnd(Handle);
SizeF textSize = g.MeasureString(s, m_smallFont, mzSize);
SizeF textSize = g.MeasureString(s, SmallFont, mzSize);
return textSize;
}
#endregion
@@ -145,16 +144,13 @@ namespace mRemoteNG.UI.TaskDialog
switch (m_State)
{
case eButtonState.Normal:
e.Graphics.FillRectangle(Brushes.White, newRect);
if (Focused)
e.Graphics.DrawRectangle(new Pen(Color.SkyBlue, 1), newRect);
else
e.Graphics.DrawRectangle(new Pen(Color.White, 1), newRect);
text_color = Color.DarkBlue;
e.Graphics.FillRectangle(SystemBrushes.Control, newRect);
e.Graphics.DrawRectangle(Focused ? new Pen(Color.Silver, 1) : new Pen(SystemColors.Control, 1), newRect);
text_color = Color.DarkBlue;
break;
case eButtonState.MouseOver:
brush = new LinearGradientBrush(newRect, Color.White, Color.WhiteSmoke, mode);
brush = new LinearGradientBrush(newRect, SystemColors.Control, SystemColors.Control, mode);
e.Graphics.FillRectangle(brush, newRect);
e.Graphics.DrawRectangle(new Pen(Color.Silver, 1), newRect);
img = imgArrow2;
@@ -162,7 +158,7 @@ namespace mRemoteNG.UI.TaskDialog
break;
case eButtonState.Down:
brush = new LinearGradientBrush(newRect, Color.WhiteSmoke, Color.White, mode);
brush = new LinearGradientBrush(newRect, SystemColors.Control, SystemColors.Control, mode);
e.Graphics.FillRectangle(brush, newRect);
e.Graphics.DrawRectangle(new Pen(Color.DarkGray, 1), newRect);
text_color = Color.DarkBlue;
@@ -171,7 +167,7 @@ namespace mRemoteNG.UI.TaskDialog
}
else
{
brush = new LinearGradientBrush(newRect, Color.WhiteSmoke, Color.Gainsboro, mode);
brush = new LinearGradientBrush(newRect, SystemColors.Control, SystemColors.Control, mode);
e.Graphics.FillRectangle(brush, newRect);
e.Graphics.DrawRectangle(new Pen(Color.DarkGray, 1), newRect);
text_color = Color.DarkBlue;
@@ -187,7 +183,7 @@ namespace mRemoteNG.UI.TaskDialog
if (smalltext != "")
{
SizeF szS = GetSmallTextSizeF();
e.Graphics.DrawString(smalltext, m_smallFont, new SolidBrush(text_color), new RectangleF(new PointF(LEFT_MARGIN + imgArrow1.Width + 8, TOP_MARGIN + (int)szL.Height), szS));
e.Graphics.DrawString(smalltext, SmallFont, new SolidBrush(text_color), new RectangleF(new PointF(LEFT_MARGIN + imgArrow1.Width + 8, TOP_MARGIN + (int)szL.Height), szS));
}
e.Graphics.DrawImage(img, new Point(LEFT_MARGIN, TOP_MARGIN + (int)(szL.Height / 2) - img.Height / 2));

View File

@@ -1,6 +1,6 @@
namespace mRemoteNG.UI.TaskDialog
{
partial class CommandButton
sealed partial class CommandButton
{
/// <summary>
/// Required designer variable.

View File

@@ -1,41 +0,0 @@
using mRemoteNG.My;
namespace mRemoteNG.UI.Window
{
public partial class AnnouncementWindow
{
#region Windows Form Designer generated code
internal System.Windows.Forms.WebBrowser webBrowser;
private void InitializeComponent()
{
this.webBrowser = new System.Windows.Forms.WebBrowser();
this.Load += new System.EventHandler(Announcement_Load);
this.SuspendLayout();
//
//webBrowser
//
this.webBrowser.Dock = System.Windows.Forms.DockStyle.Fill;
this.webBrowser.Location = new System.Drawing.Point(0, 0);
this.webBrowser.MinimumSize = new System.Drawing.Size(20, 20);
this.webBrowser.Name = "webBrowser";
this.webBrowser.Size = new System.Drawing.Size(549, 474);
this.webBrowser.TabIndex = 0;
//
//Announcement
//
this.ClientSize = new System.Drawing.Size(549, 474);
this.Controls.Add(this.webBrowser);
this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, System.Convert.ToByte(0));
this.Icon = Resources.News_Icon;
this.Name = "Announcement";
this.TabText = "Announcement";
this.Text = "Announcement";
this.ResumeLayout(false);
}
#endregion
}
}

View File

@@ -1,95 +0,0 @@
using System;
using System.ComponentModel;
using WeifenLuo.WinFormsUI.Docking;
using mRemoteNG.App;
using mRemoteNG.App.Update;
namespace mRemoteNG.UI.Window
{
public partial class AnnouncementWindow : BaseWindow
{
#region Public Methods
public AnnouncementWindow(DockContent panel)
{
WindowType = WindowType.Announcement;
DockPnl = panel;
InitializeComponent();
}
#endregion
#region Private Fields
private AppUpdater _appUpdate;
#endregion
#region Private Methods
public void Announcement_Load(object sender, EventArgs e)
{
webBrowser.Navigated += webBrowser_Navigated;
ApplyLanguage();
CheckForAnnouncement();
}
private void ApplyLanguage()
{
}
private void webBrowser_Navigated(object sender, System.Windows.Forms.WebBrowserNavigatedEventArgs e)
{
// This can only be set once the WebBrowser control is shown, it will throw a COM exception otherwise.
webBrowser.AllowWebBrowserDrop = false;
webBrowser.Navigated -= webBrowser_Navigated;
}
private void CheckForAnnouncement()
{
if (_appUpdate == null)
{
_appUpdate = new AppUpdater();
//_appUpdate.Load += _appUpdate.Update_Load;
}
else if (_appUpdate.IsGetAnnouncementInfoRunning)
{
return ;
}
_appUpdate.GetAnnouncementInfoCompletedEvent += GetAnnouncementInfoCompleted;
_appUpdate.GetAnnouncementInfoAsync();
}
private void GetAnnouncementInfoCompleted(object sender, AsyncCompletedEventArgs e)
{
if (InvokeRequired)
{
AsyncCompletedEventHandler myDelegate = new AsyncCompletedEventHandler(GetAnnouncementInfoCompleted);
Invoke(myDelegate, new object[] {sender, e});
return ;
}
try
{
_appUpdate.GetAnnouncementInfoCompletedEvent -= GetAnnouncementInfoCompleted;
if (e.Cancelled)
{
return ;
}
if (e.Error != null)
{
throw (e.Error);
}
webBrowser.Navigate(_appUpdate.CurrentAnnouncementInfo.Address);
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage(Language.strUpdateGetAnnouncementInfoFailed, ex);
}
}
#endregion
}
}

View File

@@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -42,18 +42,18 @@ namespace mRemoteNG.UI.Window
lblLatestVersion.Text = Language.strVersion;
lblLatestVersionLabel.Text = $"{Language.strAvailableVersion}:";
}
public void btnCheckForUpdate_Click(Object sender, EventArgs e)
private void btnCheckForUpdate_Click(object sender, EventArgs e)
{
CheckForUpdate();
}
public void btnDownload_Click(Object sender, EventArgs e)
private void btnDownload_Click(object sender, EventArgs e)
{
DownloadUpdate();
}
public void pbUpdateImage_Click(Object sender, EventArgs e)
private void pbUpdateImage_Click(object sender, EventArgs e)
{
Uri linkUri = pbUpdateImage.Tag as Uri;
if (linkUri == null || linkUri.IsFile || linkUri.IsUnc || linkUri.IsLoopback)

View File

@@ -1,11 +1,10 @@
namespace mRemoteNG.UI.Window
namespace mRemoteNG.UI
{
public enum WindowType
{
Tree = 0,
Connection = 1,
Config = 2,
Sessions = 3,
ErrorsAndInfos = 4,
ScreenshotManager = 5,
Options = 6,
@@ -18,6 +17,5 @@ namespace mRemoteNG.UI.Window
PortScan = 14,
UltraVNCSC = 16,
ComponentsCheck = 17,
Announcement = 18
}
}

View File

@@ -451,9 +451,6 @@
<setting name="InhDefaultExtApp" serializeAs="String">
<value>False</value>
</setting>
<setting name="LastAnnouncement" serializeAs="String">
<value />
</setting>
<setting name="CheckForUpdatesAsked" serializeAs="String">
<value>False</value>
</setting>
@@ -605,9 +602,6 @@
<setting name="UpdateChannel" serializeAs="String">
<value>release</value>
</setting>
<setting name="AnnouncementAddress" serializeAs="String">
<value>https://update.mremoteng.org/announcement.txt</value>
</setting>
<setting name="UpdateAddress" serializeAs="String">
<value>https://update.mremoteng.org/</value>
</setting>

View File

@@ -116,7 +116,6 @@
<Compile Include="App\Shutdown.cs" />
<Compile Include="App\Startup.cs" />
<Compile Include="App\SupportedCultures.cs" />
<Compile Include="App\Update\AnnouncementInfo.cs" />
<Compile Include="App\Update\AppUpdater.cs" />
<Compile Include="App\Export.cs" />
<Compile Include="App\Import.cs" />
@@ -418,12 +417,6 @@
<Compile Include="UI\Window\ActiveDirectoryImportWindow.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Window\AnnouncementWindow.Designer.cs">
<DependentUpon>AnnouncementWindow.cs</DependentUpon>
</Compile>
<Compile Include="UI\Window\AnnouncementWindow.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\Window\BaseWindow.cs">
<SubType>Form</SubType>
</Compile>
@@ -613,10 +606,6 @@
<DependentUpon>ActiveDirectoryImportWindow.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="UI\Window\AnnouncementWindow.resx">
<DependentUpon>AnnouncementWindow.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="UI\Window\ComponentsCheckWindow.resx">
<DependentUpon>ComponentsCheckWindow.cs</DependentUpon>
<SubType>Designer</SubType>
@@ -992,7 +981,6 @@
<None Include="Resources\Icons\ComponentsCheck_Icon.ico" />
<None Include="Resources\Icons_FamFamFam\News_Icon.ico" />
<None Include="Resources\Images_FamFamFam\News.png" />
<None Include="Resources\Announcement\mRemote_Announcement.txt" />
<None Include="Resources\Update\mRemote_Update.txt" />
<Content Include="Resources\Help\Main.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>