@@ -26,16 +26,35 @@ public Updater()
2626
2727 private async void Updater_Load ( object sender , EventArgs e )
2828 {
29- if ( await CheckForUpdate ( ) )
29+ try
3030 {
31- progressBar1 . Dispose ( ) ;
32- label1 . Font = new Font ( "Lucida Console" , label1 . Font . Size ) ;
33- label1 . Text = String . Format ( $ "Current Version: { CurrentVersion } \n Latest Version: { NewVersion } \n \n Open the download page?") ;
34- button_Cancel . Enabled = true ;
35- button_Cancel . Click += delegate { Dispose ( ) ; } ;
31+ if ( await CheckForUpdate ( ) )
32+ {
33+ progressBar1 . Dispose ( ) ;
34+ label1 . Font = new Font ( "Lucida Console" , label1 . Font . Size ) ;
35+ label1 . Text = String . Format ( $ "Current Version: { CurrentVersion } \n Latest Version: { NewVersion } \n \n Open the download page?") ;
36+ button_Cancel . Enabled = true ;
37+ button_Cancel . Click += delegate { Dispose ( ) ; } ;
3638
37- button_Ok . Enabled = true ;
38- button_Ok . Click += delegate { System . Diagnostics . Process . Start ( "https://github.com/ImDema/FreeMove/releases/latest" ) ; Dispose ( ) ; } ;
39+ button_Ok . Enabled = true ;
40+ button_Ok . Click += delegate { System . Diagnostics . Process . Start ( "https://github.com/ImDema/FreeMove/releases/latest" ) ; Dispose ( ) ; } ;
41+ }
42+ else
43+ {
44+ label1 . Text = "There are no updates available" ;
45+ button_Ok . Enabled = true ;
46+ button_Ok . Click += delegate { Dispose ( ) ; } ;
47+ }
48+ }
49+ catch ( Exception ex )
50+ {
51+ if ( ex . Message == Properties . Resources . GitHubErrorMessage )
52+ {
53+ label1 . Text = Properties . Resources . GitHubErrorMessage ;
54+ button_Ok . Enabled = true ;
55+ button_Ok . Click += delegate { Dispose ( ) ; } ;
56+ }
57+ else throw ex ;
3958 }
4059 }
4160
@@ -55,7 +74,7 @@ public async Task<bool> CheckForUpdate()
5574 break ;
5675 }
5776 }
58- if ( NewVersion == "" ) throw new Exception ( "Could not retrieve the version information from the GitHub server" ) ;
77+ if ( NewVersion == "" ) throw new Exception ( Properties . Resources . GitHubErrorMessage ) ;
5978 Assembly assembly = Assembly . GetExecutingAssembly ( ) ;
6079 CurrentVersion = System . Diagnostics . FileVersionInfo . GetVersionInfo ( assembly . Location ) . FileVersion ;
6180 return CurrentVersion != NewVersion ;
0 commit comments