using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading; 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 { /// /// PBStoreAgree.xaml에 대한 상호 작용 논리 /// public partial class PBStoreAgree : UserControl { public static readonly DependencyProperty StoreDataProperty = DependencyProperty.Register(nameof(StoreData), typeof(M_StoreAgree), typeof(PBStoreAgree), new PropertyMetadata(null, new PropertyChangedCallback(OnStoreDataPropertyChanged))); public static readonly DependencyProperty SelectedProperty = DependencyProperty.Register(nameof(Selected), typeof(bool), typeof(PBStoreAgree), new PropertyMetadata(false)); /// /// Command /// public static readonly DependencyProperty CommandProperty = DependencyProperty.Register(nameof(Command), typeof(ICommand), typeof(PBStoreAgree), new UIPropertyMetadata(null)); public bool Selected { get { return (bool)GetValue(SelectedProperty); } set { SetValue(SelectedProperty, value); } } /// /// Command /// public ICommand Command { get { return (ICommand)GetValue(CommandProperty); } set { SetValue(CommandProperty, value); } } /// /// Store Data /// public M_StoreAgree StoreData { get { return (M_StoreAgree)GetValue(StoreDataProperty); } set { SetValue(StoreDataProperty, value); } } #region [ Make RoutedEvent 'MouseClicked'] /// /// MouseClicked Event /// public static readonly RoutedEvent MouseClickedEvent = EventManager.RegisterRoutedEvent(nameof(MouseClicked), RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(PBStoreAgree)); /// /// MouseClicked Routed Event Handler /// public event RoutedEventHandler MouseClicked { add { AddHandler(MouseClickedEvent, value); } remove { RemoveHandler(MouseClickedEvent, value); } } /// /// Raise MouseClicked Event /// private void RaiseMouseClickedEvent(object _sender) { if (Command != null && Command.CanExecute(_sender)) { Command.Execute(_sender); } RoutedEventArgs newEventArgs = new RoutedEventArgs(PBStoreAgree.MouseClickedEvent, _sender); RaiseEvent(newEventArgs); } #endregion Make RoutedEvent 'MouseClicked' public PBStoreAgree() { InitializeComponent(); } private void ResetVisible() { this.WelcomInfo.Visibility = this.StoreData.IsFavoriteStore ? Visibility.Visible : Visibility.Collapsed; this.StoreInfo1.Visibility = this.StoreData.IsFavoriteStore ? Visibility.Collapsed : Visibility.Visible; this.StoreInfo2.Visibility = this.StoreData.IsFavoriteStore ? Visibility.Collapsed : Visibility.Visible; this.StoreAgree.Visibility = this.StoreData.IsFavoriteStore ? Visibility.Collapsed : Visibility.Visible; } private static void OnStoreDataPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var target = d as PBStoreAgree; if (e.NewValue is M_StoreAgree storeAgree) { target.ResetVisible(); } } private static void DisplayLanguageProperyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { } private void StoreAgree_MouseClicked(object sender, RoutedEventArgs e) { RaiseMouseClickedEvent(this.StoreData); } } }