158 lines
8.1 KiB
C#
158 lines
8.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Threading;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Input;
|
|
using System.Globalization;
|
|
using SPC.Kiosk.Base;
|
|
namespace SPC.Kiosk.Common
|
|
{
|
|
public static class PopupMessageBox
|
|
{
|
|
/// <summary>
|
|
/// Show Message Box
|
|
/// </summary>
|
|
/// <param name="_languageType"></param>
|
|
/// <param name="_message1"></param>
|
|
/// <param name="_Message2"></param>
|
|
/// <param name="_boxButton"></param>
|
|
/// <param name="_openAnimationType"></param>
|
|
/// <param name="_closeAnimationType"></param>
|
|
/// <param name="_startEndOpacity"></param>
|
|
/// <param name="_animationSeconds"></param>
|
|
/// <param name="_waitTime"></param>
|
|
/// <returns></returns>
|
|
public static MessageBoxResult ShowMessageBox(SupportLanguageType _languageType,
|
|
List<M_Language> _message1,
|
|
List<M_Language> _Message2,
|
|
MessageBoxButton _boxButton,
|
|
OpenCloseAnimationType _openAnimationType = OpenCloseAnimationType.FullSizeUp,
|
|
OpenCloseAnimationType _closeAnimationType = OpenCloseAnimationType.FullSizeDown,
|
|
double _startEndOpacity = 0.5,
|
|
double _animationSeconds = 0.2,
|
|
double _waitTime = 10d)
|
|
{
|
|
var result = MessageBoxResult.None;
|
|
try
|
|
{
|
|
|
|
|
|
var frmMessageBox = new PopupMessage(_languageType, _openAnimationType, _closeAnimationType, _startEndOpacity, _animationSeconds, _waitTime);
|
|
if (_message1 == null)
|
|
{
|
|
frmMessageBox.Message1.Visibility = Visibility.Collapsed;
|
|
}
|
|
else
|
|
{
|
|
frmMessageBox.Message1.MultiLanguage = _message1;
|
|
}
|
|
if (_Message2 == null)
|
|
{
|
|
frmMessageBox.Message2.Visibility = Visibility.Collapsed;
|
|
}
|
|
else
|
|
{
|
|
frmMessageBox.Message2.MultiLanguage = _Message2;
|
|
}
|
|
frmMessageBox.BoxButton = _boxButton;
|
|
switch (_boxButton)
|
|
{
|
|
case MessageBoxButton.OK:
|
|
frmMessageBox.Yes_Button.Width = frmMessageBox.FrameBase.Width;
|
|
frmMessageBox.Yes_Button.LanguageText = Languages.GetMessages("BTN0039");
|
|
frmMessageBox.Yes_Button.HorizontalAlignment = HorizontalAlignment.Center;
|
|
frmMessageBox.No_Button.Visibility = Visibility.Collapsed;
|
|
frmMessageBox.Cancel_Button.Visibility = Visibility.Collapsed;
|
|
break;
|
|
case MessageBoxButton.OKCancel:
|
|
frmMessageBox.Yes_Button.Width = frmMessageBox.FrameBase.Width / 2;
|
|
frmMessageBox.Yes_Button.LanguageText = Languages.GetMessages("BTN0039");
|
|
frmMessageBox.Yes_Button.HorizontalAlignment = HorizontalAlignment.Left;
|
|
frmMessageBox.No_Button.Visibility = Visibility.Collapsed;
|
|
frmMessageBox.Cancel_Button.Width = frmMessageBox.FrameBase.Width / 2;
|
|
frmMessageBox.Cancel_Button.LanguageText = Languages.GetMessages("BTN0033");
|
|
frmMessageBox.Cancel_Button.HorizontalAlignment = HorizontalAlignment.Right;
|
|
break;
|
|
case MessageBoxButton.YesNo:
|
|
frmMessageBox.Yes_Button.Width = frmMessageBox.FrameBase.Width / 2;
|
|
frmMessageBox.Yes_Button.LanguageText = Languages.GetMessages("BTN0005");
|
|
frmMessageBox.Yes_Button.HorizontalAlignment = HorizontalAlignment.Left;
|
|
frmMessageBox.No_Button.Width = frmMessageBox.FrameBase.Width / 2;
|
|
frmMessageBox.No_Button.LanguageText = Languages.GetMessages("BTN0021");
|
|
frmMessageBox.No_Button.HorizontalAlignment = HorizontalAlignment.Right;
|
|
frmMessageBox.Cancel_Button.Visibility = Visibility.Collapsed;
|
|
break;
|
|
case MessageBoxButton.YesNoCancel:
|
|
frmMessageBox.Yes_Button.Width = frmMessageBox.FrameBase.Width / 3;
|
|
frmMessageBox.Yes_Button.LanguageText = Languages.GetMessages("BTN0005");
|
|
frmMessageBox.Yes_Button.HorizontalAlignment = HorizontalAlignment.Left;
|
|
frmMessageBox.No_Button.Width = frmMessageBox.FrameBase.Width / 3;
|
|
frmMessageBox.No_Button.LanguageText = Languages.GetMessages("BTN0021");
|
|
frmMessageBox.No_Button.HorizontalAlignment = HorizontalAlignment.Center;
|
|
frmMessageBox.Cancel_Button.Width = frmMessageBox.FrameBase.Width / 3;
|
|
frmMessageBox.Cancel_Button.LanguageText = Languages.GetMessages("BTN0033");
|
|
frmMessageBox.Cancel_Button.HorizontalAlignment = HorizontalAlignment.Right;
|
|
break;
|
|
}
|
|
frmMessageBox.ShowDialog();
|
|
result = frmMessageBox.BoxResult;
|
|
frmMessageBox = null;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
CommonLog.ErrorLogWrite("SPC.Kiosk.Common", "PopupMessageBox", "TimeMessageBox()", "Fail !!", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
|
|
result = MessageBoxResult.None;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
public static void TimeMessageBox(SupportLanguageType _languageType,
|
|
List<M_Language> _message1,
|
|
List<M_Language> _Message2,
|
|
OpenCloseAnimationType _openAnimationType = OpenCloseAnimationType.FullSizeUp,
|
|
OpenCloseAnimationType _closeAnimationType = OpenCloseAnimationType.FullSizeDown,
|
|
double _startEndOpacity = 0.5,
|
|
double _animationSeconds = 0.2,
|
|
double _waitTime = 0.5)
|
|
{
|
|
try
|
|
{
|
|
if (_message1 is List<M_Language> && !string.IsNullOrEmpty(_message1.GetLanguageData(SupportLanguageType.ko)))
|
|
{
|
|
|
|
var frmMessageBox = new PopupMessage(_languageType, _openAnimationType, _closeAnimationType, _startEndOpacity, _animationSeconds, _waitTime);
|
|
if (_message1 == null)
|
|
{
|
|
frmMessageBox.Message1.Visibility = Visibility.Collapsed;
|
|
}
|
|
else
|
|
{
|
|
frmMessageBox.Message1.MultiLanguage = _message1;
|
|
}
|
|
if (_Message2 == null)
|
|
{
|
|
frmMessageBox.Message2.Visibility = Visibility.Collapsed;
|
|
}
|
|
else
|
|
{
|
|
frmMessageBox.Message2.MultiLanguage = _Message2;
|
|
}
|
|
frmMessageBox.Yes_Button.Width = 0;
|
|
frmMessageBox.No_Button.Width = 0;
|
|
frmMessageBox.Cancel_Button.Width = 0;
|
|
frmMessageBox.ShowDialog();
|
|
frmMessageBox = null;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
CommonLog.ErrorLogWrite("SPC.Kiosk.Common", "PopupMessageBox", "TimeMessageBox()", "Fail !!", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
|
|
}
|
|
}
|
|
}
|
|
} |