using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ComponentModel; 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; using SPC.Kiosk.Base; using SPC.Kiosk.Common; using SPC.Kiosk.Popup.Model; namespace SPC.Kiosk.Popup { /// /// DiscountAndValue.xaml에 대한 상호 작용 논리 /// public partial class HappyAppCoupon : UserControl { #region [ Members ] /// /// ItemData /// public static readonly DependencyProperty ItemDataProperty = DependencyProperty.Register(nameof(ItemData), typeof(M_HappyCoupon), typeof(HappyAppCoupon), new PropertyMetadata(new M_HappyCoupon(), new PropertyChangedCallback(OnItemDataPropertyChanged))); private static void OnItemDataPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var target = d as HappyAppCoupon; } /// /// Display Language /// public static readonly DependencyProperty DisplayLanguagePropery = DependencyProperty.Register(nameof(DisplayLanguage), typeof(SupportLanguageType), typeof(HappyAppCoupon), new PropertyMetadata(SupportLanguageType.ko)); /// /// Button Switch /// public static readonly DependencyProperty SwitchPropery = DependencyProperty.Register(nameof(Switch), typeof(bool), typeof(HappyAppCoupon), new PropertyMetadata(false, new PropertyChangedCallback(OnSwitchProperyChanged))); /// /// Button Switch /// public bool Switch { get { return (bool)GetValue(SwitchPropery); } set { SetValue(SwitchPropery, value);} } /// /// ItemData /// public M_HappyCoupon ItemData { get { return (M_HappyCoupon)GetValue(ItemDataProperty); } set { SetValue(ItemDataProperty, value); } } /// /// Display Language /// public SupportLanguageType DisplayLanguage { get { return (SupportLanguageType)GetValue(DisplayLanguagePropery); } set { SetValue(DisplayLanguagePropery, value); } } /// /// Button NormalBrush /// public string ButtonNormalBrush { get; set; } public string ButtonDownBrush { get; set; } public string ButtonSwitchOnBrush { get; set; } public string ButtonDisableBrush { get; set; } #region [ RoutedEvent 'MouseClicked' ] /// /// MouseClicked Event /// public static readonly RoutedEvent MouseClickedEvent = EventManager.RegisterRoutedEvent(nameof(MouseClicked), RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(HappyAppCoupon)); /// /// MouseClicked Routed Event Handler /// public event RoutedEventHandler MouseClicked { add { AddHandler(MouseClickedEvent, value); } remove { RemoveHandler(MouseClickedEvent, value); } } #endregion RoutedEvent 'MouseClicked' #endregion Members #region [ Ctor & Etc ] /// /// Ctor /// public HappyAppCoupon() { ButtonNormalBrush = ResourceManager.GetNximagePathAdd("btn_coupon_n.png", CommonValue.PBdesignImagesPath); ButtonDownBrush = ResourceManager.GetNximagePathAdd("btn_coupon_p.png", CommonValue.PBdesignImagesPath); ButtonSwitchOnBrush = ResourceManager.GetNximagePathAdd("btn_coupon_s.png", CommonValue.PBdesignImagesPath); ButtonDisableBrush = ResourceManager.GetNximagePathAdd("btn_coupon_d.png", CommonValue.PBdesignImagesPath); InitializeComponent(); } #endregion Ctor & Etc #region [ Methods ] /// /// Raise MouseClicked Event /// private void RaiseMouseClickedEvent(object _sender) { RoutedEventArgs newEventArgs = new RoutedEventArgs(HappyAppCoupon.MouseClickedEvent, _sender); RaiseEvent(newEventArgs); } #endregion Methods #region [ Event Handlers ] private static void OnSwitchProperyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var target = d as HappyAppCoupon; target.OptionButton.Switch = (bool)e.NewValue; } private void OptionButton_MouseClicked(object sender, RoutedEventArgs e) { RaiseMouseClickedEvent(this.ItemData); } #endregion Event Handlers } }