Exemple #1
0
 public override void ExPublishedEvent(PublishEventArgs args)
 {
     if (args.EventId == Sr.EquipemntLightFault.Services.EventIdAssign.EquipmentExistFaultAddId)
     {
         var info = args.GetParams()[0] as List <int>;
         if (info == null)
         {
             return;
         }
         foreach (var t in info)
         {
             var ntgs = Wlst.Sr.EquipemntLightFault.Services.TmlExistFaultsInfoServices.GetFaultInfoById(t);
             if (ntgs != null)
             {
                 AddErrorInfo(ntgs, true);
             }
         }
     }
     if (args.EventId == EventIdAssign.EquipementExistFaultDeleteId)
     {
         var infos = args.GetParams()[0] as List <int>;
         if (infos == null)
         {
             return;
         }
         DeleteTmlFault(infos);
     }
 }
Exemple #2
0
        public void FundEventHandlers(PublishEventArgs args)
        {
            try
            {
                if (args.EventType == PublishEventType.Core)
                {
                    var recguid = args.GetParams()[1];
                    var rec     = args.GetParams()[0] as List <Tuple <int, int> >;
                    if (rec == null || rec.Count == 0)
                    {
                        return;
                    }
                    if (_sndguid == long.Parse(recguid.ToString()))
                    {
                        if (
                            WlstMessageBox.Show("上海五零盛同信息科技有限公司", "主设备增加成功,是否直接导航到配置界面进行设备参数设置",
                                                WlstMessageBoxType.YesNo) == WlstMessageBoxResults.Yes)
                        {
                            if (rec[0].Item1 > 1000000 && rec[0].Item1 < (1000000 + 99999))
                            {
                                object[] parsObjects = new object[] { rec[0].Item1, "newAdd3005" };

                                RegionManage.ShowViewByIdAttachRegionWithArgu(
                                    CurrentSelectEquipmentMoudle.ModuleInfoSetViewId, parsObjects);
                            }
                            else
                            {
                                RegionManage.ShowViewByIdAttachRegionWithArgu(
                                    CurrentSelectEquipmentMoudle.ModuleInfoSetViewId, rec[0].Item1);
                            }
                        }
                    }
                }
                if (args.EventType == "onuseraddslusgleequipment")
                {
                    if (args.GetParams().Count < 1)
                    {
                        return;
                    }
                    long recguid = 0;
                    if (Int64.TryParse(args.GetParams()[0].ToString(), out recguid))
                    {
                        if (_sndguid == recguid)
                        {
                            WlstMessageBox.Show("上海五零盛同信息科技有限公司", "单灯设备增加成功!",
                                                WlstMessageBoxType.Ok);
                        }
                    }
                }
            }
            catch (Exception xe)
            {
                WriteLog.WriteLogError("AddEquitment error in FundEventHandlers:ex:" + xe);
            }
        }
