Esempio n. 1
0
 private void Watcher_Created(object sender, FileSystemEventArgs e)
 {
     // new file got created, adding it to the list
     Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() =>
     {
         Boolean success = false;
         while (!success)
         {
             //wait for copying to complete
             if (File.Exists(e.FullPath))
             {
                 try
                 {
                     ImageFile item = new ImageFile(e.FullPath);
                     Photos.Insert(0, item);
                     PhotoListBox.SelectedIndex = 0;
                     CurrentPhoto.Source        = (BitmapSource)item.Image;
                     success = true;
                 }
                 catch (Exception exc)
                 {
                 }
             }
         }
     }));
 }
 private void Watcher_Created(object sender, FileSystemEventArgs e)
 {
     // new file got created, adding it to the list
     Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() =>
     {
         if (File.Exists(e.FullPath))
         {
             ImageFile item = new ImageFile(e.FullPath);
             Photos.Insert(0, item);
             PhotoListBox.SelectedIndex = 0;
             CurrentPhoto.Source        = (BitmapSource)item.Image;
         }
     }));
 }