@@ -55,56 +55,80 @@ protected override async void OnNavigatedTo(NavigationEventArgs e)
55
55
WarningMessage . Visibility = Visibility . Collapsed ;
56
56
WarningMessage2 . Visibility = Visibility . Visible ;
57
57
58
- backup = message . backup ;
58
+ List < CompactAppData > skipApps = new List < CompactAppData > ( ) ;
59
59
60
- ( ( App ) App . Current ) . BackRequested += BackupProgress_BackRequested ;
61
- backupManager . BackupProgress += BackupManager_BackupProgress ;
60
+ try
61
+ {
62
+ backup = message . backup ;
62
63
63
- LogsView . ItemsSource = log ;
64
+ ( ( App ) App . Current ) . BackRequested += BackupProgress_BackRequested ;
65
+ backupManager . BackupProgress += BackupManager_BackupProgress ;
64
66
65
- List < CompactAppData > skipApps = new List < CompactAppData > ( ) ;
67
+ LogsView . ItemsSource = log ;
66
68
67
- string notAvailableNames = "" ;
68
- foreach ( var item in backup . Apps )
69
- {
70
- if ( LoadAppData . appsData . Count ( x => x . FamilyName == item . FamilyName ) == 0 )
69
+ string notAvailableNames = "" ;
70
+ foreach ( var item in backup . Apps )
71
71
{
72
- skipApps . Add ( item ) ;
73
- if ( notAvailableNames . Length > 0 )
74
- notAvailableNames += "\r \n " ;
75
- notAvailableNames += item . DisplayName ;
72
+ if ( LoadAppData . appsData . Count ( x => x . FamilyName == item . FamilyName ) == 0 )
73
+ {
74
+ skipApps . Add ( item ) ;
75
+ if ( notAvailableNames . Length > 0 )
76
+ notAvailableNames += "\r \n " ;
77
+ notAvailableNames += item . DisplayName ;
78
+ }
76
79
}
77
80
}
81
+ catch ( Exception ex )
82
+ {
83
+ MessageDialog md = new MessageDialog ( "1" + ex . Message ) ;
84
+ await md . ShowAsync ( ) ;
85
+ }
78
86
79
- foreach ( var item in backup . Apps )
87
+ try
80
88
{
81
- if ( ! skipApps . Contains ( item ) )
82
- {
83
- AppData appd = AppDataExtension . FindAppData ( item . FamilyName ) ;
84
- if ( appd . PackageId != item . PackageId )
89
+ foreach ( var item in backup . Apps )
90
+ {
91
+ if ( ! skipApps . Contains ( item ) )
85
92
{
86
- MessageDialog md = new MessageDialog ( "Current installed version doesn't match the version backup was created from.\r \n \r \n " +
87
- "Current installed version: " + appd . PackageId + "\r \n \r \n " +
88
- "Backup: " + item . PackageId + "\r \n \r \n \r \n " +
89
- "Do you want to restore this app?" ,
90
- appd . DisplayName + ": Version mismatch" ) ;
91
- md . Commands . Add ( new UICommand ( "Restore" ) { Id = 1 } ) ;
92
- md . Commands . Add ( new UICommand ( "Don't restore" ) { Id = 0 } ) ;
93
- md . DefaultCommandIndex = 1 ;
94
- md . CancelCommandIndex = 0 ;
95
-
96
- var result = await md . ShowAsync ( ) ;
97
-
98
- if ( ( ( int ) result . Id ) == 0 )
93
+ AppData appd = AppDataExtension . FindAppData ( item . FamilyName ) ;
94
+ if ( appd . PackageId != item . PackageId )
99
95
{
100
- skipApps . Add ( item ) ;
96
+ MessageDialog md = new MessageDialog ( "Current installed version doesn't match the version backup was created from.\r \n \r \n " +
97
+ "Current installed version: " + appd . PackageId + "\r \n \r \n " +
98
+ "Backup: " + item . PackageId + "\r \n \r \n \r \n " +
99
+ "Do you want to restore this app?" ,
100
+ appd . DisplayName + ": Version mismatch" ) ;
101
+ md . Commands . Add ( new UICommand ( "Restore" ) { Id = 1 } ) ;
102
+ md . Commands . Add ( new UICommand ( "Don't restore" ) { Id = 0 } ) ;
103
+ md . DefaultCommandIndex = 1 ;
104
+ md . CancelCommandIndex = 0 ;
105
+
106
+ var result = await md . ShowAsync ( ) ;
107
+
108
+ if ( ( ( int ) result . Id ) == 0 )
109
+ {
110
+ skipApps . Add ( item ) ;
111
+ }
101
112
}
102
113
}
103
114
}
104
115
}
116
+ catch ( Exception ex )
117
+ {
118
+ MessageDialog md = new MessageDialog ( "2" + ex . Message ) ;
119
+ await md . ShowAsync ( ) ;
120
+ }
105
121
106
- cleanedCount = - 1 ;
107
- totalAppsCount = backup . Apps . Count ;
122
+ try
123
+ {
124
+ cleanedCount = - 1 ;
125
+ totalAppsCount = backup . Apps . Count ;
126
+ }
127
+ catch ( Exception ex )
128
+ {
129
+ MessageDialog md = new MessageDialog ( "3" + ex . Message ) ;
130
+ await md . ShowAsync ( ) ;
131
+ }
108
132
109
133
await backupManager . Restore ( backup , skipApps ) ;
110
134
@@ -168,7 +192,8 @@ private void BackupManager_BackupProgress(object sender, BackupEventArgs e)
168
192
169
193
if ( e . Progress < 0 )
170
194
progressBar1 . IsIndeterminate = true ;
171
- else {
195
+ else
196
+ {
172
197
if ( progressBar1 . IsIndeterminate )
173
198
progressBar1 . IsIndeterminate = false ;
174
199
progressBar1 . Value = e . Progress ;
0 commit comments