using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Aitex.Core.UI.MVVM;
using System.Windows.Input;
using System.Collections.ObjectModel;
using System.Windows;
using Aitex.Core.RT.Log;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;
using Aitex.Core.RT.Event;
using MECF.Framework.Common.DataCenter;
namespace Aitex.Core.UI.View.Common
{
    /// 
    /// 操作记录查询结果结构定义
    /// 
    public class SystemLogItem
    {
        public string ID { get; set; }
        /// 
        /// 时间
        /// 
        public string Time { get; set; }
        /// 
        /// ICON 
        /// 
        public object Icon { get; set; }
        /// 
        /// 类型:操作日志|事件|其他
        /// 
        public string LogType { get; set; }
        /// 
        /// 针对腔体
        /// 
        public string TargetChamber { get; set; }
        /// 
        /// 发起方
        /// 
        public string Initiator { get; set; }
        /// 
        /// 详情
        /// 
        public string Detail { get; set; }
    }
    
    public class EventViewModel : ViewModelBase
    {
        public bool SearchAlarmEvent { get; set; }
        public bool SearchWarningEvent { get; set; }
        public bool SearchInfoEvent { get; set; }
        public bool SearchOpeLog { get; set; }
        public bool SearchPMA { get; set; }
        public bool SearchPMB { get; set; }
        public bool SearchPMC { get; set; }
        public bool SearchPMD { get; set; }
        //public bool SearchCoolDown { get; set; }
        public bool SearchTM { get; set; }
        public bool SearchLL { get; set; }
        //public bool SearchBuf1 { get; set; }
        public bool SearchSystem { get; set; }
        public string SearchKeyWords { get; set; }
        public ICommand SearchCommand { get; set; }
        public ICommand ExportCommand { get; set; }
        public DateTime SearchBeginTime { get; set; }
        public DateTime SearchEndTime { get; set; }
        public string Keywords { get; set; }
        public ObservableCollection EventList { get; set; }
        public string SelectedEvent { get; set; }
        public ObservableCollection UserList { get; set; }
        public string SelectedUser { get; set; }
        public ObservableCollection SearchedResult { get; set; }
        public Func> QueryDBEventFunc { get; set; }
        public Func> QueryEventList { get; set; }
        public EventViewModel()
        {
            var now = DateTime.Today;
            SearchBeginTime = now;// -new TimeSpan(1, 0, 0, 0);
            SearchEndTime = new DateTime(now.Year, now.Month, now.Day, 23, 59, 59, 999);
            SelectedUser = "All";
            SearchKeyWords = string.Empty;
            SearchAlarmEvent = true;
            SearchWarningEvent = true;
            SearchInfoEvent = true;
            SearchOpeLog = false;
            SearchPMA = false;
            SearchPMB = false;
            SearchPMC = false;
            SearchPMD = false;
            //SearchCoolDown = false;
            SearchTM = false;
            SearchLL = false;
            //SearchBuf1 = false;
            SearchSystem = false;
        }
        /// 
        /// 预先载入数据
        /// 
        public void Preload()
        {
            SearchCommand = new DelegateCommand