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 KioskMessageBox { /// /// ShowMessageBox /// /// /// /// /// /// /// /// public static MessageBoxResult ShowMessageBox(List _message, OpenCloseAnimationType _openAnimationType = OpenCloseAnimationType.None, OpenCloseAnimationType _closeAnimationType = OpenCloseAnimationType.None, double _startEndOpacity = 0.5, double _animationSeconds = 0.2, double _waitTime = 0) { return ShowMessageBox(0, new Size(0, 0), null, null, _message, MessageBoxButton.OK, _openAnimationType, _closeAnimationType, _startEndOpacity, _animationSeconds, _waitTime); } /// /// ShowMessageBox /// /// /// /// /// /// /// /// /// public static MessageBoxResult ShowMessageBox(List _message, MessageBoxButton _boxButton, OpenCloseAnimationType _openAnimationType = OpenCloseAnimationType.None, OpenCloseAnimationType _closeAnimationType = OpenCloseAnimationType.None, double _startEndOpacity = 0.5, double _animationSeconds = 0.2, double _waitTime = 0) { return ShowMessageBox(0, new Size(0, 0), null, null, _message, _boxButton, _openAnimationType, _closeAnimationType, _startEndOpacity, _animationSeconds, _waitTime); } /// /// ShowMessageBox /// /// /// /// /// /// /// /// /// /// public static MessageBoxResult ShowMessageBox(List _title, List _message, MessageBoxButton _boxButton = MessageBoxButton.OK, OpenCloseAnimationType _openAnimationType = OpenCloseAnimationType.None, OpenCloseAnimationType _closeAnimationType = OpenCloseAnimationType.None, double _startEndOpacity = 0.5, double _animationSeconds = 0.2, double _waitTime = 0) { return ShowMessageBox(0, new Size(0, 0), _title, null, _message, _boxButton, _openAnimationType, _closeAnimationType, _startEndOpacity, _animationSeconds, _waitTime); } /// /// ShowMessageBox /// /// /// /// /// /// /// /// /// /// /// public static MessageBoxResult ShowMessageBox(List _title, List _subtitle, List _message, MessageBoxButton _boxButton = MessageBoxButton.OK, OpenCloseAnimationType _openAnimationType = OpenCloseAnimationType.None, OpenCloseAnimationType _closeAnimationType = OpenCloseAnimationType.None, double _startEndOpacity = 0.5, double _animationSeconds = 0.2, double _waitTime = 0) { return ShowMessageBox(0, new Size(0, 0), _title, _subtitle, _message, _boxButton, _openAnimationType, _closeAnimationType, _startEndOpacity, _animationSeconds, _waitTime); } /// /// ShowMessageBox /// /// /// /// /// /// /// /// /// /// /// /// public static MessageBoxResult ShowMessageBox(int _screenNo, List _title, List _subtitle, List _message, MessageBoxButton _boxButton = MessageBoxButton.OK, OpenCloseAnimationType _openAnimationType = OpenCloseAnimationType.None, OpenCloseAnimationType _closeAnimationType = OpenCloseAnimationType.None, double _startEndOpacity = 0.5, double _animationSeconds = 0.2, double _waitTime = 0) { return ShowMessageBox(_screenNo, new Size(0, 0), _title, _subtitle, _message, _boxButton, _openAnimationType, _closeAnimationType, _startEndOpacity, _animationSeconds, _waitTime); } /// /// ShowMessageBox /// /// /// /// /// /// /// /// /// /// /// /// public static MessageBoxResult ShowMessageBox(Size _size, List _title, List _subtitle, List _message, MessageBoxButton _boxButton, OpenCloseAnimationType _openAnimationType = OpenCloseAnimationType.None, OpenCloseAnimationType _closeAnimationType = OpenCloseAnimationType.None, double _startEndOpacity = 0.5, double _animationSeconds = 0.2, double _waitTime = 0) { return ShowMessageBox(0, _size, _title, _subtitle, _message, _boxButton, _openAnimationType, _closeAnimationType, _startEndOpacity, _animationSeconds, _waitTime); } /// /// ShowMessageBox /// /// /// /// /// /// /// /// /// /// /// /// /// public static MessageBoxResult ShowMessageBox(int _screenNo, Size _size, List _title, List _subtitle, List _message, MessageBoxButton _boxButton, OpenCloseAnimationType _openAnimationType = OpenCloseAnimationType.None, OpenCloseAnimationType _closeAnimationType = OpenCloseAnimationType.None, double _startEndOpacity = 0.5, double _animationSeconds = 0.2, double _waitTime = 0) { var result = MessageBoxResult.None; try { var frmMessageBox = new MessageBoxForm(_screenNo, _size, _boxButton, _openAnimationType, _closeAnimationType, _startEndOpacity, _animationSeconds, _waitTime); if (_title == null) { frmMessageBox.MessageHeader.Visibility = Visibility.Collapsed; } else { frmMessageBox.MessageHeader.MultiLanguage = _title; } if (_subtitle == null) { frmMessageBox.MessageSubHeader.Visibility = Visibility.Collapsed; } else { frmMessageBox.MessageSubHeader.MultiLanguage = _subtitle; } frmMessageBox.Message.MultiLanguage = _message; switch (_boxButton) { case MessageBoxButton.OK: frmMessageBox.Yes_Button.Width = frmMessageBox.BoxBase.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.BoxBase.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.BoxBase.Width / 2; frmMessageBox.Cancel_Button.LanguageText = Languages.GetMessages("BTN0033"); frmMessageBox.Cancel_Button.HorizontalAlignment = HorizontalAlignment.Right; break; case MessageBoxButton.YesNo: frmMessageBox.Yes_Button.Width = frmMessageBox.BoxBase.Width / 2; frmMessageBox.Yes_Button.LanguageText = Languages.GetMessages("BTN0005"); frmMessageBox.Yes_Button.HorizontalAlignment = HorizontalAlignment.Left; frmMessageBox.No_Button.Width = frmMessageBox.BoxBase.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.BoxBase.Width / 3; frmMessageBox.Yes_Button.LanguageText = Languages.GetMessages("BTN0005"); frmMessageBox.Yes_Button.HorizontalAlignment = HorizontalAlignment.Left; frmMessageBox.No_Button.Width = frmMessageBox.BoxBase.Width / 3; frmMessageBox.No_Button.LanguageText = Languages.GetMessages("BTN0021"); frmMessageBox.No_Button.HorizontalAlignment = HorizontalAlignment.Center; frmMessageBox.Cancel_Button.Width = frmMessageBox.BoxBase.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", "KioskMessageBox", "ShowMessageBox()", "Fail !!", string.Format("{0}\n{1}", ex.Message, ex.StackTrace)); result = MessageBoxResult.None; } return result; } /// /// Show Time Message Box /// /// /// /// /// /// /// public static void TimeMessageBox(List _message, OpenCloseAnimationType _openAnimationType = OpenCloseAnimationType.None, OpenCloseAnimationType _closeAnimationType = OpenCloseAnimationType.None, double _startEndOpacity = 0.5, double _animationSeconds = 0.2, double _waitTime = 5) { TimeMessageBox(0, new Size(0, 0), null, null, _message, _openAnimationType, _closeAnimationType, _startEndOpacity, _animationSeconds, _waitTime); } /// /// Show Time Message Box /// /// /// /// /// /// /// /// public static void TimeMessageBox(List _title, List _message, OpenCloseAnimationType _openAnimationType = OpenCloseAnimationType.None, OpenCloseAnimationType _closeAnimationType = OpenCloseAnimationType.None, double _startEndOpacity = 0.5, double _animationSeconds = 0.2, double _waitTime = 5) { TimeMessageBox(0, new Size(0, 0), _title, null, _message, _openAnimationType, _closeAnimationType, _startEndOpacity, _animationSeconds, _waitTime); } /// /// Show Time Message Box /// /// /// /// /// /// /// /// /// public static void TimeMessageBox(List _title, List _subtitle, List _message, OpenCloseAnimationType _openAnimationType = OpenCloseAnimationType.None, OpenCloseAnimationType _closeAnimationType = OpenCloseAnimationType.None, double _startEndOpacity = 0.5, double _animationSeconds = 0.2, double _waitTime = 5) { TimeMessageBox(0, new Size(0, 0), _title, _subtitle, _message, _openAnimationType, _closeAnimationType, _startEndOpacity, _animationSeconds, _waitTime); } /// /// Show Time Message Box /// /// /// /// /// /// /// /// /// /// public static void TimeMessageBox(int _screenNo, List _title, List _subtitle, List _message, OpenCloseAnimationType _openAnimationType = OpenCloseAnimationType.None, OpenCloseAnimationType _closeAnimationType = OpenCloseAnimationType.None, double _startEndOpacity = 0.5, double _animationSeconds = 0.2, double _waitTime = 5) { TimeMessageBox(_screenNo, new Size(0, 0), _title, _subtitle, _message, _openAnimationType, _closeAnimationType, _startEndOpacity, _animationSeconds, _waitTime); } /// /// Show Time Message Box /// /// /// /// /// /// /// /// /// /// public static void TimeMessageBox( Size _size, List _title, List _subtitle, List _message, OpenCloseAnimationType _openAnimationType = OpenCloseAnimationType.None, OpenCloseAnimationType _closeAnimationType = OpenCloseAnimationType.None, double _startEndOpacity = 0.5, double _animationSeconds = 0.2, double _waitTime = 5) { TimeMessageBox(0, _size, _title, _subtitle, _message, _openAnimationType, _closeAnimationType, _startEndOpacity, _animationSeconds, _waitTime); } /// /// Show Time Message Box /// /// /// /// /// /// /// /// /// /// /// public static void TimeMessageBox(int _screenNo, Size _size, List _title, List _subtitle, List _message, OpenCloseAnimationType _openAnimationType = OpenCloseAnimationType.None, OpenCloseAnimationType _closeAnimationType = OpenCloseAnimationType.None, double _startEndOpacity = 0.5, double _animationSeconds = 0.2, double _waitTime = 5) { try { if (_message is List && !string.IsNullOrEmpty(_message.GetLanguageData(SupportLanguageType.ko))) { var frmMessageBox = new MessageBoxForm(_screenNo, _size, _openAnimationType, _closeAnimationType, _startEndOpacity, _animationSeconds, _waitTime); if (_title == null) { frmMessageBox.MessageHeader.Visibility = Visibility.Collapsed; } else { frmMessageBox.MessageHeader.MultiLanguage = _title; } if (_subtitle == null) { frmMessageBox.MessageSubHeader.Visibility = Visibility.Collapsed; } else { frmMessageBox.MessageHeader.MultiLanguage = _title; } frmMessageBox.Message.MultiLanguage = _message; frmMessageBox.ShowDialog(); frmMessageBox = null; } } catch (Exception ex) { CommonLog.ErrorLogWrite("SPC.Kiosk.Common", "KioskMessageBox", "TimeMessageBox()", "Fail !!", string.Format("{0}\n{1}", ex.Message, ex.StackTrace)); } } } }