using com.superscene.ui;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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;

namespace parkMonitor.view.util {
	/// <summary>
	/// 按照步骤 1a 或 1b 操作，然后执行步骤 2 以在 XAML 文件中使用此自定义控件。
	///
	/// 步骤 1a) 在当前项目中存在的 XAML 文件中使用该自定义控件。
	/// 将此 XmlNamespace 特性添加到要使用该特性的标记文件的根 
	/// 元素中: 
	///
	///     xmlns:MyNamespace="clr-namespace:parkMonitor.view.util.tabMenu.devMenuItemMulitClick"
	///
	///
	/// 步骤 1b) 在其他项目中存在的 XAML 文件中使用该自定义控件。
	/// 将此 XmlNamespace 特性添加到要使用该特性的标记文件的根 
	/// 元素中: 
	///
	///     xmlns:MyNamespace="clr-namespace:parkMonitor.view.util.tabMenu.devMenuItemMulitClick;assembly=parkMonitor.view.util.tabMenu.devMenuItemMulitClick"
	///
	/// 您还需要添加一个从 XAML 文件所在的项目到此项目的项目引用，
	/// 并重新生成以避免编译错误: 
	///
	///     在解决方案资源管理器中右击目标项目，然后依次单击
	///     “添加引用”->“项目”->[浏览查找并选择此项目]
	///
	///
	/// 步骤 2)
	/// 继续操作并在 XAML 文件中使用控件。
	///
	///     <MyNamespace:DevMenuItemMulitClick/>
	///
	/// </summary>
	public class DevMenuItemMulitClick : Label {
		static DevMenuItemMulitClick() {
			DefaultStyleKeyProperty.OverrideMetadata(typeof(DevMenuItemMulitClick), new FrameworkPropertyMetadata(typeof(DevMenuItemMulitClick)));
		}

		public DevMenuItemMulitClick() {
			CmdClickServer = new SupRelayCommand(new Action(onClickServer));
			CmdClicenClient = new SupRelayCommand(new Action(onClicenClient));
		}

		//Source
		public static readonly DependencyProperty SourcePro = DependencyProperty.Register("Source", typeof(ImageSource), typeof(DevMenuItemMulitClick), new PropertyMetadata(null));
		public ImageSource Source {
			get { return (ImageSource)GetValue(SourcePro); }
			set { SetCurrentValue(SourcePro, value); }
		}

		//附加图片资源
		public static readonly DependencyProperty MiniSourcePro = DependencyProperty.Register("MiniSource", typeof(ImageSource), typeof(DevMenuItemMulitClick), new PropertyMetadata(null));
		public ImageSource MiniSource {
			get { return (ImageSource)GetValue(MiniSourcePro); }
			set { SetCurrentValue(MiniSourcePro, value); }
		}

		//IsSmall
		public static readonly DependencyProperty IsSmallPro = DependencyProperty.Register("IsSmall", typeof(bool), typeof(DevMenuItemMulitClick), new PropertyMetadata(false));
		public bool IsSmall {
			get { return (bool)GetValue(IsSmallPro); }
			set { SetCurrentValue(IsSmallPro, value); }
		}

		//Image Margin
		public static readonly DependencyProperty ImgMarginPro = DependencyProperty.Register("ImgMargin", typeof(Thickness), typeof(DevMenuItemMulitClick), new PropertyMetadata(new Thickness(0)));
		public Thickness ImgMargin {
			get { return (Thickness)GetValue(ImgMarginPro); }
			set { SetCurrentValue(ImgMarginPro, value); }
		}

		//Mouse Over Color
		public static readonly DependencyProperty MouseOverColorProperty = DependencyProperty.Register("MouseOverColor", typeof(Brush), typeof(DevMenuItemMulitClick), new PropertyMetadata(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#636363"))));
		public Brush MouseOverColor {
			get { return (Brush)GetValue(MouseOverColorProperty); }
			set { SetCurrentValue(MouseOverColorProperty, value); }
		}

		//click server
		public static readonly DependencyProperty IsClickServerProperty = DependencyProperty.Register("IsClickServer", typeof(bool), typeof(DevMenuItemMulitClick), new FrameworkPropertyMetadata(false) { BindsTwoWayByDefault = true });
		public bool IsClickServer {
			get { return (bool)GetValue(IsClickServerProperty); }
			set { SetCurrentValue(IsClickServerProperty, value); }
		}
		public static readonly DependencyProperty CmdClickServerProperty = DependencyProperty.Register("CmdClickServer", typeof(ICommand), typeof(DevMenuItemMulitClick));
		public ICommand CmdClickServer {
			get { return (ICommand)GetValue(CmdClickServerProperty); }
			set { SetCurrentValue(CmdClickServerProperty, value); }
		}
		private void onClickServer() {
			IsClickServer = true;
		}

		//click client
		public static readonly DependencyProperty IsClicenClientProperty = DependencyProperty.Register("IsClicenClient", typeof(bool), typeof(DevMenuItemMulitClick), new FrameworkPropertyMetadata(false) { BindsTwoWayByDefault = true });
		public bool IsClicenClient {
			get { return (bool)GetValue(IsClicenClientProperty); }
			set { SetCurrentValue(IsClicenClientProperty, value); }
		}
		public static readonly DependencyProperty CmdClicenClientProperty = DependencyProperty.Register("CmdClicenClient", typeof(ICommand), typeof(DevMenuItemMulitClick));
		public ICommand CmdClicenClient {
			get { return (ICommand)GetValue(CmdClicenClientProperty); }
			set { SetCurrentValue(CmdClicenClientProperty, value); }
		}
		private void onClicenClient() {
			IsClicenClient = true;
		}

	}

}
