@@ -100,10 +100,10 @@ private void OnFileOpenClick(object sender, EventArgs e)
100
100
if ( selected == DialogResult . OK )
101
101
{
102
102
SelectedFilelbl . Text = TargetLocation . FileName ;
103
- if ( string . IsNullOrWhiteSpace ( DatabaseElem . Text ) )
103
+ if ( string . IsNullOrWhiteSpace ( DatabaseElem . Text ) )
104
104
{
105
105
var fileName = TargetLocation . FileName . Split ( new char [ ] { '/' , '\\ ' } ) . LastOrDefault ( ) ;
106
- if ( fileName . Contains ( "_" ) )
106
+ if ( fileName . Contains ( "_" ) )
107
107
{
108
108
DatabaseElem . Text = fileName . Split ( '_' ) . FirstOrDefault ( ) ;
109
109
}
@@ -124,7 +124,7 @@ private void OnRestore(object sender, EventArgs e)
124
124
DatabaseName = DatabaseElem . Text . Trim ( ) ,
125
125
ActionTypeValue = ActionSelectorElem . SelectedValue . ToString ( ) ,
126
126
IsForPgDump = ( TypeSelectorElem . SelectedValue . ToString ( ) == CommandTypeConstants . PgDump . key ) ,
127
- RestoreFileLocation = TargetLocation . FileName . Trim ( ) ,
127
+ RestoreFileLocation = SelectedFilelbl . Text . Trim ( ) ,
128
128
}
129
129
. Validate ( ) ;
130
130
@@ -140,7 +140,7 @@ private void OnRestore(object sender, EventArgs e)
140
140
{
141
141
CommandExecutor . ExecuteRestore ( connection ) ;
142
142
} ;
143
-
143
+
144
144
bgw . RunWorkerCompleted += ( object _ , RunWorkerCompletedEventArgs args ) =>
145
145
{
146
146
if ( args . Error == null )
@@ -155,23 +155,25 @@ private void OnRestore(object sender, EventArgs e)
155
155
}
156
156
FinalizeLoadingFinished ( ) ;
157
157
} ;
158
- bgw . RunWorkerAsync ( ) ;
158
+ bgw . RunWorkerAsync ( ) ;
159
159
}
160
160
catch ( Exception ex )
161
161
{
162
- MessageBox . Show ( ex . Message , "Oops!" , MessageBoxButtons . OK , MessageBoxIcon . Warning ) ;
162
+ MessageBox . Show ( ex . Message , "Oops!" , MessageBoxButtons . OK , MessageBoxIcon . Warning ) ;
163
163
FinalizeLoadingFinished ( ) ;
164
164
}
165
165
finally
166
166
{
167
167
Environment . SetEnvironmentVariable ( PostgresConstants . PasswordKey , string . Empty ) ;
168
+ isRestoring = false ;
168
169
}
169
170
}
170
171
171
172
private void FinalizeLoadingFinished ( )
172
173
{
173
174
EndLoading ( ) ;
174
- SelectedFilelbl . Text = "No file Selected" ;
175
+ SelectedFilelbl . Text = string . Empty ;
176
+ DatabaseElem . Text = string . Empty ;
175
177
RestoreBtn . Text = "⚒ Restore" ;
176
178
isRestoring = false ;
177
179
}
0 commit comments