@@ -1208,7 +1208,7 @@ private void SetStateForNotesChanged(bool notesChanged, bool canUndo)
1208
1208
1209
1209
/// <summary>
1210
1210
/// Gets a list of documents based on the properties in
1211
- /// ApplicationGlobal.FindDocumentsParam
1211
+ /// ApplicationGlobal.FindDocumentsParam.
1212
1212
/// </summary>
1213
1213
/// <param name="selectCurrentDocument">
1214
1214
/// Select the current document after getting documents.
@@ -1252,11 +1252,9 @@ private void GetListOfDocuments(bool selectCurrentDocument)
1252
1252
documents = documentRepository . GetListOfDocuments ( ) ;
1253
1253
}
1254
1254
}
1255
- if ( ViewModel . Documents == null )
1256
- {
1257
- ViewModel . Documents = documents ;
1258
- }
1259
- else if ( documents . Compare ( ViewModel . Documents ) )
1255
+ if ( selectCurrentDocument &&
1256
+ documents . Compare ( ViewModel . Documents ) ||
1257
+ ! selectCurrentDocument )
1260
1258
{
1261
1259
ViewModel . Documents = documents ;
1262
1260
}
@@ -1267,13 +1265,16 @@ private void GetListOfDocuments(bool selectCurrentDocument)
1267
1265
}
1268
1266
finally
1269
1267
{
1270
- var columnName = ViewModel . Documents . Columns [ 0 ] . ColumnName ;
1271
- foreach ( DataRow row in ViewModel . Documents . Rows )
1268
+ if ( selectCurrentDocument )
1272
1269
{
1273
- var id = Convert . ToInt32 ( row [ columnName ] . ToString ( ) ) ;
1274
- if ( id . Equals ( currentDocumentId ) )
1270
+ var columnName = ViewModel . Documents . Columns [ 0 ] . ColumnName ;
1271
+ foreach ( DataRow row in ViewModel . Documents . Rows )
1275
1272
{
1276
- ViewModel . CurrentDocumentId = currentDocumentId ;
1273
+ var id = Convert . ToInt32 ( row [ columnName ] . ToString ( ) ) ;
1274
+ if ( id . Equals ( currentDocumentId ) )
1275
+ {
1276
+ ViewModel . CurrentDocumentId = currentDocumentId ;
1277
+ }
1277
1278
}
1278
1279
}
1279
1280
ViewModel . RefreshingDocumentsImageVisible = false ;
0 commit comments