@@ -133,59 +133,50 @@ private async void DownloadBuild(Build build)
133133 if ( build . Version == currentVersion )
134134 return ;
135135
136- var assets = build . Assets
137- . Where ( x => x . IsPortable )
138- . Where ( x => x . IsApplicableForCurrentPlatform ( ) )
139- . OrderBy ( x => x , BuildAssetComparer . Default )
140- . ToArray ( ) ;
141-
142- var asset = assets . FirstOrDefault ( ) ;
143- if ( asset == null )
144- {
145- return ;
146- }
147-
148- var progress = new Progress < DownloadProgressReport > ( ) ;
149- progress . ProgressChanged += ( s , report ) =>
150- {
151- Dispatcher . UIThread . Post ( ( ) =>
152- {
153- downloadButton . Content = report . Status ;
154- if ( report . Value is float value )
155- {
156- downloadProgress . IsIndeterminate = false ;
157- downloadProgress . Value = value ;
158- }
159- else
160- {
161- downloadProgress . IsIndeterminate = true ;
162- }
163- } ) ;
164- } ;
165-
166- var cts = new CancellationTokenSource ( ) ;
167- await _selectedMenuItem . InstallService . DownloadVersion (
168- new DownloadService ( ) ,
169- new Shell ( ) ,
170- build . Version ,
171- asset . Uri ,
172- progress ,
173- cts . Token ) ;
174- await RefreshInstalledVersionAsync ( ) ;
175- }
176-
177- private async void downloadButton_Click ( object sender , RoutedEventArgs e )
178- {
179136 try
180137 {
181138 downloadProgress . IsVisible = true ;
182139 SetAllInteractionEnabled ( false ) ;
183140
184- var selectedItem = versionDropdown . SelectedItem as ComboBoxItem ;
185- if ( selectedItem ? . Tag is Build build )
141+ var assets = build . Assets
142+ . Where ( x => x . IsPortable )
143+ . Where ( x => x . IsApplicableForCurrentPlatform ( ) )
144+ . OrderBy ( x => x , BuildAssetComparer . Default )
145+ . ToArray ( ) ;
146+
147+ var asset = assets . FirstOrDefault ( ) ;
148+ if ( asset == null )
186149 {
187- DownloadBuild ( build ) ;
150+ return ;
188151 }
152+
153+ var progress = new Progress < DownloadProgressReport > ( ) ;
154+ progress . ProgressChanged += ( s , report ) =>
155+ {
156+ Dispatcher . UIThread . Post ( ( ) =>
157+ {
158+ downloadButton . Content = report . Status ;
159+ if ( report . Value is float value )
160+ {
161+ downloadProgress . IsIndeterminate = false ;
162+ downloadProgress . Value = value ;
163+ }
164+ else
165+ {
166+ downloadProgress . IsIndeterminate = true ;
167+ }
168+ } ) ;
169+ } ;
170+
171+ var cts = new CancellationTokenSource ( ) ;
172+ await _selectedMenuItem . InstallService . DownloadVersion (
173+ new DownloadService ( ) ,
174+ new Shell ( ) ,
175+ build . Version ,
176+ asset . Uri ,
177+ progress ,
178+ cts . Token ) ;
179+ await RefreshInstalledVersionAsync ( ) ;
189180 }
190181 catch ( Exception ex )
191182 {
@@ -199,6 +190,15 @@ private async void downloadButton_Click(object sender, RoutedEventArgs e)
199190 }
200191 }
201192
193+ private async void downloadButton_Click ( object sender , RoutedEventArgs e )
194+ {
195+ var selectedItem = versionDropdown . SelectedItem as ComboBoxItem ;
196+ if ( selectedItem ? . Tag is Build build )
197+ {
198+ DownloadBuild ( build ) ;
199+ }
200+ }
201+
202202 private async void playButton_Click ( object sender , RoutedEventArgs e )
203203 {
204204 if ( _selectedMenuItem == null )
0 commit comments