|
@@ -30,7 +30,7 @@ namespace MV485.uc
|
|
|
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Documents", "runConfig_log.txt");
|
|
|
|
|
|
private static readonly string ImageFilePath =
|
|
|
- Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Documents", "runConfig_read.jpg");
|
|
|
+ Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Documents", "runConfig_readImage.jpg");
|
|
|
|
|
|
|
|
|
private RWRunConfig _rwRunConfig; // = new RWRunConfig();
|
|
@@ -215,6 +215,10 @@ namespace MV485.uc
|
|
|
return;
|
|
|
}
|
|
|
imgMeter.Source = null;
|
|
|
+ if (File.Exists(ImageFilePath))
|
|
|
+ {
|
|
|
+ File.Delete(ImageFilePath);
|
|
|
+ }
|
|
|
|
|
|
ushort imageSize = _rwRunConfig.ReadImageSize(portName, baudrate, devId);
|
|
|
|
|
@@ -261,9 +265,19 @@ namespace MV485.uc
|
|
|
{
|
|
|
return receiver.StartReceiveFile(portName, baudrate, ImageFilePath, imageSize);
|
|
|
});
|
|
|
- if (blRecv)
|
|
|
+ if (blRecv && File.Exists(ImageFilePath))
|
|
|
{
|
|
|
- imgMeter.Source = new BitmapImage(new Uri(ImageFilePath, UriKind.RelativeOrAbsolute));
|
|
|
+ //imgMeter.Source = new BitmapImage(new Uri(ImageFilePath, UriKind.RelativeOrAbsolute));
|
|
|
+ using (FileStream fs = new FileStream(ImageFilePath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
|
|
+ {
|
|
|
+ BitmapImage bitmap = new BitmapImage();
|
|
|
+ bitmap.BeginInit();
|
|
|
+ bitmap.CacheOption = BitmapCacheOption.OnLoad;
|
|
|
+ bitmap.StreamSource = fs;
|
|
|
+ bitmap.EndInit();
|
|
|
+ bitmap.Freeze(); // 线程安全
|
|
|
+ imgMeter.Source = bitmap;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
catch { }
|
|
@@ -500,8 +514,8 @@ namespace MV485.uc
|
|
|
if(runConfig.LatestValueWRFlag && runConfig.LatestTimeWRFlag && runConfig.LatestTime != null)
|
|
|
{
|
|
|
txtLastValue.Text = ((int)(runConfig.LatestValue / Constant.CUBE_VALUE)).ToString();
|
|
|
- dtpLastValueTime.Text = runConfig.LatestTime.ToString("yyyy-MM-dd HH:mm");
|
|
|
- //runConfig.LatestTimeStr;
|
|
|
+ //dtpLastValueTime.Text = runConfig.LatestTime.ToString("yyyy-MM-dd HH:mm");
|
|
|
+ dtpLastValueTime.Value = runConfig.LatestTime;
|
|
|
}
|
|
|
|
|
|
if (runConfig.MeterRegion != null)
|