Пример #1
0
        /// <summary>
        /// 告警明细
        /// </summary>
        /// <param name="als"></param>
        public void SearchAlarmLogDetail(AlarmLogsSearch als, bool showWindow = true)
        {
            if (!AppHelper.CheckAppState(ModelResponsible.Instance.ParentWindow))
            {
                return;
            }
            Conditions cons = new Conditions();

            cons.AddItem("AlarmLevel", als.IsAdvanced ? als.AlarmLevel : "");
            cons.AddItem("AlarmCode", als.IsAdvanced ? als.AlarmCode : "");
            cons.AddItem("AlarmModule", (als.IsAdvanced && !string.IsNullOrEmpty(als.AlarmModule)) ? als.AlarmModule : "16,17,18,19,21,23,25,28");
            cons.AddItem("AlarmStatus", als.IsAdvanced ? als.AlarmStatus : "");
            cons.AddItem("AlarmIp", EEMSConfigHelper.GetValueByCommomConfig("config/CommonConfig/local_machine_ip", "127.0.0.1"));
            cons.AddItem("AlarmStartTime", als.AlarmStartTime);
            cons.AddItem("AlarmEndTime", als.SearchTime);
            cons.AddItem("PageIndex", als.PageIndex.ToString());
            cons.AddItem("PageCount", als.PageCount.ToString());
            if (showWindow)
            {
                ResultWindow     resultWindow = WindowsHelper.ShowDialogWindow <ResultWindow>(null, MsgType.AlarmLogRequest, MsgType.AlarmLogRespond, cons, Application.Current.FindResource("SearchManagerSearch").ToString(), AppConfigInfos.AppStateInfos.SearchTimeOut);
                MessageBoxResult msgBoxResult = resultWindow.MessageBoxResult;
                if (msgBoxResult == MessageBoxResult.Cancel)
                {
                    NewMessageBox.Show(Application.Current.FindResource("SearchManagerSearchFail").ToString());
                }
            }
            else
            {
                ModelResponsible.Instance.SendMessage(MsgType.AlarmLogRequest, cons);
            }
        }
Пример #2
0
        /// <summary>
        /// 初始化连接
        /// </summary>
        /// <returns></returns>
        public bool Init()
        {
            try
            {
                Ice.InitializationData intiData = new Ice.InitializationData();

                Ice.Properties properties = Ice.Util.createProperties();

                properties.setProperty("Ice.MessageSizeMax", "104857600");
                properties.setProperty("Ice.ThreadPool.SizeMax", "100");
                intiData.properties = properties;

                ic = Ice.Util.initialize(intiData);

                // 连接
                Ice.ObjectPrx objectPrx = ic.stringToProxy(string.Format("ID_TransDataFromClientRPC:tcp -h {0} -p {1} -t 5000",
                                                                         EEMSConfigHelper.GetValueByCommomConfig("config/CollectClient/DataServerIp", "127.0.0.1"),
                                                                         EEMSConfigHelper.GetValueByCommomConfig("config/CollectClient/DataServerPort", "40010")));

                Client = CSTransDataFromClientPrxHelper.checkedCast(objectPrx);
                // 代理
                Ice.ObjectAdapter adapter = ic.createObjectAdapterWithEndpoints("ID_TransDataFromClientRPC", string.Format("tcp -h {0} -p {1} -t 5000",
                                                                                                                           EEMSConfigHelper.GetValueByCommomConfig("config/CollectClient/DataClientIp", "127.0.0.1"),
                                                                                                                           EEMSConfigHelper.GetValueByCommomConfig("config/CollectClient/DataClientPort", "42000")));

                CallbackClientI callbackClientI = new CallbackClientI();

                callbackClientI.TransDataToClientHandler += callbackClientI_TransDataToClientHandler;

                Ice.Object obj = callbackClientI;

                adapter.add(obj, ic.stringToIdentity("ID_TransDataFromClientRPC"));

                adapter.activate();

                CallbackClientPrx call = CallbackClientPrxHelper.uncheckedCast(adapter.createProxy(ic.stringToIdentity("ID_TransDataFromClientRPC")));

                Client.RegistClient(ClientID, call, 1000);

                return(true);
            }
            catch (Exception e)
            {
                // 初始化失败
                Dispose();
                LogHelper.Instance.WirteErrorMsg(e.Message);
                return(false);
            }
        }
