//异步方法
private void GetText(object ex)
{
//Imge_ShowArea.Dispatcher.Invoke(new Action(delegate//begainInvoke好用
//{
FileSystemEventArgs e= (FileSystemEventArgs)ex;
BitmapImage imag = new BitmapImage();
imag.BeginInit();
try
{
FileStream FS = new FileStream(e.FullPath, FileMode.Open);
imag.StreamSource = FS;
byte[] imagbyte = ToByteArray(imag);
FS.Close();
imag.EndInit();
Imge_ShowArea.Dispatcher.BeginInvoke(new Action(delegate
{
BitmapImage newimag = ToImage(imagbyte);
Imge_ShowArea.Source = newimag;
}));
if (m_IfAutoStart)
{
string paths = UserNameConverter(@”C:\Users\Administrator\Desktop\TARGET”, false, m_Count, “VID+PID”);//m_autoCount
File.Copy(e.FullPath, paths);
m_Count++;
}
}
catch (System.Exception esx)
{
}
//}));
}