using com.superscene.ui;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
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>设备详情</summary>
	public class DevDetail : ListBox {
		static DevDetail() {
			DefaultStyleKeyProperty.OverrideMetadata(typeof(DevDetail), new FrameworkPropertyMetadata(typeof(DevDetail)));
		}

		public DevDetail() {
			CmdOnClickWrite = new SupRelayCommand(new Action(onClickWriteFun));
			CmdOnClickReset = new SupRelayCommand(new Action(onClickResetFun));
		}

		//name列宽
		public static readonly DependencyProperty grdLenNamePro = DependencyProperty.Register("grdLenName", typeof(GridLength), typeof(DevDetail), new PropertyMetadata(new GridLength(30, GridUnitType.Star)));
		public GridLength grdLenName {
			get { return (GridLength)GetValue(grdLenNamePro); }
			set { SetCurrentValue(grdLenNamePro, value); }
		}

		//value列宽
		public static readonly DependencyProperty grdLenValuePro = DependencyProperty.Register("grdLenValue", typeof(GridLength), typeof(DevDetail), new PropertyMetadata(new GridLength(70, GridUnitType.Star)));
		public GridLength grdLenValue {
			get { return (GridLength)GetValue(grdLenValuePro); }
			set { SetCurrentValue(grdLenValuePro, value); }
		}

		//点击写入按钮
		public static readonly DependencyProperty OnClickWriteProperty = DependencyProperty.Register("OnClickWrite", typeof(ICommand), typeof(DevDetail));
		public ICommand CmdOnClickWrite {
			get { return (ICommand)GetValue(OnClickWriteProperty); }
			set { SetCurrentValue(OnClickWriteProperty, value); }
		}

		private void onClickWriteFun() {
			RoutedEventArgs arg = new RoutedEventArgs(ClickWriteProperty, this);
			RaiseEvent(arg);
		}

		public static readonly RoutedEvent ClickWriteProperty = EventManager.RegisterRoutedEvent("ClickWrite", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(DevDetail));
		public event RoutedEventHandler ClickWrite {
			add { AddHandler(ClickWriteProperty, value); }
			remove { RemoveHandler(ClickWriteProperty, value); }
		}

		//点击复位按钮
		public static readonly DependencyProperty OnClickResetProperty = DependencyProperty.Register("OnClickReset", typeof(ICommand), typeof(DevDetail));
		public ICommand CmdOnClickReset {
			get { return (ICommand)GetValue(OnClickResetProperty); }
			set { SetCurrentValue(OnClickResetProperty, value); }
		}

		private void onClickResetFun() {
			RoutedEventArgs arg = new RoutedEventArgs(ClickResetProperty, this);
			RaiseEvent(arg);
		}

		public static readonly RoutedEvent ClickResetProperty = EventManager.RegisterRoutedEvent("ClickReset", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(DevDetail));
		public event RoutedEventHandler ClickReset {
			add { AddHandler(ClickResetProperty, value); }
			remove { RemoveHandler(ClickResetProperty, value); }
		}

	}
}
