2026-01-26 18:56:53 +09:00

55 lines
1.8 KiB
C#

/*
* Copyright (c) 2025 LG Electronics Inc.
* SPDX-License-Identifier: LicenseRef-LGE-Proprietary
*/
using System.Windows;
using System.Windows.Input;
namespace VisionCommonUI {
public partial class MessageBoxQuestionOption : Window {
MessageBoxResult mMessageBoxResult = MessageBoxResult.None;
public int SelIndex { get; set; }
public MessageBoxQuestionOption(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 ShowDialog(string statusMsg) {
tbStatusMessage.Text = statusMsg;
this.ShowDialog();
return mMessageBoxResult;
}
private void Button_Click_Question_Yes(object sender, RoutedEventArgs e) {
mMessageBoxResult = MessageBoxResult.Yes;
tbStatusMessage.Text = string.Empty;
SelIndex = cbboxOptions.SelectedIndex;
this.Close();
}
private void Button_Click_Question_No(object sender, RoutedEventArgs e) {
mMessageBoxResult = MessageBoxResult.No;
tbStatusMessage.Text = string.Empty;
this.Close();
}
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);
}
}
}
}