Exemple #3
0
        public override void ExPublishedEvent(PublishEventArgs args)
        {
            if (args.EventId == PublishEventTypeLocal.RcvGrpInfofromServerAndNeedUpdateGroupInfo)
            {
                this.NavOnLoad();
            }
            if (args.EventId == Wlst.Sr.EquipmentInfoHolding.Services.EventIdAssign.MulityInfoGroupAllNeedUpdate)
            {
                if (DateTime.Now.Ticks - dtSnd.Ticks < 600000000)
                {
                    Msg = DateTime.Now + " 更新成功!";
                }
                else
                {
                    Msg = DateTime.Now + " 收到更新数据!";
                }
                this.LoadItems();
            }
            if (args.EventType == PublishEventTypeLocal.Name &&
                args.EventId == PublishEventTypeLocal.DeleteGrpPathByCommandBasicShowGroupManage)
            {
                int    id      = -1;
                int    grpId   = -1;
                int    treeId  = -1;
                string grpName = "";
                try
                {
                    grpName = Convert.ToString(args.GetParams()[2]);
                    foreach (var t in ChildTreeItems)
                    {
                        if (t.NodeName == grpName)
                        {
                            treeId = t.NodeId;
                        }
                    }
                    id    = Convert.ToInt32(args.GetParams()[0]);
                    grpId = Convert.ToInt32(args.GetParams()[1]);
                }
                catch (Exception ex)
                {
                    return;
                }
                if (id == -1 || grpId == -1)
                {
                    return;
                }


                DeletePath(id, grpId);
                foreach (var t in _ChildTreeItems)
                {
                    t.DeleteTmlNodeByFather(id, treeId);
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        private void FundEventHandler(PublishEventArgs args)
        {
            try
            {
                //Async.Run(new Action<object>(ExExecuteEvent), args);

                AddNewRecordItem(args.EventId, args.EventType, OperatrType.SystemInfo,
                                 args.GetParams().Count > 0 ? args.GetParams()[0].ToString() : "None");
            }
            catch (Exception ex)
            {
            }
        }
 public override void ExPublishedEvent(
     PublishEventArgs args)
 {
     try
     {
         if (args.EventId == Sr.EquipmentInfoHolding.Services.EventIdAssign.EquipmentSelected)
         {
             int id = Convert.ToInt32(args.GetParams()[0]);
             if (id > 1000000 && id < 1100000)
             {
                 Indexs = 0;
             }
             if (id > 1500000 && id < 1600000)
             {
                 Indexs = 1;
             }
             if (id > 1600000 && id < 1700000)
             {
                 Indexs = 2;
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #6
0
        public void FundEventHandler(PublishEventArgs args) // should do somework
        {
            _canEx = false;
            try
            {
                int x = 0;
                if (args.EventId == Sr.EquipmentInfoHolding.Services.EventIdAssign.EquipmentSelected)
                {
                    x = Convert.ToInt32(args.GetParams()[0]);
                }
                if (x == 0)
                {
                    return;
                }

                if (
                    Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.
                    ContainsKey(x))
                {
                    if (Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[x].EquipmentType == WjParaBase.EquType.Rtu)
                    {
                        _rtuId = x;
                        _canEx = true;
                    }
                }
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
        }
        public override void ExPublishedEvent(PublishEventArgs args)
        {
            try
            {
                if (args.EventId == Sr.EquipmentInfoHolding.Services.EventIdAssign.EquipmentSelected)
                {
                    int id   = Convert.ToInt32(args.GetParams()[0]);
                    var tmps = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(id);
                    if (tmps == null)
                    {
                        return;
                    }

                    var tt = Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[id] as Wlst.Sr.EquipmentInfoHolding.Model.Wj3005Rtu;

                    string IpAddr = string.Empty;

                    if (tt != null)
                    {
                        IpAddr = new System.Net.IPAddress(BitConverter.GetBytes(tt.WjGprs.StaticIp)).ToString();
                    }


                    new Tuple <int, string, string>(id, tmps.RtuName, IpAddr);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
 public override bool FundOrderFilterForExtendCheck(PublishEventArgs args)
 {
     if (args.EventId == Wlst.Sr.EquipmentInfoHolding.Services.EventIdAssign.RunningInfoUpdate2)
     {
         if (args.GetParams().Count == 0) return false;
         var rtuids = args.GetParams()[0] as List<int>;
         if (rtuids == null || rtuids.Count == 0) return false;
         //if (rtuids.Contains(Wlst.Sr.EquipmentInfoHolding.Services.Others.CurrentSelectRtuId) == false)
         //    return false;
         if (rtuids.Contains(CurrentSelectedRtuId)) // todo 20171127
         {
             return true;
         }
         return false;
     }
     return true;
 }
Exemple #9
0
 public override void ExPublishedEvent(PublishEventArgs args)
 {
     try
     {
         //base.ExPublishedEvent(args);
         var info = args.GetParams()[0] as Wlst.Cr.Core.Modularity.AssemblyConfig;
         if (info != null)
         {
             if (args.EventId == Wlst.Cr.Core.ModuleServices.ModuleAssemblyEvent.ModuleLoadedEvent)
             {
                 var bol = (bool)args.GetParams()[1];
                 if (bol)
                 {
                     Log("程序核心加载模块成功,加载模块为:" + info.ModuleName);
                 }
                 else
                 {
                     Log("程序核心加载模块失败,加载模块为:" + info.ModuleName);
                 }
             }
             else if (args.EventId == Wlst.Cr.Core.ModuleServices.ModuleAssemblyEvent.ModuleUnLoadedEvent)
             {
                 var bol = (bool)args.GetParams()[1];
                 if (bol)
                 {
                     Log("程序核心卸载模块成功,卸载模块为:" + info.ModuleName);
                 }
                 else
                 {
                     Log("程序核心卸载模块失败,卸载模块为:" + info.ModuleName);
                 }
             }
             else if (args.EventId == Wlst.Cr.Core.ModuleServices.ModuleAssemblyEvent.ModulePreLoadEvent)
             {
                 Log("程序核心正在加载模块,加载模块为:" + info.ModuleName);
             }
             else if (args.EventId == Wlst.Cr.Core.ModuleServices.ModuleAssemblyEvent.ModulePreUnLoadEvent)
             {
                 Log("程序核心正在卸载模块,卸载模块为:" + info.ModuleName);
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
 public bool FundOrderFilter(PublishEventArgs args) //接收终端选中变更事件
 {
     if (args.EventType == PublishEventType.SvAv)
     {
         return(true);
     }
     if (args.EventType == PublishEventType.Core)
     {
         if (args.EventId == EventIdAssign.MenuComponentAdd ||
             args.EventId == EventIdAssign.MenuComponentDelete)
         {
             return(true);
         }
         if (args.EventId == Wlst.Sr.Menu.Services.EventIdAssign.MenuInstanceRelationLoadUpdate
             )
         {
             return(true);
         }
         if (args.EventId == Wlst.Sr.Menu.Services.EventIdAssign.MenuShourtCutsLoadUpdate ||
             args.EventId == Wlst.Sr.Menu.Services.EventIdAssign.MenuShourtCutsUpdate
             )
         {
             return(true);
         }
         if (args.EventId == Wlst.Sr.Menu.Services.EventIdAssign.MenuInstanceRelationUpdate)
         {
             if (args.GetParams().Count == 2)
             {
                 if (args.GetParams()[1].ToString().Contains(MainMenuDefine.MainMenuKey))
                 {
                     return(true);
                 }
             }
         }
         //if (args.EventId == Wlst.Sr.PrivilegesCrl.Services.EventIdAssign.RequestOrUpdateUserPrivilegInfoId)
         //{
         //    return true;
         //}
         //if (args.EventId == Wlst.Sr.PrivilegesCrl.Services.EventIdAssign.ModflyUserInfomationId)
         //{
         //    return true;
         //}
     }
     return(false);
 }
 //ToDo 1、分组参数变更时 数据更新;2、分组、终端增删改变动时时数据更新
 /// <summary>
 /// 事件过滤
 /// 目前只处理
 /// 1、系统当前选中的终端或分组变更,提供联动
 /// 2、终端参数发生变化的时候,即使更新显示数据
 /// </summary>
 /// <param name="args"></param>
 /// <returns></returns>
 public bool FundOrderFilter(PublishEventArgs args) //接收终端选中变更事件
 {
     if (args.EventType == PublishEventType.Core && args.EventId == 52303 && NodeType == TreeNodeType.IsTml &&
         NodeId == (int)args.GetParams()[0])
     {
         //switch (args.EventSection)
         //{
         //    case PublishEventSection.Update:
         //        return true;
         //}
         return(false);
     }
     return(false);
 }
Exemple #12
0
 public void FundEventHandler(PublishEventArgs args) // should do somework
 {
     try
     {
         int id = Convert.ToInt32(args.GetParams()[0]);
         if (id > 0)
         {
             MenuId = id;
         }
     }
     catch (Exception ex)
     {
         ex.ToString();
     }
 }
Exemple #13
0
 /// <summary>
 /// 事件过滤
 /// </summary>
 /// <param name="args"></param>
 /// <returns></returns>
 public bool FundOrderFilter(PublishEventArgs args)     //接收终端选中变更事件
 {
     try
     {
         if (args.EventType == PublishEventType.Core && args.EventId == 52309 &&     //终端信息修改
             NodeType == TreeNodeType.IsTml && NodeId == (int)args.GetParams()[0])
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         Wlst.Cr.Core.UtilityFunction.WriteLog.WriteLogError("Error:" + ex);
     }
     return(false);
 }
Exemple #14
0
        public void FundEventHandler(PublishEventArgs args)
        {
            int viewId = 0;

            try
            {
                viewId = Convert.ToInt32(args.GetParams()[0]);
            }
            catch (Exception ex)
            {
                Wlst.Cr.Core.UtilityFunction.WriteLog.WriteLogError("Error:" + ex);
            }

            var obs = Wlst.Cr.Core.CoreServices.RegionManage.GetViewById(viewId);

            if (obs != null)
            {
                View = obs;
            }
        }
        public void FundEventHandler(PublishEventArgs args) // should do somework
        {
            //事件记录、标记、日志、提示等
            string eventtype = "";
            int    eventid   = 0;
            string eventargs = "";

            try
            {
                eventtype = args.EventType;
                eventid   = args.EventId;
                int i = 1;
                foreach (object obj in args.GetParams())
                {
                    eventargs += i + ":" + obj.ToString() + ";";
                    i++;
                }
            }
            catch (Exception ex)
            {
                ex.ToString();
                //contents += "fail";
            }
            try
            {
                this.AddItems(new EventItemInfo()
                {
                    EventType = eventtype, EventId = eventid, EventPars = eventargs
                });
            }
            catch (Exception ex)
            {
                WriteLog.WriteLogError("Core_Monitor EventMonitorViewModel FundEventHandler Occer an error :" +
                                       ex.ToString());
            }
        }
        public override void ExPublishedEvent(
            PublishEventArgs args)
        {
            if (_thisViewActive == false)
            {
                return;
            }

            try
            {
                if (args.EventId == Sr.EquipmentInfoHolding.Services.EventIdAssign.EquipmentSelected)
                {
                    if (QueryMode != 2)
                    {
                        return;
                    }
                    int id = Convert.ToInt32(args.GetParams()[0]);
                    //if (id > 1100000)
                    //{
                    //    var tmps = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(id);
                    //    if (tmps == null) return;
                    //    id = tmps.RtuFid;
                    //}
                    if (id < 1000000 || id > 1100000)
                    {
                        return;
                    }

                    RtuId = id;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public bool FundOrderFilters(PublishEventArgs args) //接收终端选中变更事件
        {
            try
            {
                if (args.EventType == PublishEventType.SvAv)
                {
                    return(true);
                }
                if (args.EventType == PublishEventType.Core)
                {
                    if (args.EventId == EventIdAssign.EquipmentAddEventId)
                    {
                        return(true);
                    }
                    if (args.EventId == EventIdAssign.EquipmentDeleteEventId)
                    {
                        return(true);
                    }

                    if (args.EventId == EventIdAssign.EquipmentUpdateEventId)
                    {
                        return(true);
                    }
                    if (args.EventId == EventIdAssign.EquipentxyPositonUpdateId)
                    {
                        return(true);
                    }

                    if (RadMapJpegViewModelSet.MySelf.CanNavToEquImage &&
                        args.EventId == Sr.EquipmentInfoHolding.Services.EventIdAssign.EquipmentSelected)
                    {
                        return(true);
                    }

                    //if (args.EventId == Sr.EquipemntLightFault.Services.EventIdAssign.RtuErrorStateChanged)
                    //    return true;
                    if (args.EventId == Sr.EquipmentInfoHolding.Services.EventIdAssign.RunningInfoUpdate1 || args.EventId == Sr.EquipmentInfoHolding.Services.EventIdAssign.RunningInfoUpdate2)
                    {
                        var lst = args.GetParams()[0] as List <int>;
                        if (lst == null)
                        {
                            return(false);
                        }
                        foreach (var t in EquipmentList)
                        {
                            if (lst.Contains(t.EquipmentRtuId))
                            {
                                if (t.CanUpdateImage())
                                {
                                    return(true);
                                }
                            }
                        }
                        return(false);
                    }
                    if (args.EventId == Wlst.Sr.EquipmentInfoHolding.Services.EventIdAssign.RtuGroupSelectdWantedMapUp)
                    {
                        return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                Wlst.Cr.Core.UtilityFunction.WriteLog.WriteLogError("Error:" + ex);
            }
            return(false);
        }
Exemple #18
0
        public void FundEventHandlers(PublishEventArgs args)
        {
            try
            {
                if (args.EventType == PublishEventType.SvAv)
                {
                    if (EquipmentList.Count == 0)
                    {
                        this.NavOnLoad();
                    }
                    return;
                }
                if (args.EventType == PublishEventType.Core)
                {
                    if (args.EventId == EventIdAssign.EquipmentAddEventId)
                    {
                        var lst = args.GetParams()[0] as List <Tuple <int, int> >;
                        if (lst == null)
                        {
                            return;
                        }
                        foreach (var t in lst)
                        {
                            if (t.Item2 == 0)
                            {
                                AddMainEquipment(t.Item1);
                            }
                        }
                        return;
                    }
                    if (args.EventId == EventIdAssign.EquipmentDeleteEventId)
                    {
                        var lst = args.GetParams()[0] as List <Tuple <int, int> >;
                        if (lst == null)
                        {
                            return;
                        }
                        foreach (var t in lst)
                        {
                            if (t.Item2 == 0)
                            {
                                DeleteMainEquipment(t.Item1);
                            }
                        }
                        return;
                    }

                    if (args.EventId == EventIdAssign.EquipmentUpdateEventId)
                    {
                        var lst = args.GetParams()[0] as List <Tuple <int, int> >;
                        if (lst == null || lst.Count == 0)
                        {
                            return;
                        }
                        foreach (var t in lst)
                        {
                            if (t.Item2 == 0)
                            {
                                UpdateMainEquipment(t.Item1);
                            }
                        }

                        return;
                    }
                    if (args.EventId == EventIdAssign.EquipentxyPositonUpdateId)
                    {
                        int rtuid = Convert.ToInt32(args.GetParams()[0]);

                        if (!Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey(rtuid))
                        {
                            return;
                        }
                        if (Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[rtuid].RtuFid > 0)
                        {
                            return;
                        }

                        var f =
                            Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[rtuid];
                        foreach (var t in EquipmentList)
                        {
                            if (t.EquipmentRtuId == rtuid)
                            {
                                t.EquipmentName = f.RtuName;


                                // GMapMarker it = new GMapMarker(new PointLatLng(tmx.LatY, tmx.LonX));


                                t.UpdateEquipmentLocationLo(f.RtuMapX, f.RtuMapY);
                            }
                        }
                    }
                    if (args.EventId == Sr.EquipmentInfoHolding.Services.EventIdAssign.EquipmentSelected)
                    {
                        int x = Convert.ToInt32(args.GetParams()[0]);
                        //if (x < 1000000 || x > 1100000) return;

                        //OnSelectedShowInfo(x);
                        if (Wlst.Sr.EquipmentInfoHolding.Services.EquipmentIdAssignRang.IsRtuIsRtuLight(x))
                        {
                            OnSelectNodeChangeByTree(x);
                        }
                        else if (Wlst.Sr.EquipmentInfoHolding.Services.EquipmentIdAssignRang.IsSlu(x))
                        {
                            OnSelectNodeChangeByTree(x);
                        }
                        else
                        {
                            return;
                        }
                    }
                    if (args.EventId == EventIdAssign.RunningInfoUpdate1 || args.EventId == EventIdAssign.RunningInfoUpdate2)
                    {
                        var lst = args.GetParams()[0] as List <int>;
                        if (lst == null)
                        {
                            return;
                        }
                        foreach (var t in EquipmentList)
                        {
                            if (lst.Contains(t.EquipmentRtuId))
                            {
                                t.UpdateTmlStateInfomation();
                            }
                        }
                    }



                    //if (args.EventId == Sr.EquipmentGroupInfoHolding.Services.EventIdAssign.MainSingleTreeNodeActive)
                    //{
                    //    int x = Convert.ToInt32(args.GetParams()[0]);
                    //    int y = Convert.ToInt32(args.GetParams()[1]);
                    //    if (y == 2)
                    //    {
                    //        OnSelectNodeChangeByTree(x);
                    //    }
                    //}
                    //if (args.EventId == Sr.EquipemntLightFault.Services.EventIdAssign.RtuErrorStateChanged)
                    //    try
                    //    {

                    //        var lst = args.GetParams()[0] as List<Tuple<int, bool>>;
                    //        if (lst == null) return;
                    //        var tmps = (from t in lst select t.Item1).ToList();
                    //        foreach (var t in EquipmentList)
                    //        {
                    //            if (tmps.Contains(t.EquipmentRtuId))
                    //            {
                    //                t.UpdateTmlStateInfomation();
                    //            }
                    //        }

                    //    }
                    //    catch (Exception ex)
                    //    {
                    //    }
                    //if (args.EventId == Sr.EquipmentInfoHolding.Services.EventIdAssign.TmlRunningInfoChange )
                    //    try
                    //    {
                    //        if (args.GetParams().Count > 1)
                    //        {
                    //            try
                    //            {
                    //                //int x1 = Convert.ToInt32(args.GetParams()[0]);
                    //                //// int x2 = Convert.ToInt32(args.GetParams()[1]);
                    //                ////UpdateTmlStateInfomation(x1, x2);
                    //                //foreach (var t in EquipmentList)
                    //                //    if (t.EquipmentRtuId == x1)
                    //                //    {
                    //                //        t.UpdateTmlStateInfomation();
                    //                //        break;
                    //                //    }


                    //                var lst = args.GetParams()[0] as List<Tuple<int, bool>>;
                    //                if (lst == null) return;
                    //                var tmps = (from t in lst select t.Item1).ToList();
                    //                foreach (var t in EquipmentList)
                    //                {
                    //                    if (tmps.Contains(t.EquipmentRtuId))
                    //                    {
                    //                        t.UpdateTmlStateInfomation();
                    //                    }
                    //                }

                    //            }
                    //            catch (Exception ex)
                    //            {

                    //            }

                    //        }

                    //    }
                    //    catch (Exception ex)
                    //    {
                    //        Wlst.Cr.Core.UtilityFunction.WriteLog.WriteLogError("Error:" + ex);
                    //    }
                    if (args.EventId == Wlst.Sr.EquipmentInfoHolding.Services.EventIdAssign.RtuGroupSelectdWantedMapUp)
                    {
                        try
                        {
                            if (args.GetParams().Count == 0)
                            {
                                foreach (var t in EquipmentList)
                                {
                                    t.ImgVis = Visibility.Visible;
                                }
                                return;
                            }
                            var lst = args.GetParams()[0] as List <int>;
                            if (lst == null)
                            {
                                return;
                            }
                            if (lst.Count == 0)
                            {
                                foreach (var t in EquipmentList)
                                {
                                    t.ImgVis = Visibility.Visible;
                                }
                            }
                            else
                            {
                                foreach (var t in EquipmentList)
                                {
                                    t.ImgVis = lst.Contains(t.EquipmentRtuId)
                                                   ? Visibility.Visible
                                                   : Visibility.Collapsed;
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                }
                // int indentfyId = Convert.ToInt32(args.GetParams()[0]);
            }
            catch (Exception xe)
            {
                WriteLog.WriteLogError("RadMapJpeg error in FundEventHandlers:ex:" + xe);
            }
        }
Exemple #19
0
        //private void LoadAttachEquipmentInfo()
        //{
        //    AttachEquipmentList.Clear();
        //    int x = 0;
        //    //add 勒克司
        //    if (Setting.Setting.IsShowLuxImageOnJpegMap)
        //    {
        //        foreach (var f in
        //            Wlst.Sr.EquipmentInfoHolding.Services.ServicesEquipemntInfoHold.EquipmentInfoDictionary .Values)
        //        {
        //            try
        //            {
        //                //var k = t.Value.Instances as WjEquipmentModels.Interface.IILux;
        //                //if (k == null) continue;
        //                if (f.RtuModel != 1050) continue;
        //                x++;
        //                if (f.Xmap.Equals(0))
        //                {
        //                    f.Xmap = x*0.0002;
        //                    if (f.Xmap > 0.3) f.Xmap = f.Xmap - 0.3;
        //                }
        //                if (f.Ymap.Equals(0))
        //                {
        //                    f.Ymap = x*0.0002;
        //                    if (f.Ymap > 0.3) f.Ymap = f.Ymap - 0.3;
        //                }

        //                var ggg = new MapNodeViewModel()
        //                              {
        //                                  EquipmentRtuId = f.RtuId,
        //                                  EquipmentLocation = new Location(f.Xmap, f.Ymap),
        //                                  EquipmentImageState = 2,
        //                                  Visi = Visibility.Visible,
        //                                  EquipmentName = f.RtuName
        //                              };

        //                AttachEquipmentList.Add(ggg);
        //            }
        //            catch (Exception ex)
        //            {
        //                WriteLog.WriteLogError(
        //                    "RadMapJpeg LoadAttachEquipmentInfo Error when conver to IIEquipmentInfo:" + ex);
        //            }
        //        }
        //    }
        //}

        #region IEventAggregator Subscription


        //delegate void AppendStringCallback(PublishEventArgs text);
        //public void FundEventHandlers(PublishEventArgs args)
        //{
        //    AppendStringCallback appendStringCallback = new AppendStringCallback(FundEventHandlerss);
        //    Application.Current.Dispatcher.Invoke(appendStringCallback, args);
        //}



        public void FundEventHandlers(PublishEventArgs args)
        {
            try
            {
                if (args.EventType == PublishEventType.SvAv)
                {
                    if (MainEquipmentList.Count == 0)
                    {
                        this.NavOnLoad();
                    }
                    return;
                }
                if (args.EventType == PublishEventType.Core)
                {
                    //if (args.EventId == EventIdAssign.EquipmentAddEventId )
                    //{
                    //    //var lst = args.GetParams()[0] as List <Tuple<int, int>>;
                    //    //if (lst == null) return;
                    //    //foreach (var t in lst )
                    //    //AddAttachEquipment(t.Item1 );
                    //    return;
                    //}
                    //if (args.EventId == EventIdAssign.EquipmentDeleteEventId )
                    //{
                    //    int rtuId = Convert.ToInt32(args.GetParams()[0]);
                    //    DeleteAttachEquipment(rtuId);
                    //    return;
                    //}

                    //if (args.EventId == EventIdAssign.EquipmentUpdateEventId )
                    //{
                    //    ReloadAttachEquipment();
                    //    return;
                    //}
                    if (args.EventId == EventIdAssign.EquipmentAddEventId)
                    {
                        var lst = args.GetParams()[0] as List <Tuple <int, int> >;
                        if (lst == null)
                        {
                            return;
                        }
                        foreach (var t in lst)
                        {
                            if (t.Item2 == 0)
                            {
                                AddMainEquipment(t.Item1);
                            }
                        }
                        return;
                    }
                    if (args.EventId == EventIdAssign.EquipmentDeleteEventId)
                    {
                        var lst = args.GetParams()[0] as List <Tuple <int, int> >;
                        if (lst == null)
                        {
                            return;
                        }
                        foreach (var t in lst)
                        {
                            if (t.Item2 == 0)
                            {
                                DeleteMainEquipment(t.Item1);
                            }
                        }
                        return;
                    }

                    if (args.EventId == EventIdAssign.EquipmentUpdateEventId)
                    {
                        var lst = args.GetParams()[0] as List <Tuple <int, int> >;
                        if (lst == null || lst.Count == 0)
                        {
                            return;
                        }
                        foreach (var t in lst)
                        {
                            if (t.Item2 == 0)
                            {
                                UpdateMainEquipment(t.Item1);
                            }
                        }

                        return;
                    }
                    if (args.EventId == EventIdAssign.EquipentxyPositonUpdateId)
                    {
                        int rtuid = Convert.ToInt32(args.GetParams()[0]);

                        if (!ServicesEquipemntInfoHold.EquipmentInfoDictionary.ContainsKey(rtuid))
                        {
                            return;
                        }
                        if (ServicesEquipemntInfoHold.EquipmentInfoDictionary[rtuid].AttachRtuId > 0)
                        {
                            return;
                        }

                        var f =
                            Sr.EquipmentInfoHolding.Services.ServicesEquipemntInfoHold.EquipmentInfoDictionary[rtuid];
                        foreach (var t in MainEquipmentList)
                        {
                            if (t.EquipmentRtuId == rtuid)
                            {
                                t.EquipmentName     = f.RtuName;
                                t.EquipmentLocation = new Location(f.Xmap, f.Ymap);
                            }
                        }
                    }
                    if (args.EventId == Sr.EquipmentInfoHolding.Services.EventIdAssign.EquipmentSelected)
                    {
                        int x = Convert.ToInt32(args.GetParams()[0]);
                        // if (x < 1000000 || x > 1100000) return;
                        if (!Wlst.Sr.EquipmentInfoHolding.Services.EquipmentIdAssignRang.IsRtuIsRtuLight(x))
                        {
                            return;
                        }
                        OnSelectNodeChangeByTree(x);
                    }
                    //if (args.EventId == Sr.EquipmentGroupInfoHolding.Services.EventIdAssign.MainSingleTreeNodeActive)
                    //{
                    //    int x = Convert.ToInt32(args.GetParams()[0]);
                    //    int y = Convert.ToInt32(args.GetParams()[1]);
                    //    if (y == 2)
                    //    {
                    //        OnSelectNodeChangeByTree(x);
                    //    }
                    //}
                    if (args.EventId == Sr.EquipemntLightFault.Services.EventIdAssign.RtuErrorStateChanged)
                    {
                        try
                        {
                            var lst = args.GetParams()[0] as List <Tuple <int, bool> >;
                            if (lst == null)
                            {
                                return;
                            }
                            var tmps = (from t in lst select t.Item1).ToList();
                            foreach (var t in MainEquipmentList)
                            {
                                if (tmps.Contains(t.EquipmentRtuId))
                                {
                                    t.UpdateTmlStateInfomation();
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                    if (args.EventId == Sr.EquipmentInfoHolding.Services.EventIdAssign.RtuLightHasElectricStatesChanged)
                    {
                        try
                        {
                            if (args.GetParams().Count > 1)
                            {
                                try
                                {
                                    int x1 = Convert.ToInt32(args.GetParams()[0]);
                                    // int x2 = Convert.ToInt32(args.GetParams()[1]);
                                    //UpdateTmlStateInfomation(x1, x2);
                                    foreach (var t in MainEquipmentList)
                                    {
                                        if (t.EquipmentRtuId == x1)
                                        {
                                            t.UpdateTmlStateInfomation();
                                            break;
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Wlst.Cr.Core.UtilityFunction.WriteLog.WriteLogError("Error:" + ex);
                        }
                    }
                    if (args.EventId == Wlst.Sr.EquipmentInfoHolding.Services.EventIdAssign.RtuGroupSelectdWantedMapUp)
                    {
                        try
                        {
                            var lst = args.GetParams()[0] as List <int>;
                            if (lst == null)
                            {
                                return;
                            }
                            if (lst.Count == 0)
                            {
                                foreach (var t in MainEquipmentList)
                                {
                                    t.ImgVis = Visibility.Visible;
                                }
                                foreach (var t in AttachEquipmentList)
                                {
                                    t.ImgVis = Visibility.Visible;
                                }
                            }
                            else
                            {
                                foreach (var t in MainEquipmentList)
                                {
                                    t.ImgVis = lst.Contains(t.EquipmentRtuId)
                                                   ? Visibility.Visible
                                                   : Visibility.Collapsed;
                                }
                                foreach (var t in AttachEquipmentList)
                                {
                                    t.ImgVis = lst.Contains(t.EquipmentRtuId)
                                                   ? Visibility.Visible
                                                   : Visibility.Collapsed;
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                }
                // int indentfyId = Convert.ToInt32(args.GetParams()[0]);
            }
            catch (Exception xe)
            {
                WriteLog.WriteLogError("RadMapJpeg error in FundEventHandlers:ex:" + xe);
            }
        }
        public void FundEventHandlers(PublishEventArgs args)
        {
            try
            {
                if (args.EventType == PublishEventType.ReCn)
                {
                    var infos = Wlst.Sr.ProtocolPhone.LxRtu.wst_rtu_user_oc_info;
                    infos.WstRtuUserOcInfo.Op = 1;
                    SndOrderServer.OrderSnd(infos, 10, 6);
                }

                if (args.EventId == EventIdAssign.RunningInfoUpdate2)  //todo
                {
                    var lst = args.GetParams()[0] as List <int>;
                    if (lst == null || lst.Count == 0)
                    {
                        return;
                    }

                    //需要删除的记录
                    List <OcInfoItems> recordssss = new List <OcInfoItems>();

                    if (ocinfos == null)
                    {
                        return;
                    }

                    //遍历记录中是否存在
                    foreach (var g in ocinfos.Keys)
                    {
                        if (lst.Contains(g.Item1))
                        {
                            var run = Wlst.Sr.EquipmentInfoHolding.Services.RunningInfoHold.GetRunInfo(g.Item1);
                            if (run == null || run.RtuNewData == null)
                            {
                                return;
                            }
                            if (run.RtuNewData.IsSwitchOutAttraction.Count < g.Item2)
                            {
                                continue;
                            }

                            if (run.RtuNewData.IsSwitchOutAttraction[g.Item2 - 1] != (ocinfos[g].Op == 1))
                            {
                                ocinfos[g].Color = "Red";
                                recordssss.Add(ocinfos[g]);
                            }
                            else
                            {
                                ocinfos[g].Color = "Black";
                            }
                        }
                    }
                    if (recordssss.Count > 0)
                    {
                        foreach (var g in recordssss)
                        {
                            //var tu = new Tuple<int, int>(g.RtuId,g.LoopId);
                            //if(ocinfos.ContainsKey(tu))
                            //{
                            //    Records.Remove(ocinfos[tu]);

                            //}
                            //Records.Insert(0,g);
                            if (Records.Contains(g))
                            {
                                Records.Remove(g);
                            }
                            Records.Insert(0, g);
                        }
                    }
                }
            }
            catch (Exception xe)
            {
                WriteLog.WriteLogError("Ldu  showdata error in FundEventHandlers:ex:" + xe);
            }
        }
Exemple #21
0
        public override void ExPublishedEvent(
            PublishEventArgs args)
        {
            try
            {
                //if (args.EventId == Wlst.Sr.EquipmentInfoHolding.Services.EventIdAssign.RunningInfoUpdate2)
                //{
                //    if (args.GetParams().Count == 0) return;
                //    var rtuids = args.GetParams()[0] as List<int>;
                //    if (rtuids == null || rtuids.Count == 0) return;

                //    if (args.GetParams().Count < 2)
                //    {
                //        if (rtuids.Contains(CurrentSelectedRtuId))
                //        {
                //            //OnSluDataArrive(lst);
                //            OnSelectRtu(CurrentSelectedRtuId, 0);
                //        }
                //        return;
                //    }

                //    var lst = args.GetParams()[1] as List<int>;
                //    if (rtuids.Contains(CurrentSelectedRtuId))
                //    {
                //        OnSluDataArrive(lst);
                //    }
                //}
                if (args.EventId == Wlst.Sr.EquipmentInfoHolding.Services.EventIdAssign.EquipmentSelected)
                {
                    int rtuid = Convert.ToInt32(args.GetParams()[0]);
                    CurrentApplicationSelectd = rtuid;
                    // CurrentSelectedCtrlId = 0;
                    if (rtuid > 1700000 && rtuid < 1800000)
                    {
                        // OnSluDataUpdate();
                        if (args.GetParams().Count > 1)
                        {
                            int ctrlid = Convert.ToInt32(args.GetParams()[1]);
                            if (ctrlid < 1)
                            {
                                ctrlid = 0;
                            }
                            OnSelectRtu(rtuid, ctrlid);

                            // DateTimeCtrl = DateTime.Now.Ticks+"";
                        }
                        else
                        {
                            OnSelectRtu(rtuid, 0);
                        }
                    }
                }
                //if(args .EventId ==Wlst.Sr.EquipmentInfoHolding.Services.EventIdAssign.RtuDataQueryDataInfoNeedShowInTab)
                //{
                //    var info = args.GetParams()[0] as Wlst.client.SluCtrlDataMeasureReply.DataSluCtrlData;
                //    if (info == null) return;
                //    OnOtherViewShowData(info);
                //    SelectedViewId = 5;
                //}
                if (args.EventId == Wlst.Sr.SlusglInfoHold.Services.EventIdAssign.SluSglMeasure)
                {
                    if (args.GetParams().Count == 0)
                    {
                        return;
                    }
                    var rtuids = args.GetParams()[0] as List <int>;
                    if (rtuids == null || rtuids.Count == 0)
                    {
                        return;
                    }

                    if (!rtuids.Contains(CtrlId))
                    {
                        return;
                    }

                    if (args.GetParams().Count < 2)
                    {
                        if (rtuids.Contains(CtrlId))
                        {
                            OnSelectRtu(0, CtrlId);
                        }
                        return;
                    }

                    //var lst = args.GetParams()[1] as List<int>;
                    //if (rtuids.Contains(CtrlId))
                    //{
                    //    OnSluDataArrive(lst);
                    //}
                }
            }
            catch (Exception ex)
            {
                Wlst.Cr.Core.UtilityFunction.WriteLog.WriteLogError("NB2096 New Data处理出错:" + ex);
            }
        }
Exemple #22
0
        private void FundEventHandler(PublishEventArgs args)
        {
            try
            {
                try
                {
                    if (args.EventType == PublishEventType.Core)
                    {
                        if (args.EventId == Sr.EquipmentInfoHolding.Services.EventIdAssign.EquipmentSelected)//EventId =EventIdAssign.PushErrNums
                        {
                            var lst = new List <string>();
                            //DtRtuMsg = "";
                            int rtuId = Convert.ToInt32(args.GetParams()[0]);
                            if (rtuId > 0 &&
                                Wlst.Sr.EquipmentInfoHolding.Services.EquipmentIdAssignRang.IsRtuIsRtuLight(rtuId))
                            {
                                var tmps = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(rtuId);
                                if (tmps == null)
                                {
                                    return;
                                }
                                if (Wlst.Cr.CoreOne.Services.OptionXmlSvr.GetOptionBool(2801, 16, false))
                                {
                                    //DtRtuMsg += tmps.RtuPhyId+" - ";
                                    lst.Add(tmps.RtuPhyId + "");
                                }
                                if (Wlst.Cr.CoreOne.Services.OptionXmlSvr.GetOptionBool(2801, 17, false))
                                {
                                    //DtRtuMsg += tmps.RtuName + " - ";
                                    lst.Add(tmps.RtuName + "");
                                }
                                if (Wlst.Cr.CoreOne.Services.OptionXmlSvr.GetOptionBool(2801, 18, false))
                                {
                                    var groupidx =
                                        Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuBelongGrp(
                                            rtuId);
                                    if (groupidx != null)
                                    {
                                        var infosss =
                                            Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.
                                            GetGroupInfomation(
                                                groupidx.Item1, groupidx.Item2);
                                        if (infosss != null)
                                        {
                                            lst.Add(infosss.GroupName);
                                        }

                                        //  if (infosss != null) DtRtuMsg += infosss.GroupName + " - ";
                                    }
                                    else
                                    {
                                        lst.Add("特殊终端");
                                    }
                                }

                                if (Wlst.Cr.CoreOne.Services.OptionXmlSvr.GetOptionBool(2801, 19, false))
                                {
                                    if (string.IsNullOrEmpty(tmps.RtuRemark) == false)
                                    {
                                        lst.Add(tmps.RtuRemark);
                                    }
                                }
                                // DtRtuMsg += tmps.RtuRemark;// +"          ";

                                DtRtuMsg = "";
                                if (lst.Count > 0)
                                {
                                    for (int i = 0; i < lst.Count - 1; i++)
                                    {
                                        DtRtuMsg += lst[i] + " - ";
                                    }
                                    DtRtuMsg += lst[lst.Count - 1] + "      ";
                                }
                            }
                        }
                        if (args.EventId == Sr.EquipmentInfoHolding.Services.EventIdAssign.RunningInfoUpdate2)//EventId =EventIdAssign.PushErrNums
                        {
                            if (args.GetParams().Count == 0)
                            {
                                return;
                            }
                            var rtuids = args.GetParams()[0] as List <int>;
                            if (rtuids == null || rtuids.Count == 0)
                            {
                                return;
                            }
                            foreach (var g in rtuids)
                            {
                                var rtuInfo =
                                    Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(g);
                                if (rtuInfo == null)
                                {
                                    return;
                                }
                                if (rtuInfo.RtuModel == EnumRtuModel.Wj2090)
                                {
                                    DtMsg = DateTime.Now.ToString("HH:mm:ss  ") + "获取 " + rtuInfo.RtuPhyId + "号 集中器:" + rtuInfo.RtuName + "  ,选测数据";
                                }
                            }
                        }



                        //lvf 2018年6月5日11:29:36  中间层不愿意改,只能客户端监听相关设备时间,引用相关模块
                        if (args.EventId == Wlst.Sr.SlusglInfoHold.Services.EventIdAssign.SluSglMeasure)
                        {
                            if (args.GetParams().Count == 0)
                            {
                                return;
                            }
                            var rtuids = args.GetParams()[0] as List <int>;
                            if (rtuids == null || rtuids.Count == 0)
                            {
                                return;
                            }

                            if (rtuids[0] > 0)
                            {
                                var rtuid = rtuids[0];

                                var name = "";

                                var para = Wlst.Sr.SlusglInfoHold.Services.SluSglInfoHold.MySlef.Get(rtuid);
                                if (para == null)
                                {
                                    return;
                                }
                                name = para.OrderId + " - " + para.CtrlName;
                                var sluid = Wlst.Sr.SlusglInfoHold.Services.SluSglInfoHold.MySlef.GetCtrlField(rtuid);
                                if (sluid != -1)
                                {
                                    var sluinfo = Wlst.Sr.SlusglInfoHold.Services.SluSglInfoHold.MySlef.GetField(sluid);
                                    if (sluinfo != null)
                                    {
                                        DtMsg = DateTime.Now.ToString("HH:mm:ss  ") + "获取 集中器:" + sluinfo.PhyId + " " + sluinfo.FieldName + " , 序号" + para.OrderId + "," + para.CtrlName + "  控制器实时数据";
                                    }
                                }
                                else
                                {
                                    DtMsg = DateTime.Now.ToString("HH:mm:ss  ") + "获取  序号: " + para.OrderId + "-" + para.CtrlName + "  控制器实时数据";
                                }
                            }

                            //else
                            //    DtMsg = DateTime.Now.ToString("HH:mm:ss  ") + stratt + "  " + name + "  " + operatorContent;
                        }
                    }
                    //if (args.EventId == Sr.EquipemntLightFault.Services.EventIdAssign.PreExistErrorRequestId)
                    //{
                    //    var infos = args.GetParams()[1] as EquipmentPreFaultExChange;
                    //    if (infos == null) return;
                    //    OnPreDataBack(infos);
                    //}
                }
                catch (Exception ex)
                {
                    WriteLog.WriteLogError(
                        "EquipmentDataQuery.EquipmentFaultRecordQueryViewModel FundEventHandler occer an error:" +
                        ex);
                }
            }
            catch (Exception ex)
            {
            }
        }
Exemple #23
0
        //private int LightOpenCloseProtect = 5;

        public override void ExPublishedEvent(PublishEventArgs args)
        {
            //base.ExPublishedEvent(args);

            if (args.GetParams().Count < 2)
            {
                return;
            }
            int obj1 = 0;

            try
            {
                obj1 = Convert.ToInt32(args.GetParams()[0]);
            }
            catch (Exception)
            {
            }

            var obj2 = args.GetParams()[1] as TimeTableOneDayInfomationItem;

            if (obj2 == null)
            {
                return;
            }

            switch (obj1)
            {
            case 1:
                if (!_isChecked)
                {
                    break;
                }
                if (obj2.TimetableId == SchemeId && obj2.TimeAreaId == TimeInfoMnVm.areaId)
                {
                    foreach (var t in RuleItems)
                    {
                        if (t.TimetableSectionId == obj2.TimetableSectionId)
                        {
                            t.IsUsedLuxOn = obj2.IsUsedLuxOn;
                        }
                    }
                }
                break;

            case 2:
                if (!_isChecked)
                {
                    break;
                }
                if (obj2.TimetableId == SchemeId && obj2.TimeAreaId == TimeInfoMnVm.areaId)
                {
                    foreach (var t in RuleItems)
                    {
                        if (t.TimetableSectionId == obj2.TimetableSectionId)
                        {
                            t.IsUsedOnSet = obj2.IsUsedOnSet;
                        }
                    }
                }
                break;

            case 3:

                #region

                //if (obj2.TimetableId == SchemeId && obj2.TimeAreaId == TimeInfoMnVm.areaId)
                //{
                //    if (obj2.TimetableSectionId > 1)
                //    {
                //        foreach (var t in RuleItems)
                //        {
                //            if (obj2.TimetableSectionId == t.TimetableSectionId + 1 &&
                //                obj2.DayOfWeekUsed == t.DayOfWeekUsed && t.Maxsection == obj2.Maxsection)
                //            {
                //                if (obj2.TimeOn <= t.TimeOff) obj2.TimeOn = 1500;
                //            }
                //        }
                //    }
                //}

                #endregion


                if (!_isChecked)
                {
                    break;
                }
                if (obj2.TimetableId == SchemeId && obj2.TimeAreaId == TimeInfoMnVm.areaId)
                {
                    foreach (var t in RuleItems)
                    {
                        if (obj2.IsUsedOnSet == true)
                        {
                            continue;
                        }
                        if (t.TimetableSectionId == obj2.TimetableSectionId)
                        {
                            t.TimeOn = obj2.TimeOn;
                        }
                    }
                }
                break;

            case 4:
                if (!_isChecked)
                {
                    break;
                }
                if (obj2.TimetableId == SchemeId && obj2.TimeAreaId == TimeInfoMnVm.areaId)
                {
                    foreach (var t in RuleItems)
                    {
                        if (t.TimetableSectionId == obj2.TimetableSectionId)
                        {
                            t.IsUsedLuxOff = obj2.IsUsedLuxOff;
                        }
                    }
                }
                break;

            case 5:
                if (!_isChecked)
                {
                    break;
                }
                if (obj2.TimetableId == SchemeId && obj2.TimeAreaId == TimeInfoMnVm.areaId)
                {
                    foreach (var t in RuleItems)
                    {
                        if (t.TimetableSectionId == obj2.TimetableSectionId)
                        {
                            t.IsUsedOffSet = obj2.IsUsedOffSet;
                        }
                    }
                }
                break;

            case 6:

                if (!_isChecked)
                {
                    break;
                }
                if (obj2.TimetableId == SchemeId && obj2.TimeAreaId == TimeInfoMnVm.areaId)
                {
                    foreach (var t in RuleItems)
                    {
                        if (obj2.IsUsedOffSet == true)
                        {
                            continue;
                        }
                        if (t.TimetableSectionId == obj2.TimetableSectionId)
                        {
                            t.TimeOff = obj2.TimeOff;
                        }
                    }
                }
                break;

            default:
                break;
            }
        }
        public override void ExPublishedEvent(
            PublishEventArgs args)
        {
            try
            {

                if (args.EventId == Wlst.Sr.EquipmentInfoHolding.Services.EventIdAssign.RunningInfoUpdate2)
                {
                    if (args.GetParams().Count == 0) return;
                    var rtuids = args.GetParams()[0] as List<int>;
                    if (rtuids == null || rtuids.Count == 0) return;

                    if (args.GetParams().Count < 2)
                    {
                        if (rtuids.Contains(CurrentSelectedRtuId))
                        {
                            //OnSluDataArrive(lst);
                            OnSelectRtu(CurrentSelectedRtuId, 0);
                        }
                        return;
                    }

                    var lst = args.GetParams()[1] as List<int>;
                    if (rtuids.Contains(CurrentSelectedRtuId)) // todo 20171127
                    {
                        //OnSluDataArrive(lst);
                        OnSluDataArrive(new List<int>(){5});
                    }
                }
                if (args.EventId == Wlst.Sr.EquipmentInfoHolding.Services.EventIdAssign.EquipmentSelected)
                {

                    int rtuid = Convert.ToInt32(args.GetParams()[0]);
                    CurrentApplicationSelectd = rtuid;
                   // CurrentSelectedCtrlId = 0;
                    if (rtuid > Wlst.Sr.EquipmentInfoHolding.Services.EquipmentIdAssignRang.SluStart &&
                        rtuid < Wlst.Sr.EquipmentInfoHolding.Services.EquipmentIdAssignRang.SluEnd)
                    {
                        // OnSluDataUpdate();
                        if (args.GetParams().Count > 1)
                        {
                            int ctrlid = Convert.ToInt32(args.GetParams()[1]);
                            if (ctrlid < 1) ctrlid = 0;
                            OnSelectRtu(rtuid, ctrlid);

                           // DateTimeCtrl = DateTime.Now.Ticks+"";
                        }
                        else
                        {
                            OnSelectRtu(rtuid, 0);
                        }

                    }
                }
                if(args .EventId ==Wlst.Sr.EquipmentInfoHolding.Services.EventIdAssign.RtuDataQueryDataInfoNeedShowInTab)
                {
                    var info = args.GetParams()[0] as Wlst.client.SluCtrlDataMeasureReply.DataSluCtrlData;
                    if (info == null) return;
                    OnOtherViewShowData(info);
                    SelectedViewId = 5;
                }
            }
            catch (Exception ex)
            {
                Wlst.Cr.Core.UtilityFunction.WriteLog.WriteLogError("Slu New Data处理出错:" + ex);
            }
        }
Exemple #25
0
        /// <summary>
        /// 更新菜单列表 ,仅保留参数中的列表
        /// </summary>
        /// <param name="lstShouldKeepItemsId">更新菜单列表仅保留参数中的列表</param>
        public void UpdateMenuItem(List <IIMenuItem> lstShouldKeepItemsId)
        {
            var lstKeep = new List <int>();

            foreach (var t in lstShouldKeepItemsId)
            {
                if (!lstKeep.Contains(t.Id))
                {
                    lstKeep.Add(t.Id);
                }
            }

            var lstNeedDelete = new List <int>();

            foreach (var t in _dictionaryMenuItems.Keys)
            {
                if (lstKeep.Contains(t))
                {
                    continue;
                }
                if (!lstNeedDelete.Contains(t))
                {
                    lstNeedDelete.Add(t);
                }
            }

            if (lstNeedDelete.Count > 0)
            {
                var args = new PublishEventArgs()
                {
                    EventType = PublishEventType.Core,
                    EventId   = EventIdAssign.MenuComponentDelete,
                };

                foreach (var t in lstNeedDelete)
                {
                    if (_dictionaryMenuItems.ContainsKey(t))
                    {
                        _dictionaryMenuItems.Remove(t);
                    }
                    args.AddParams(t);
                }
                EventPublish.PublishEvent(args);
            }


            foreach (var t in lstShouldKeepItemsId)
            {
                var args = new PublishEventArgs()
                {
                    EventType = PublishEventType.Core,
                    EventId   = EventIdAssign.MenuComponentAdd,
                };
                if (!_dictionaryMenuItems.ContainsKey(t.Id))
                {
                    _dictionaryMenuItems.Add(t.Id, t);
                    args.AddParams(t.Id);
                }
                if (args.GetParams().Count > 0)
                {
                    EventPublish.PublishEvent(args);
                }
            }
        }