Esempio n. 1
0
        private void ExCmdAdd()
        {
            _dtAdd = DateTime.Now;
            var info = new TmlFaultTypeViewModel(new FaultTypes.FaultTypeItem()
            {
                Color             = "#FFFFFF",
                FaultCheckKey     = "",
                FaultId           = 0,
                FaultName         = "自定义故障",
                FaultNameByDefine = "自定义故障",
                FaultRemak        = "",
                IsEnable          = false,
                AlarmTimeSet      = 0,
                AlarmTimeStart    = 0,
                AlarmTimeEnd      = 0,
                PriorityLevel     = 0,
            });

            this.Records.Add(info);
            if (Records.Count > 0)
            {
                this.Records.Last().SelectColor = new TmlFaultTypeViewModel.NameColor()
                {
                    Name = "黑色", Color = "#FF000000", Index = 0
                };
                this.Records.Last().SelectAlarmTimeTypeIndex = new NameValueInt()
                {
                    Name = "全天", Value = 0
                };
                this.Records.Last().CurrentSelectProprity = new PriorityLevelHelper()
                {
                    Name = "普通报警", Priority = 2
                };
            }
        }
Esempio n. 2
0
        public void NavOnLoad(params object[] parsObjects)
        {
            IsCheckedRules = false;

            Records.Clear();
            _isvmsettime  = true;
            this.TimeLong = Sr.EquipemntLightFault.Services.TmlFaultTypeInfoServices.GetTimeAlarmLong;
            _isvmsettime  = false;

            this.VolBelow = Sr.EquipemntLightFault.Services.TmlFaultTypeInfoServices.GetVolBelow;
            LdlBelow      = Convert.ToInt32(Sr.EquipemntLightFault.Services.TmlFaultTypeInfoServices.GetLdlBelow * 100);

            var tmpg = new ObservableCollection <TmlFaultTypeViewModel>();
            //   bool allNotSelected = true;
            var tmpss =
                (from t in Sr.EquipemntLightFault.Services.TmlFaultTypeInfoServices.InfoDictionary
                 orderby t.Key ascending
                 select t.Value).ToList();

            foreach (var t in tmpss)
            {
                var f = new TmlFaultTypeViewModel(t);
                if (f.PriorityLevel == 0)
                {
                    f.PriorityLevel = 2;
                }
                tmpg.Add(f);
                //  if (t.Value.IsEnable) allNotSelected = false;
            }
            this.Records = tmpg;
            //if (allNotSelected)
            //{
            //    foreach (var t in this.Records) t.IsEnable = true;
            //}

            _dtSave = DateTime.Now.AddHours(-1);
            //this._recordsHash = this.GetObservableCollectionHashCode(Records);

            bool noselected = true;

            foreach (var t in this.Records)
            {
                if (t.IsEnable)
                {
                    noselected = false;
                    break;
                }
            }
            if (noselected)
            {
                foreach (var t in this.Records)
                {
                    t.IsEnable = true;
                }
            }
        }