diff options
| author | Karsten Heimrich <karsten.heimrich@qt.io> | 2025-04-29 11:26:26 +0200 |
|---|---|---|
| committer | Karsten Heimrich <karsten.heimrich@qt.io> | 2025-05-05 11:03:09 +0000 |
| commit | 9ee6afba9057b53f324381d705574e504b3f92f9 (patch) | |
| tree | f1f7b56bd39c6f98891889a5dc9667e42f9f4ff2 /QtVsTools.Core/DevReleaseMonitorTask.cs | |
| parent | 82667962ddf259fc3f6089775ed38049b8221329 (diff) | |
Move development release notifications to monitor task
Change-Id: I92361a0d563122a220dbc3bd5bc2c03360b62bf5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'QtVsTools.Core/DevReleaseMonitorTask.cs')
| -rw-r--r-- | QtVsTools.Core/DevReleaseMonitorTask.cs | 72 |
1 files changed, 71 insertions, 1 deletions
diff --git a/QtVsTools.Core/DevReleaseMonitorTask.cs b/QtVsTools.Core/DevReleaseMonitorTask.cs index fb118e1c..5a1a5646 100644 --- a/QtVsTools.Core/DevReleaseMonitorTask.cs +++ b/QtVsTools.Core/DevReleaseMonitorTask.cs @@ -4,18 +4,88 @@ using System; using System.Linq; using System.Net.Http; -using System.Threading; using System.Text.RegularExpressions; +using System.Threading; +using Microsoft.VisualStudio.Imaging; +using Microsoft.VisualStudio.Imaging.Interop; using Tasks = System.Threading.Tasks; namespace QtVsTools.Core { + using Common; using Options; using VisualStudio; using static SyntaxAnalysis.RegExpr; + public static partial class Notifications + { + public static SearchDevRelease NotifySearchDevRelease + => StaticLazy.Get(() => NotifySearchDevRelease, () => new SearchDevRelease()); + } + + public class SearchDevRelease : InfoBarMessage + { + protected override ImageMoniker Icon => KnownMonikers.StatusInformation; + + protected override TextSpan[] Text => new TextSpan[] + { + new() { Bold = true, Text = "Qt Visual Studio Tools" }, + new TextSpacer(2), + Utils.EmDash, + new TextSpacer(2), + "can auto-search for development releases every 24 hours if Visual Studio has been " + + "idle for at least 60 seconds." + }; + + protected override Hyperlink[] Hyperlinks => new Hyperlink[] + { + new() + { + Text = "Enable", + CloseInfoBar = false, + OnClicked= () => + { + try { + QtOptionsPage.SearchDevRelease = true; + QtOptionsPageSettings.Instance.SaveSettings(); + } catch (Exception ex) { + ex.Log(); + } + } + }, + new() + { + Text = "Disable", + CloseInfoBar = false, + OnClicked= () => + { + try { + QtOptionsPage.SearchDevRelease = false; + QtOptionsPageSettings.Instance.SaveSettings(); + } catch (Exception ex) { + ex.Log(); + } + } + }, + new() + { + Text = "Don't show again", + CloseInfoBar = true, + OnClicked = () => + { + try { + QtOptionsPage.NotifySearchDevRelease = false; + QtOptionsPage.SaveSettingsToStorageStatic(); + } catch (Exception ex) { + ex.Log(); + } + } + } + }; + } + public class DevReleaseMonitorTask : IIdleTask { private const string UrlDownloadQtIo = "https://download.qt.io/development_releases/vsaddin/"; |
