@@ -308,19 +308,19 @@ void MainForm_FormClosing(object sender, FormClosingEventArgs e)
308308 File . Delete ( file ) ;
309309 }
310310
311- void CheckForUpdate ( )
312- {
313- // This is known directly from the chosen channel so doesn't need to wait for the update check itself.
314- linkLabelChangeLog . Visible = ! string . IsNullOrEmpty ( UpdateManager . ChangeLogLink ) ;
315-
316- new Task < UpdateManager > ( this , ( ) =>
317- {
318- UpdateManager . Check ( ) ;
319- return null ;
320- } , _ =>
321- {
322- if ( UpdateManager . LastCheckError != null )
323- linkLabelUpdate . Text = catalog . GetString ( "Update check failed" ) ;
311+ // void CheckForUpdate()
312+ // {
313+ // // This is known directly from the chosen channel so doesn't need to wait for the update check itself.
314+ // linkLabelChangeLog.Visible = !string.IsNullOrEmpty(UpdateManager.ChangeLogLink);
315+
316+ // new Task<UpdateManager>(this, () =>
317+ // {
318+ // UpdateManager.Check();
319+ // return null;
320+ // }, _ =>
321+ // {
322+ // if (UpdateManager.LastCheckError != null)
323+ // linkLabelUpdate.Text = catalog.GetString("Update check failed");
324324 //else if (UpdateManager.LastUpdate != null && UpdateManager.LastUpdate.Version != VersionInfo.Version)
325325 // linkLabelUpdate.Text = catalog.GetStringFmt("Update to {0}", UpdateManager.LastUpdate.Version);
326326 //else
@@ -332,13 +332,26 @@ void CheckForUpdate()
332332 // linkLabelUpdate.Image = ElevationIcon;
333333 //else
334334 // linkLabelUpdate.Image = null;
335-
335+ // });
336+ //}
337+ void CheckForUpdate ( )
338+ {
339+ new Task < UpdateManager > ( this , ( ) =>
340+ {
341+ UpdateManager . Check ( ) ;
342+ return null ;
343+ } , _ =>
344+ {
345+ if ( UpdateManager . LastCheckError != null )
346+ {
347+ linkLabelUpdate . Text = catalog . GetString ( "Update check failed" ) ;
348+ linkLabelChangeLog . Visible = true ;
349+ }
336350 if ( UpdateManager . LastUpdate != null )
337351 {
338352 SetUpdateNotification ( ) ;
339353 }
340354 } ) ;
341-
342355 }
343356
344357 void LoadLanguage ( )
@@ -1503,14 +1516,15 @@ private void ToggleNotifications()
15031516 {
15041517 if ( AreNotificationsVisible == false )
15051518 {
1519+ AreNotificationsVisible = true ; // Set before calling ShowNotifcations()
15061520 ShowNotifications ( ) ;
15071521 FiddleNewNotificationCount ( ) ;
15081522 }
15091523 else
15101524 {
1525+ AreNotificationsVisible = false ;
15111526 ShowDetails ( ) ;
15121527 }
1513- AreNotificationsVisible = ! AreNotificationsVisible ;
15141528 }
15151529
15161530 private void FiddleNewNotificationCount ( )
@@ -1541,8 +1555,8 @@ void ShowNotifications()
15411555 /// <summary>
15421556 /// Populate the Notifications list
15431557 /// </summary>
1544- private void PopulateNotificationList ( )
1545- {
1558+ // private void PopulateNotificationList()
1559+ // {
15461560 //NotificationList.Clear();
15471561 //if (NotificationList.Count == 0)
15481562 //{
@@ -1578,7 +1592,10 @@ private void PopulateNotificationList()
15781592 //var notification = NotificationList.LastOrDefault();
15791593 //new NTextControl(panelDetails, "").Add(notification);
15801594 //new NTextControl(panelDetails, "(Toggle icon to hide notifications.)").Add(notification);
1595+ //}
15811596
1597+ private void PopulateNotificationList ( )
1598+ {
15821599 SetUpdateNotification ( ) ;
15831600
15841601 var notification = NotificationList . LastOrDefault ( ) ;
@@ -1608,31 +1625,35 @@ void SetUpdateNotification()
16081625 if ( IsUpdateAvailable ( ) )
16091626 {
16101627 NewNotificationCount = 1 ;
1611- new NTitleControl ( newNotification , UpdateManager . LastUpdate . Date , "Update is available" ) . Add ( ) ;
1612- new NRecordControl ( newNotification , "Update mode" , 140 , UpdateManager . ChannelName ) . Add ( ) ;
1613- new NRecordControl ( newNotification , "Installed version" , 140 , VersionInfo . VersionOrBuild ) . Add ( ) ;
1614- new NRecordControl ( newNotification , "New version available" , 140 , UpdateManager . LastUpdate . Version ) . Add ( ) ;
1615- new NLinkControl ( newNotification , "What's new" , 90 , "Find out on-line what's new in this version." , this , UpdateManager . ChangeLogLink ) . Add ( ) ;
1616- new NUpdateControl ( newNotification , "Install" , 90 , "Install the new version." , this ) . Add ( ) ;
1617-
1628+ if ( AreNotificationsVisible )
1629+ {
1630+ new NTitleControl ( newNotification , UpdateManager . LastUpdate . Date , "Update is available" ) . Add ( ) ;
1631+ new NRecordControl ( newNotification , "Update mode" , 140 , UpdateManager . ChannelName ) . Add ( ) ;
1632+ new NRecordControl ( newNotification , "Installed version" , 140 , VersionInfo . VersionOrBuild ) . Add ( ) ;
1633+ new NRecordControl ( newNotification , "New version available" , 140 , UpdateManager . LastUpdate . Version ) . Add ( ) ;
1634+ new NLinkControl ( newNotification , "What's new" , 90 , "Find out on-line what's new in this version." , this , UpdateManager . ChangeLogLink ) . Add ( ) ;
1635+ new NUpdateControl ( newNotification , "Install" , 90 , "Install the new version." , this ) . Add ( ) ;
1636+ }
16181637 }
16191638 else
16201639 {
16211640 NewNotificationCount = 0 ;
1622- var channelName = UpdateManager . ChannelName == "" ? "None" : UpdateManager . ChannelName ;
1623- new NTitleControl ( newNotification , DateTime . Now , "Installation is up to date" ) . Add ( ) ;
1624- new NRecordControl ( newNotification , "Update mode" , 140 , channelName ) . Add ( ) ;
1625- new NRecordControl ( newNotification , "Installed version" , 140 , VersionInfo . VersionOrBuild ) . Add ( ) ;
1626- new NRecordControl ( newNotification , "New version available" , 140 , "none" ) . Add ( ) ;
1641+ if ( AreNotificationsVisible )
1642+ {
1643+ var channelName = UpdateManager . ChannelName == "" ? "None" : UpdateManager . ChannelName ;
1644+ new NTitleControl ( newNotification , DateTime . Now , "Installation is up to date" ) . Add ( ) ;
1645+ new NRecordControl ( newNotification , "Update mode" , 140 , channelName ) . Add ( ) ;
1646+ new NRecordControl ( newNotification , "Installed version" , 140 , VersionInfo . VersionOrBuild ) . Add ( ) ;
1647+ new NRecordControl ( newNotification , "New version available" , 140 , "none" ) . Add ( ) ;
1648+ }
16271649 }
16281650 NotificationList . Add ( newNotification ) ;
16291651 }
16301652
16311653 bool IsUpdateAvailable ( )
16321654 {
16331655 return UpdateManager . LastUpdate != null
1634- && UpdateManager . LastUpdate . Version != VersionInfo . Version
1635- && DateTime . Now >= UpdateManager . State . NextCheck ;
1656+ && UpdateManager . LastUpdate . Version != VersionInfo . Version ;
16361657 }
16371658
16381659 // 3 should be enough, but is there a way to get unlimited buttons?
0 commit comments