22using System . Collections . Generic ;
33using System . Drawing ;
44using System . Windows . Forms ;
5+ using System . Linq ;
56
67namespace BabylonJS_Installer
78{
@@ -11,6 +12,7 @@ public partial class MainForm : Form
1112 private SoftwareChecker checker = null ;
1213
1314 private Dictionary < string , Dictionary < string , string > > versions ; // Soft, Version - Year
15+ private Dictionary < string , Dictionary < string , bool > > latestInstalled ; // Soft, Version - isLatestInstalled
1416 private Dictionary < string , Dictionary < string , string > > locations ; // Soft, Year - Location
1517 private Dictionary < string , Dictionary < string , Label [ ] > > labels ; // Soft, Year - [lab. location, lab. expDate]
1618 private Dictionary < string , Dictionary < string , Button [ ] > > buttons ; // Soft, Year - [but.Update, but.Uninstall, but.Locate]
@@ -33,6 +35,16 @@ public MainForm()
3335 this . versions [ "Maya" ] . Add ( "2018" , "19" ) ;
3436 this . versions [ "Maya" ] . Add ( "2017" , "18" ) ;
3537
38+ this . latestInstalled = new Dictionary < string , Dictionary < string , bool > > ( ) ;
39+ foreach ( var dcc in this . versions . Keys )
40+ {
41+ this . latestInstalled [ dcc ] = new Dictionary < string , bool > ( ) ;
42+ foreach ( var dccVersion in this . versions [ dcc ] . Keys )
43+ {
44+ this . latestInstalled [ dcc ] [ dccVersion ] = true ;
45+ }
46+ }
47+
3648 this . labels = new Dictionary < string , Dictionary < string , Label [ ] > > ( ) ;
3749 this . labels [ "Max" ] = new Dictionary < string , Label [ ] > ( ) ;
3850 this . labels [ "Max" ] . Add ( "2019" , new [ ] { this . label_Max19_Info , this . label_Max19_ExpDate } ) ;
@@ -155,15 +167,9 @@ public void displayInstall(string soft, string year)
155167 buttonUninstall . Visible = false ;
156168 }
157169
158- if ( this . checker . isLatestVersionInstalled ( soft , version , location ) )
159- {
160- buttonUpdate . Enabled = false ;
161- }
162- else
163- {
164- buttonUpdate . Enabled = true ;
165- }
166- // TO DO : Check if the installed version (if one) is the latest or not.
170+ var isLatest = this . checker . isLatestVersionInstalled ( soft , version , location ) ;
171+ this . latestInstalled [ soft ] [ version ] = isLatest ;
172+ buttonUpdate . Enabled = ! isLatest ;
167173 }
168174 else
169175 {
@@ -174,6 +180,9 @@ public void displayInstall(string soft, string year)
174180 buttonUpdate . Visible = false ;
175181 buttonUninstall . Visible = false ;
176182 }
183+
184+ var oneEnabled = this . latestInstalled . Any ( dccTools => dccTools . Value . Any ( installedTools => installedTools . Value ) ) ;
185+ button_All_Update . Enabled = ! oneEnabled ;
177186 }
178187
179188 // ---------- UI CLICKS ----------
0 commit comments