@@ -71,7 +71,7 @@ public sealed class TrayIcon : IDisposable
71
71
private readonly TooltipInfoManager _tooltipInfoManager ;
72
72
private readonly ProfileTrayIconBuilder _profileTrayIconBuilder ;
73
73
74
- private readonly ToolStripMenuItem _updateMenuItem ;
74
+ private ToolStripMenuItem _updateMenuItem ;
75
75
private TimerForm _animationTimer ;
76
76
private readonly UpdateDownloadForm _updateDownloadForm ;
77
77
private readonly MethodInfo ? _showContextMenu ;
@@ -85,7 +85,7 @@ public TrayIcon()
85
85
86
86
_updateMenuItem = new ToolStripMenuItem ( AppConfigs . Configuration . UpdateMode == UpdateMode . Never ? TrayIconStrings . updateDisabled : TrayIconStrings . noUpdate , RessourceUpdateBitmap , OnUpdateClick )
87
87
{
88
- Enabled = false
88
+ Enabled = AppConfigs . Configuration . UpdateMode != UpdateMode . Never
89
89
} ;
90
90
NotifyIcon . ContextMenuStrip = _settingsMenu ;
91
91
@@ -159,6 +159,7 @@ private void PopulateSettingsMenu()
159
159
{
160
160
var applicationDirectory = Path . GetDirectoryName ( ApplicationPath . Executable ) ;
161
161
Debug . Assert ( applicationDirectory != null , "applicationDirectory != null" ) ;
162
+ _settingsMenu . Items . Clear ( ) ;
162
163
_settingsMenu . Items . Add ( Application . ProductName + ' ' + AssemblyUtils . GetReleaseState ( ) + " (" + Application . ProductVersion + ")" , SoundSwitchLogoIcon . ToBitmap ( ) ) ;
163
164
_settingsMenu . Items . Add ( new ToolStripSeparator ( ) ) ;
164
165
_settingsMenu . Items . Add ( TrayIconStrings . playbackDevices , RessourcePlaybackDevicesBitmap ,
@@ -181,7 +182,11 @@ private void PopulateSettingsMenu()
181
182
private void OnUpdateClick ( object sender , EventArgs eventArgs )
182
183
{
183
184
if ( _updateMenuItem . Tag == null )
185
+ {
186
+ AppModel . Instance . CheckForUpdate ( ) ;
184
187
return ;
188
+ }
189
+
185
190
if ( _updateDownloadForm . Visible )
186
191
{
187
192
_updateDownloadForm . Focus ( ) ;
@@ -217,9 +222,14 @@ private void SetEventHandlers()
217
222
if ( @event . UpdateMode == UpdateMode . Notify )
218
223
_context . Send ( s => { NewReleaseAvailable ( sender , @event ) ; } , null ) ;
219
224
} ;
220
- AppModel . Instance . DefaultDeviceChanged += ( _ , _ ) =>
225
+ AppModel . Instance . DefaultDeviceChanged += ( _ , _ ) => { _tooltipInfoManager . SetIconText ( ) ; } ;
226
+ AppModel . Instance . UpdateModeChanged += ( _ , mode ) =>
221
227
{
222
- _tooltipInfoManager . SetIconText ( ) ;
228
+ _updateMenuItem = new ToolStripMenuItem ( mode == UpdateMode . Never ? TrayIconStrings . updateDisabled : TrayIconStrings . noUpdate , RessourceUpdateBitmap , OnUpdateClick )
229
+ {
230
+ Enabled = mode != UpdateMode . Never
231
+ } ;
232
+ PopulateSettingsMenu ( ) ;
223
233
} ;
224
234
}
225
235
0 commit comments