44using System ;
55using System . Collections . Generic ;
66using System . Collections . ObjectModel ;
7- using System . Diagnostics ;
87using System . IO ;
98using System . Linq ;
109using System . Text ;
@@ -48,7 +47,7 @@ private async void MainWindow_Activated(object sender, WindowActivatedEventArgs
4847 {
4948 try
5049 {
51- await Task . Delay ( 300 ) ;
50+ await CheckUpdate ( "Neo 2.1" ) ;
5251
5352 if ( ! IsSupportedOS ( ) )
5453 {
@@ -82,7 +81,7 @@ private async void MainWindow_Activated(object sender, WindowActivatedEventArgs
8281 ContentDialog confirmationDialog = new ContentDialog
8382 {
8483 XamlRoot = RootGrid . XamlRoot ,
85- Title = "Confirmation " ,
84+ Title = "Error " ,
8685 Content = "The Camera Raw has not been installed on your device." ,
8786 PrimaryButtonText = "Download Camera Raw" ,
8887 CloseButtonText = "Cancel" ,
@@ -93,11 +92,7 @@ private async void MainWindow_Activated(object sender, WindowActivatedEventArgs
9392
9493 if ( result == ContentDialogResult . Primary )
9594 {
96- Process . Start ( new ProcessStartInfo
97- {
98- FileName = "https://www.adobe.com/go/acr_installer_win" ,
99- UseShellExecute = true
100- } ) ;
95+ await Launcher . LaunchUriAsync ( new Uri ( "https://www.adobe.com/go/acr_installer_win" ) ) ;
10196 }
10297
10398 Application . Current . Exit ( ) ;
@@ -127,11 +122,71 @@ private async void MainWindow_Activated(object sender, WindowActivatedEventArgs
127122 Directory . CreateDirectory ( CameraRaw . CameraProfilesDir_LR ) ;
128123 }
129124
130- var modelDirs = await DirectoryHelper . GetFolders ( CameraRaw . InputModelsDir ) ;
131- var modelDirsAlt = await DirectoryHelper . GetFolders ( CameraRaw . InputModelsDirAlt , false ) ;
125+ var modelDirsTask = DirectoryHelper . GetFolders ( CameraRaw . InputModelsDir ) ;
126+ var modelDirsAltTask = DirectoryHelper . GetFolders ( CameraRaw . InputModelsDirAlt , false ) ;
127+
128+ await Task . WhenAll ( modelDirsTask , modelDirsAltTask ) ;
129+
130+ var modelDirs = modelDirsTask . Result ;
131+ var modelDirsAlt = modelDirsAltTask . Result ;
132+
133+ if ( modelDirs . Count == 0 )
134+ {
135+ ContentDialog noDcpDialog = new ContentDialog
136+ {
137+ XamlRoot = RootGrid . XamlRoot ,
138+ Title = "Error" ,
139+ Content = "Cannot load default profiles of Camera Raw. Try reinstalling Camera Raw, and Adobe Lightroom or Adobe Photoshop." ,
140+ PrimaryButtonText = "Download Camera Raw" ,
141+ CloseButtonText = "Skip" ,
142+ DefaultButton = ContentDialogButton . Primary
143+ } ;
132144
133- ModelDirs . AddRange ( modelDirs ) ;
134- ModelDirs . AddRange ( modelDirsAlt ) ;
145+ if ( await noDcpDialog . ShowAsync ( ) == ContentDialogResult . Primary )
146+ {
147+ await Launcher . LaunchUriAsync ( new Uri ( "https://www.adobe.com/go/acr_installer_win" ) ) ;
148+ }
149+ }
150+ else
151+ {
152+ ModelDirs . AddRange ( modelDirs ) ;
153+ }
154+
155+ if ( modelDirsAlt . Count == 0 )
156+ {
157+ ContentDialog noXmlDialog = new ContentDialog
158+ {
159+ XamlRoot = RootGrid . XamlRoot ,
160+ Title = "Error" ,
161+ Content = "Cannot load camera profiles of Adobe, Sigma, Nikon, Panasonic, and Fujifilm. Try reinstalling Camera Raw, and Adobe Lightroom or Adobe Photoshop." ,
162+ PrimaryButtonText = "Download Camera Raw" ,
163+ CloseButtonText = "Skip" ,
164+ DefaultButton = ContentDialogButton . Primary
165+ } ;
166+
167+ if ( await noXmlDialog . ShowAsync ( ) == ContentDialogResult . Primary )
168+ {
169+ await Launcher . LaunchUriAsync ( new Uri ( "https://www.adobe.com/go/acr_installer_win" ) ) ;
170+ }
171+ }
172+ else
173+ {
174+ ModelDirs . AddRange ( modelDirsAlt ) ;
175+ }
176+
177+ if ( ModelDirs . Count == 0 )
178+ {
179+ ContentDialog noAdobeDialog = new ContentDialog
180+ {
181+ XamlRoot = RootGrid . XamlRoot ,
182+ Title = "Error" ,
183+ Content = "Cannot load camera profiles from Adobe. Try reinstalling Camera Raw, and Adobe Lightroom or Adobe Photoshop." ,
184+ PrimaryButtonText = "OK" ,
185+ DefaultButton = ContentDialogButton . Primary
186+ } ;
187+ await noAdobeDialog . ShowAsync ( ) ;
188+ Application . Current . Exit ( ) ;
189+ }
135190
136191 var models = ModelDirs
137192 . AsParallel ( )
@@ -146,7 +201,6 @@ private async void MainWindow_Activated(object sender, WindowActivatedEventArgs
146201 }
147202
148203 InputSearchBox . ItemsSource = OutputSearchBox . ItemsSource = DataSource ;
149- await CheckUpdate ( "Neo 2.0" ) ;
150204 }
151205 catch ( Exception ex )
152206 {
@@ -262,7 +316,7 @@ private async void InstallButton_Click(object sender, RoutedEventArgs e)
262316 return ;
263317 }
264318
265- if ( ! ModelDirs . Any ( dir => dir . Contains ( OutputSearchBox . Text . Trim ( ) ) || dir . Contains ( InputSearchBox . Text . Trim ( ) ) ) )
319+ if ( ! ModelDirs . Exists ( dir => dir . Contains ( OutputSearchBox . Text . Trim ( ) ) || dir . Contains ( InputSearchBox . Text . Trim ( ) ) ) )
266320 {
267321 ContentDialog errorDialog = new ContentDialog
268322 {
@@ -336,9 +390,15 @@ private async void InstallButton_Click(object sender, RoutedEventArgs e)
336390 XamlRoot = RootGrid . XamlRoot ,
337391 Title = "Success" ,
338392 Content = "Please restart the Lightroom and the Photoshop applications to apply changes." ,
339- PrimaryButtonText = "OK"
393+ PrimaryButtonText = VietcombankBtn . Content . ToString ( ) ,
394+ SecondaryButtonText = "OK" ,
395+ DefaultButton = ContentDialogButton . Primary
340396 } ;
341- await successDialog2 . ShowAsync ( ) ;
397+
398+ if ( await successDialog2 . ShowAsync ( ) == ContentDialogResult . Primary )
399+ {
400+ await Launcher . LaunchUriAsync ( new Uri ( VietcombankBtn . NavigateUri . AbsoluteUri ) ) ;
401+ }
342402 }
343403 private async void ResetButton_Click ( object sender , RoutedEventArgs e )
344404 {
@@ -462,7 +522,7 @@ private void FilterResult(AutoSuggestBox sender)
462522 sender . ItemsSource = new List < string > ( ) { "Error while finding the camera" } ;
463523 }
464524 }
465- public bool IsSupportedOS ( )
525+ public static bool IsSupportedOS ( )
466526 {
467527 var minOsVersion = new Version ( 10 , 0 , 17763 , 0 ) ;
468528
0 commit comments