Kyungshin-Welder/AuroraVision/VisionCommonUI/MesssageBox/MessageBoxQuestionOption_Modaless.xaml.cs
2026-01-26 14:51:28 +09:00

96 lines
2.8 KiB
C#

/*
* Copyright (c) 2025 LG Electronics Inc.
* SPDX-License-Identifier: LicenseRef-LGE-Proprietary
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace VisionCommonUI {
/// <summary>
/// MessageBoxQuestionOption_Modaless.xaml에 대한 상호 작용 논리
/// </summary>
public partial class MessageBoxQuestionOption_Modaless : Window {
public MessageBoxResult MsgBoxResult { get; set; } = MessageBoxResult.None;
public int SelIndex { get; set; }
private bool _IsComplete = false;
public bool IsComplete {
get {
lock (lockObject) {
return _IsComplete;
}
}
set {
lock (lockObject) {
_IsComplete = value;
}
}
}
private object lockObject = new object();
public MessageBoxQuestionOption_Modaless(string title, params string[] optionList) {
InitializeComponent();
tboxOptionTitle.Text = title;
foreach (var option in optionList) {
cbboxOptions.Items.Add(option);
}
if (optionList.Length != 0) {
cbboxOptions.SelectedIndex = 0;
}
else {
cbboxOptions.SelectedIndex = -1;
}
}
public MessageBoxResult Show(string statusMsg) {
tbStatusMessage.Text = statusMsg;
this.Show();
return MsgBoxResult;
}
private void MessageBox_KeyDown(object sender, KeyEventArgs e) {
if (e.Key == Key.Enter) {
Button_Click_Question_Yes(sender, e);
}
else if (e.Key == Key.Escape) {
Button_Click_Question_No(sender, e);
}
}
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) {
this.DragMove();
}
private void Button_Click_Question_Yes(object sender, RoutedEventArgs e) {
MsgBoxResult = MessageBoxResult.Yes;
tbStatusMessage.Text = string.Empty;
SelIndex = cbboxOptions.SelectedIndex;
IsComplete = true;
this.Close();
}
private void Button_Click_Question_No(object sender, RoutedEventArgs e) {
MsgBoxResult = MessageBoxResult.No;
tbStatusMessage.Text = string.Empty;
IsComplete = true;
this.Close();
}
}
}