/* * Copyright (c) 2025 LG Electronics Inc. * SPDX-License-Identifier: LicenseRef-LGE-Proprietary */ 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 VisionUI { 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(); } } }