using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;

namespace parkMonitor.model {
	public enum DevTreeItemShowType {
        /// <summary>文字</summary>
		Default,
        /// <summary>图片</summary>
		Image,
        /// <summary>图片文字</summary>
		ImageValue,
        /// <summary>图片list</summary>
		ImageList,
        /// <summary>文字list</summary>
		TextList
    }

	/// <summary>样式model</summary>
	public class StyleModel {
		public static readonly StyleModel ins = new StyleModel();

		Dictionary<string, Brush> mapColor = new Dictionary<string, Brush>();

		public StyleModel() {
			//	key				color
			string[] arrColor = new string[] {
				"Offline",	"#c8c8c8",
				"Normal",	"#fff",
				"Warning",	"#deec46",
				"Error",	"#ff3d3d"
			};

			for(int i = 0; i < arrColor.Length; i += 2) {
				Brush br = new SolidColorBrush((Color)ColorConverter.ConvertFromString(arrColor[i + 1]));
				br.Freeze();
				mapColor[arrColor[i + 0]] = br;
			}
		}

		/// <summary>设备信息面板颜色</summary>
		public Brush devPanelColor(ComInfoStatus status) {
			//Brush color = Brushes.Transparent;

			string str = status.ToString();

			if(mapColor.ContainsKey(str)) {
				return mapColor[str];
			}
			return Brushes.Transparent;
		}

		/// <summary>设备信息面板颜色</summary>
		public Brush devPanelColor(AlarmStatus status) {
			string str = status.ToString();

			if(mapColor.ContainsKey(str)) {
				return mapColor[str];
			}
			return Brushes.Transparent;
		}

	}
}
