diff --git a/mRemoteV1/App/Startup.cs b/mRemoteV1/App/Startup.cs index 0f2ec796..51349de2 100644 --- a/mRemoteV1/App/Startup.cs +++ b/mRemoteV1/App/Startup.cs @@ -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() { diff --git a/mRemoteV1/App/Update/AnnouncementInfo.cs b/mRemoteV1/App/Update/AnnouncementInfo.cs deleted file mode 100644 index 4f07eb09..00000000 --- a/mRemoteV1/App/Update/AnnouncementInfo.cs +++ /dev/null @@ -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 - } -} \ No newline at end of file diff --git a/mRemoteV1/App/Update/AppUpdater.cs b/mRemoteV1/App/Update/AppUpdater.cs index 89e20874..449a960f 100644 --- a/mRemoteV1/App/Update/AppUpdater.cs +++ b/mRemoteV1/App/Update/AppUpdater.cs @@ -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 diff --git a/mRemoteV1/App/Update/UpdateFile.cs b/mRemoteV1/App/Update/UpdateFile.cs index 24a36f4e..cabb8742 100644 --- a/mRemoteV1/App/Update/UpdateFile.cs +++ b/mRemoteV1/App/Update/UpdateFile.cs @@ -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]; diff --git a/mRemoteV1/App/Update/UpdateInfo.cs b/mRemoteV1/App/Update/UpdateInfo.cs index 86b40e39..b9b70c8b 100644 --- a/mRemoteV1/App/Update/UpdateInfo.cs +++ b/mRemoteV1/App/Update/UpdateInfo.cs @@ -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"); diff --git a/mRemoteV1/App/Windows.cs b/mRemoteV1/App/Windows.cs index 98934b96..f14a0b43 100644 --- a/mRemoteV1/App/Windows.cs +++ b/mRemoteV1/App/Windows.cs @@ -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) { diff --git a/mRemoteV1/Config/Settings/LayoutSettingsLoader.cs b/mRemoteV1/Config/Settings/LayoutSettingsLoader.cs index 07afc4b3..027cfb89 100644 --- a/mRemoteV1/Config/Settings/LayoutSettingsLoader.cs +++ b/mRemoteV1/Config/Settings/LayoutSettingsLoader.cs @@ -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; } } } \ No newline at end of file diff --git a/mRemoteV1/Properties/Settings.Designer.cs b/mRemoteV1/Properties/Settings.Designer.cs index aecfe5cd..89610d59 100644 --- a/mRemoteV1/Properties/Settings.Designer.cs +++ b/mRemoteV1/Properties/Settings.Designer.cs @@ -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/")] diff --git a/mRemoteV1/Properties/Settings.settings b/mRemoteV1/Properties/Settings.settings index 8f105565..8a76e0c7 100644 --- a/mRemoteV1/Properties/Settings.settings +++ b/mRemoteV1/Properties/Settings.settings @@ -419,9 +419,6 @@ False - - - False @@ -542,9 +539,6 @@ True - - https://update.mremoteng.org/announcement.txt - https://update.mremoteng.org/ diff --git a/mRemoteV1/Resources/Announcement/mRemote_Announcement.txt b/mRemoteV1/Resources/Announcement/mRemote_Announcement.txt deleted file mode 100644 index 7def5600..00000000 --- a/mRemoteV1/Resources/Announcement/mRemote_Announcement.txt +++ /dev/null @@ -1,2 +0,0 @@ -Name: mRemote goes Commercial -URL: http://mremote.org/wiki/Commercial.ashx diff --git a/mRemoteV1/Resources/Language/Language.Designer.cs b/mRemoteV1/Resources/Language/Language.Designer.cs index 343fd864..8b99aba7 100644 --- a/mRemoteV1/Resources/Language/Language.Designer.cs +++ b/mRemoteV1/Resources/Language/Language.Designer.cs @@ -815,7 +815,7 @@ namespace mRemoteNG { } /// - /// 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. /// internal static string strCheckForUpdatesOnStartup { get { @@ -2748,15 +2748,6 @@ namespace mRemoteNG { } } - /// - /// Looks up a localized string similar to Announcements. - /// - internal static string strMenuAnnouncements { - get { - return ResourceManager.GetString("strMenuAnnouncements", resourceCulture); - } - } - /// /// Looks up a localized string similar to Check for Updates. /// @@ -6515,7 +6506,7 @@ namespace mRemoteNG { } /// - /// 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.. /// internal static string strUpdateCheck { get { @@ -6623,15 +6614,6 @@ namespace mRemoteNG { } } - /// - /// Looks up a localized string similar to The announcement information could not be downloaded.. - /// - internal static string strUpdateGetAnnouncementInfoFailed { - get { - return ResourceManager.GetString("strUpdateGetAnnouncementInfoFailed", resourceCulture); - } - } - /// /// Looks up a localized string similar to The change log could not be downloaded.. /// diff --git a/mRemoteV1/Resources/Language/Language.de.resx b/mRemoteV1/Resources/Language/Language.de.resx index f4dbdbcb..01872233 100644 --- a/mRemoteV1/Resources/Language/Language.de.resx +++ b/mRemoteV1/Resources/Language/Language.de.resx @@ -915,9 +915,6 @@ Starte mit neuer Datei. Verbindungs-Panel hinzufügen - - Ankündigungen - Suche nach Updates diff --git a/mRemoteV1/Resources/Language/Language.es.resx b/mRemoteV1/Resources/Language/Language.es.resx index 7cf79700..f8770749 100644 --- a/mRemoteV1/Resources/Language/Language.es.resx +++ b/mRemoteV1/Resources/Language/Language.es.resx @@ -904,9 +904,6 @@ Ver el articulo de soporte de Microsoft en http://support.microsoft.com/kb/81183 Agregar Panel de Conexión - - Novedades - Comprobar Actualizaciones diff --git a/mRemoteV1/Resources/Language/Language.fr.resx b/mRemoteV1/Resources/Language/Language.fr.resx index b8831443..e85da57e 100644 --- a/mRemoteV1/Resources/Language/Language.fr.resx +++ b/mRemoteV1/Resources/Language/Language.fr.resx @@ -896,9 +896,6 @@ Consultez l'article du support de Microsoft pour plus d'informations http://supp Ajouter un panneau de connexion - - Annonces - Rechercher des mises à jour diff --git a/mRemoteV1/Resources/Language/Language.it.resx b/mRemoteV1/Resources/Language/Language.it.resx index fca01f9c..bf56b0b5 100644 --- a/mRemoteV1/Resources/Language/Language.it.resx +++ b/mRemoteV1/Resources/Language/Language.it.resx @@ -899,9 +899,6 @@ Visualizza il supporto Microsoft http://support.microsoft.com/kb/811833/it per o Aggiungi pannello delle connessioni - - Segnalazioni - Verifica la presenza di aggiornamenti diff --git a/mRemoteV1/Resources/Language/Language.ja-JP.resx b/mRemoteV1/Resources/Language/Language.ja-JP.resx index 3ec84b77..69086f58 100644 --- a/mRemoteV1/Resources/Language/Language.ja-JP.resx +++ b/mRemoteV1/Resources/Language/Language.ja-JP.resx @@ -385,7 +385,7 @@ VncSharp Control Version {0} もう一度点検する - Check for updates and announcements at startup + Check for updates at startup 点検する @@ -1037,9 +1037,6 @@ See the Microsoft Support article at http://support.microsoft.com/kb/811833 for 接続表示パネルの追加 - - お知らせ - 最新バージョンをチェック @@ -2291,7 +2288,7 @@ Message: mRemoteNG requires an update - mRemoteNG can periodically connect to the mRemoteNG website to check for updates and product announcements. + mRemoteNG can periodically connect to the mRemoteNG website to check for updates. The update information could not be downloaded. @@ -2327,9 +2324,6 @@ mRemoteNGを終了してインストールを開始します 毎週 - - The announcement information could not be downloaded. - The change log could not be downloaded. diff --git a/mRemoteV1/Resources/Language/Language.nb-NO.resx b/mRemoteV1/Resources/Language/Language.nb-NO.resx index 974db56c..559326d2 100644 --- a/mRemoteV1/Resources/Language/Language.nb-NO.resx +++ b/mRemoteV1/Resources/Language/Language.nb-NO.resx @@ -914,9 +914,6 @@ Se Microsoft Support-artikkelen på http://support.microsoft.com/kb/811833 for m Legg til tilkoblingspanel - - Kunngjøringer - Se etter oppdateringer diff --git a/mRemoteV1/Resources/Language/Language.nl.resx b/mRemoteV1/Resources/Language/Language.nl.resx index ff1a3e9b..8ee9553d 100644 --- a/mRemoteV1/Resources/Language/Language.nl.resx +++ b/mRemoteV1/Resources/Language/Language.nl.resx @@ -914,9 +914,6 @@ Zie het Microsoft Support artikel op http://support.microsoft.com/kb/811833 voor Voeg Connectie Paneel toe - - Aankondigingen - Controleer voor beschikbare Updates diff --git a/mRemoteV1/Resources/Language/Language.pl.resx b/mRemoteV1/Resources/Language/Language.pl.resx index b3bfbb29..e8a754aa 100644 --- a/mRemoteV1/Resources/Language/Language.pl.resx +++ b/mRemoteV1/Resources/Language/Language.pl.resx @@ -834,9 +834,6 @@ Załadowano nowy plik połączeń. Dodaj panel połączenia - - Powiadomienia - Sprawdź aktualizacje diff --git a/mRemoteV1/Resources/Language/Language.pt.resx b/mRemoteV1/Resources/Language/Language.pt.resx index 7aae1846..ab4cba62 100644 --- a/mRemoteV1/Resources/Language/Language.pt.resx +++ b/mRemoteV1/Resources/Language/Language.pt.resx @@ -885,9 +885,6 @@ Descrição do erro: {1} Adicionar o Painel de Ligação - - Anúncios - Verificar se há atualizações diff --git a/mRemoteV1/Resources/Language/Language.resx b/mRemoteV1/Resources/Language/Language.resx index f2216422..e3ccfbfd 100644 --- a/mRemoteV1/Resources/Language/Language.resx +++ b/mRemoteV1/Resources/Language/Language.resx @@ -381,7 +381,7 @@ VncSharp Control Version {0} Check Again - Check for updates and announcements at startup + Check for updates at startup Check now @@ -1024,9 +1024,6 @@ See the Microsoft Support article at http://support.microsoft.com/kb/811833 for Add Connection Panel - - Announcements - Check for Updates @@ -2262,7 +2259,7 @@ Message: mRemoteNG requires an update - mRemoteNG can periodically connect to the mRemoteNG website to check for updates and product announcements. + mRemoteNG can periodically connect to the mRemoteNG website to check for updates. The update information could not be downloaded. @@ -2298,9 +2295,6 @@ mRemoteNG will now quit and begin with the installation. Weekly - - The announcement information could not be downloaded. - The change log could not be downloaded. diff --git a/mRemoteV1/Resources/Language/Language.ru.resx b/mRemoteV1/Resources/Language/Language.ru.resx index ccddd129..44dd832c 100644 --- a/mRemoteV1/Resources/Language/Language.ru.resx +++ b/mRemoteV1/Resources/Language/Language.ru.resx @@ -920,9 +920,6 @@ Добавить Панель подключения - - Сообщения - Проверка наличия обновлений diff --git a/mRemoteV1/Resources/Language/Language.uk.resx b/mRemoteV1/Resources/Language/Language.uk.resx index 65c77fe9..212c0f8d 100644 --- a/mRemoteV1/Resources/Language/Language.uk.resx +++ b/mRemoteV1/Resources/Language/Language.uk.resx @@ -890,9 +890,6 @@ VncSharp Control Version {0} Додати Панель з'єднання - - Повідомлення - Перевірка наявності оновлень diff --git a/mRemoteV1/Resources/Language/Language.zh-CN.resx b/mRemoteV1/Resources/Language/Language.zh-CN.resx index b47280fe..b3d086bc 100644 --- a/mRemoteV1/Resources/Language/Language.zh-CN.resx +++ b/mRemoteV1/Resources/Language/Language.zh-CN.resx @@ -903,9 +903,6 @@ VncSharp 版本 {0} 添加连接面板 - - 公告 - 检查更新 diff --git a/mRemoteV1/Resources/Language/Language.zh-TW.resx b/mRemoteV1/Resources/Language/Language.zh-TW.resx index 6105077b..bab620d4 100644 --- a/mRemoteV1/Resources/Language/Language.zh-TW.resx +++ b/mRemoteV1/Resources/Language/Language.zh-TW.resx @@ -881,9 +881,6 @@ VncSharp Control 版本 {0} 加入連線面板 - - 發佈 - 檢查更新 diff --git a/mRemoteV1/UI/Forms/OptionsPages/UpdatesPage.Designer.cs b/mRemoteV1/UI/Forms/OptionsPages/UpdatesPage.Designer.cs index 38af68d6..78e3ce2a 100644 --- a/mRemoteV1/UI/Forms/OptionsPages/UpdatesPage.Designer.cs +++ b/mRemoteV1/UI/Forms/OptionsPages/UpdatesPage.Designer.cs @@ -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 diff --git a/mRemoteV1/UI/Forms/frmMain.Designer.cs b/mRemoteV1/UI/Forms/frmMain.Designer.cs index 035f3e85..5f4806fb 100644 --- a/mRemoteV1/UI/Forms/frmMain.Designer.cs +++ b/mRemoteV1/UI/Forms/frmMain.Designer.cs @@ -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; diff --git a/mRemoteV1/UI/Forms/frmMain.cs b/mRemoteV1/UI/Forms/frmMain.cs index 5f0684d3..fb03a894 100644 --- a/mRemoteV1/UI/Forms/frmMain.cs +++ b/mRemoteV1/UI/Forms/frmMain.cs @@ -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 diff --git a/mRemoteV1/UI/Forms/frmOptions.cs b/mRemoteV1/UI/Forms/frmOptions.cs index 857ca169..49e0c670 100644 --- a/mRemoteV1/UI/Forms/frmOptions.cs +++ b/mRemoteV1/UI/Forms/frmOptions.cs @@ -12,10 +12,18 @@ namespace mRemoteNG.UI.Forms { private Dictionary _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) diff --git a/mRemoteV1/UI/TaskDialog/CommandButton.cs b/mRemoteV1/UI/TaskDialog/CommandButton.cs index babdedeb..93938c40 100644 --- a/mRemoteV1/UI/TaskDialog/CommandButton.cs +++ b/mRemoteV1/UI/TaskDialog/CommandButton.cs @@ -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)); diff --git a/mRemoteV1/UI/TaskDialog/CommandButton.designer.cs b/mRemoteV1/UI/TaskDialog/CommandButton.designer.cs index 525f380c..ea110afb 100644 --- a/mRemoteV1/UI/TaskDialog/CommandButton.designer.cs +++ b/mRemoteV1/UI/TaskDialog/CommandButton.designer.cs @@ -1,6 +1,6 @@ namespace mRemoteNG.UI.TaskDialog { - partial class CommandButton + sealed partial class CommandButton { /// /// Required designer variable. diff --git a/mRemoteV1/UI/Window/AnnouncementWindow.Designer.cs b/mRemoteV1/UI/Window/AnnouncementWindow.Designer.cs deleted file mode 100644 index 7ca9c7df..00000000 --- a/mRemoteV1/UI/Window/AnnouncementWindow.Designer.cs +++ /dev/null @@ -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 - } -} diff --git a/mRemoteV1/UI/Window/AnnouncementWindow.cs b/mRemoteV1/UI/Window/AnnouncementWindow.cs deleted file mode 100644 index d3dcce73..00000000 --- a/mRemoteV1/UI/Window/AnnouncementWindow.cs +++ /dev/null @@ -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 - } -} diff --git a/mRemoteV1/UI/Window/AnnouncementWindow.resx b/mRemoteV1/UI/Window/AnnouncementWindow.resx deleted file mode 100644 index 19dc0dd8..00000000 --- a/mRemoteV1/UI/Window/AnnouncementWindow.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/mRemoteV1/UI/Window/UpdateWindow.cs b/mRemoteV1/UI/Window/UpdateWindow.cs index e41c40ad..7ab6974b 100644 --- a/mRemoteV1/UI/Window/UpdateWindow.cs +++ b/mRemoteV1/UI/Window/UpdateWindow.cs @@ -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) diff --git a/mRemoteV1/UI/WindowType.cs b/mRemoteV1/UI/WindowType.cs index 476a7c2c..3b320aaa 100644 --- a/mRemoteV1/UI/WindowType.cs +++ b/mRemoteV1/UI/WindowType.cs @@ -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 } } \ No newline at end of file diff --git a/mRemoteV1/app.config b/mRemoteV1/app.config index e42d2371..ae4b8260 100644 --- a/mRemoteV1/app.config +++ b/mRemoteV1/app.config @@ -451,9 +451,6 @@ False - - - False @@ -605,9 +602,6 @@ release - - https://update.mremoteng.org/announcement.txt - https://update.mremoteng.org/ diff --git a/mRemoteV1/mRemoteV1.csproj b/mRemoteV1/mRemoteV1.csproj index 4c78e5b2..cb0246f5 100644 --- a/mRemoteV1/mRemoteV1.csproj +++ b/mRemoteV1/mRemoteV1.csproj @@ -116,7 +116,6 @@ - @@ -418,12 +417,6 @@ Form - - AnnouncementWindow.cs - - - Form - Form @@ -613,10 +606,6 @@ ActiveDirectoryImportWindow.cs Designer - - AnnouncementWindow.cs - Designer - ComponentsCheckWindow.cs Designer @@ -992,7 +981,6 @@ - PreserveNewest