using parkMonitor.model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;

namespace parkMonitor.viewModel.devInfoPanel {

	/// <summary>设备信息面板ViewModel</summary>
	public class DevPanelItemVM : INotifyPropertyChanged {

		public DevPanelItemVM() {
			_Foreground = StyleModel.ins.devPanelColor(_ColorByStatus);
		}

		string _Name = "";
		public string Name {
			get { return _Name; }
			set { _Name = value; FirePropertyChanged("Name"); }
		}

		string _Info = "";
		public string Info {
			get { return _Info; }
			set { _Info = value; FirePropertyChanged("Info"); }
		}

		ComInfoStatus _ColorByStatus = ComInfoStatus.Normal;
		public ComInfoStatus ColorByStatus {
			get { return _ColorByStatus; }
			set { _ColorByStatus = value; Foreground = StyleModel.ins.devPanelColor(value); FirePropertyChanged("ColorByStatus"); }
		}

		Brush _Foreground = Brushes.Transparent;
		public Brush Foreground {
			get { return _Foreground; }
			set { _Foreground = value; FirePropertyChanged("Foreground"); }
		}

		public bool IsShow {
			get { return _Visibe == Visibility.Visible; }
			set { _Visibe = value ? Visibility.Visible : Visibility.Collapsed; FirePropertyChanged("IsShow"); }
		}

		Visibility _Visibe = Visibility.Visible;
		public Visibility Visibe {
			get { return _Visibe; }
			set { _Visibe = value; FirePropertyChanged("Visibe"); }
		}

		public virtual event PropertyChangedEventHandler PropertyChanged;
		public virtual void FirePropertyChanged(string propertyName) {
			if(PropertyChanged != null) {
				PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
			}
		}
	}
}