Пример #3
0
        /// <summary>
        /// 告警总数
        /// </summary>
        /// <param name="als"></param>
        public void SearchAlarmLogCount(AlarmLogsSearch als)
        {
            if (DateTime.Compare(Convert.ToDateTime(als.AlarmtEndTime), DateTime.Now) > 0)
            {
                SearchManager.GetInstance().AlarmLogsSearch.SearchTime = DateTime.Now.AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss");
            }
            else
            {
                SearchManager.GetInstance().AlarmLogsSearch.SearchTime = als.AlarmtEndTime;
            }

            Conditions cons = new Conditions();

            cons.AddItem("AlarmLevel", als.IsAdvanced ? als.AlarmLevel : "");
            cons.AddItem("AlarmCode", als.IsAdvanced ? als.AlarmCode : "");
            cons.AddItem("AlarmModule", (als.IsAdvanced && !string.IsNullOrEmpty(als.AlarmModule))? als.AlarmModule : "16,17,18,21,23,25,28");
            cons.AddItem("AlarmStatus", als.IsAdvanced ? als.AlarmStatus : "");
            cons.AddItem("AlarmIp", EEMSConfigHelper.GetValueByCommomConfig("config/CommonConfig/local_machine_ip", "127.0.0.1"));
            cons.AddItem("AlarmStartTime", als.AlarmStartTime);
            cons.AddItem("AlarmEndTime", als.SearchTime);

            ModelResponsible.Instance.SendMessage(MsgType.AlarmCountRequest, cons);
        }
Пример #4
0
        /// <summary>
        /// 初始化连接
        /// </summary>
        /// <returns></returns>
        public bool Init()
        {
            try
            {
                lock (lockData)
                {
                    Ice.InitializationData intiData = new Ice.InitializationData();

                    Ice.Properties properties = Ice.Util.createProperties();

                    properties.setProperty("Ice.MessageSizeMax", "104857600");

                    intiData.properties = properties;

                    ic = Ice.Util.initialize(intiData);

                    // 连接
                    Ice.ObjectPrx objectPrx = ic.stringToProxy(string.Format("{0}:tcp -h {1} -p {2} -t 5000", NMCommunicationRPCId.value,
                                                                             EEMSConfigHelper.GetValueByCommomConfig("config/CommonConfig/netagent_ip", "127.0.0.1"),
                                                                             EEMSConfigHelper.GetValueByCommomConfig("config/CommonConfig/netagent_port", "40050")));

                    client = NMServerPrxHelper.checkedCast(objectPrx);

                    // 代理
                    Ice.ObjectAdapter adapter = ic.createObjectAdapterWithEndpoints(NMCommunicationRPCId.value, string.Format("tcp -h {0} -p {1} -t 5000",
                                                                                                                              EEMSConfigHelper.GetValueByCommomConfig("config/CollectClient/WarnInfoLocalIp", "127.0.0.1"),
                                                                                                                              EEMSConfigHelper.GetValueByCommomConfig("config/CollectClient/WarnInfoClentPort", "42050")));

                    NMClientI clientI = new NMClientI();

                    clientI.ReceiveDataHandler += clientI_ReceiveDataHandler;

                    Ice.Object obj = clientI;

                    adapter.add(obj, ic.stringToIdentity(NMCommunicationRPCId.value));

                    adapter.activate();

                    NMClientPrx call = NMClientPrxHelper.uncheckedCast(adapter.createProxy(ic.stringToIdentity(NMCommunicationRPCId.value)));

                    client.NMRegistClient(clientID, call);

                    IsConnect = true;
                }

                return(true);
            }
            catch (Exception e)
            {
                // 初始化失败
                client = null;
                LogHelper.Instance.WirteErrorMsg(e.Message);
                return(false);
            }
            finally
            {
                if (!isThreadStart)
                {
                    isThreadStart = true;
                    CheckConnectThread();
                }
            }
        }