File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -227,8 +227,11 @@ public override void OnFrameworkInitializationCompleted()
227227 _notificationReceiver = launcher ;
228228 desktop . MainWindow = launcher ;
229229
230- if ( ViewModels . Preference . Instance . Check4UpdatesOnStartup )
230+ if ( ViewModels . Preference . Instance . ShouldCheck4UpdateOnStartup )
231+ {
232+ ViewModels . Preference . Save ( ) ;
231233 Check4Update ( ) ;
234+ }
232235 }
233236
234237 base . OnFrameworkInitializationCompleted ( ) ;
Original file line number Diff line number Diff line change @@ -278,6 +278,31 @@ public int LastActiveTabIdx
278278 set ;
279279 } = 0 ;
280280
281+ public double LastCheckUpdateTime
282+ {
283+ get ;
284+ set ;
285+ } = 0 ;
286+
287+ [ JsonIgnore ]
288+ public bool ShouldCheck4UpdateOnStartup
289+ {
290+ get
291+ {
292+ if ( ! _check4UpdatesOnStartup )
293+ return false ;
294+
295+ var lastCheck = DateTime . UnixEpoch . AddSeconds ( LastCheckUpdateTime ) . ToLocalTime ( ) ;
296+ var now = DateTime . Now ;
297+
298+ if ( lastCheck . Year == now . Year && lastCheck . Month == now . Month && lastCheck . Day == now . Day )
299+ return false ;
300+
301+ LastCheckUpdateTime = now . Subtract ( DateTime . UnixEpoch . ToLocalTime ( ) ) . TotalSeconds ;
302+ return true ;
303+ }
304+ }
305+
281306 public static void AddNode ( RepositoryNode node , RepositoryNode to = null )
282307 {
283308 var collection = to == null ? _instance . _repositoryNodes : to . SubNodes ;
You can’t perform that action at this time.
0 commit comments