121 lines
4.3 KiB
C#
121 lines
4.3 KiB
C#
|
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
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// PBStoreAgree.xaml에 대한 상호 작용 논리
|
|||
|
/// </summary>
|
|||
|
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));
|
|||
|
/// <summary>
|
|||
|
/// Command
|
|||
|
/// </summary>
|
|||
|
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); }
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Command
|
|||
|
/// </summary>
|
|||
|
public ICommand Command
|
|||
|
{
|
|||
|
get { return (ICommand)GetValue(CommandProperty); }
|
|||
|
set { SetValue(CommandProperty, value); }
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// Store Data
|
|||
|
/// </summary>
|
|||
|
public M_StoreAgree StoreData
|
|||
|
{
|
|||
|
get { return (M_StoreAgree)GetValue(StoreDataProperty); }
|
|||
|
set { SetValue(StoreDataProperty, value); }
|
|||
|
}
|
|||
|
#region [ Make RoutedEvent 'MouseClicked']
|
|||
|
/// <summary>
|
|||
|
/// MouseClicked Event
|
|||
|
/// </summary>
|
|||
|
public static readonly RoutedEvent MouseClickedEvent = EventManager.RegisterRoutedEvent(nameof(MouseClicked), RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(PBStoreAgree));
|
|||
|
/// <summary>
|
|||
|
/// MouseClicked Routed Event Handler
|
|||
|
/// </summary>
|
|||
|
public event RoutedEventHandler MouseClicked
|
|||
|
{
|
|||
|
add { AddHandler(MouseClickedEvent, value); }
|
|||
|
remove { RemoveHandler(MouseClickedEvent, value); }
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// Raise MouseClicked Event
|
|||
|
/// </summary>
|
|||
|
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);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|