@@ -136,7 +136,12 @@ private void MainWin_MouseDown(object sender, MouseButtonEventArgs e) {
136136
137137 private void Callback_AddToImageList ( ObjectInfo objInfo ) {
138138 //ObjectList.Add(new ObjectInfo(objInfo.FileSystemPath, FileFlags.Unknown));
139- ObjectList . Add ( objInfo ) ;
139+ var add = true ;
140+ Dispatcher . Invoke ( ( ) => {
141+ if ( AuxVisibility == Visibility . Collapsed && ( objInfo . ImageSources == null || objInfo . ImageSources . Length == 0 ) )
142+ add = false ;
143+ } ) ;
144+ if ( add ) ObjectList . Add ( objInfo ) ;
140145 }
141146
142147
@@ -467,25 +472,31 @@ private void Sidebar_Click(object sender, RoutedEventArgs e) {
467472 ButtonMinVisibility = AuxVisibility ;
468473 ButtonMaxVisibility = AuxVisibility ;
469474 TitleVisibility = AuxVisibility ;
470- for ( int i = 0 ; i < LB1 . Items . Count ; i ++ ) {
471- var thumb = ( ContentPresenter ) LB1 . ItemContainerGenerator . ContainerFromIndex ( i ) ;
472- var objInfo = ( ObjectInfo ) thumb . DataContext ;
473- if ( objInfo . ImageSources == null || objInfo . ImageSources . Length == 0 )
474- thumb . Visibility = AuxVisibility ;
475- }
475+ //for (int i = 0; i < LB1.Items.Count; i++) {
476+ // var thumb = (ContentPresenter)LB1.ItemContainerGenerator.ContainerFromIndex(i);
477+ // var objInfo = (ObjectInfo)thumb.DataContext;
478+ // if (objInfo.ImageSources == null || objInfo.ImageSources.Length == 0)
479+ // thumb.Visibility = AuxVisibility;
480+ //}
481+
476482 if ( AuxVisibility == Visibility . Collapsed ) {
477483 lastWindowPos = new Rect ( Left , Top , Width , Height ) ;
478484 var info = NativeHelpers . GetMonitorFromWindow ( this ) ;
479485 Top = info . Top ;
480486 Left = info . Left ;
481487 Width = info . Width ;
482488 Height = info . Height ;
489+ //remove error thumbs
490+ foreach ( var item in ObjectList . Where ( oi => oi . ImageSources == null || oi . ImageSources . Length == 0 ) . ToArray ( ) ) {
491+ ObjectList . Remove ( item ) ;
492+ }
483493 }
484494 else {
485495 Top = lastWindowPos . Top ;
486496 Left = lastWindowPos . Left ;
487497 Width = lastWindowPos . Width ;
488498 Height = lastWindowPos . Height ;
499+ Task . Run ( ( ) => LoadPath ( CurrentPath ) ) ;
489500 }
490501 break ;
491502 }
0 commit comments