2026-01-26 14:51:28 +09:00

61 lines
1.8 KiB
C#

using Aurora.Api;
using System.Windows;
using System.ComponentModel;
using System.Windows.Threading;
using VisionCommon;
using System.Windows.Media.Imaging;
using System;
using System.IO;
namespace VisionCommonUI {
public partial class VerifyParentImageWindow : Window {
private static Logger _Logger = new Logger(typeof(VerifyParentImageWindow).Name);
private FovInfo _FovInfo;
public static VerifyParentImageWindow _Instance = null;
private static readonly object _Lock = new object();
private delegate void HideWindow();
public static VerifyParentImageWindow Instance {
get {
lock (_Lock) {
if (_Instance == null) {
_Instance = new VerifyParentImageWindow();
}
return _Instance;
}
}
}
private VerifyParentImageWindow() {
InitializeComponent();
}
public void Show(string filePath) {
try {
if (File.Exists(filePath)) {
var bi = new BitmapImage();
bi.BeginInit();
bi.CacheOption = BitmapCacheOption.OnLoad;
bi.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
bi.UriSource = new Uri(filePath);
bi.EndInit();
imgVerifyParentImage.Source = bi;
}
}
catch (Exception e) {
_Logger.FuncE(e.Message);
}
this.Show();
}
protected override void OnClosing(CancelEventArgs e) {
e.Cancel = true;
Dispatcher.BeginInvoke(DispatcherPriority.Normal, new HideWindow(_HideWindow));
}
private void _HideWindow() {
this.Hide();
}
}
}