public void Add(BaseEvent e)
 {
     lock (_eventsQueue)
     {
         _eventsQueue.Enqueue(e);
     }
 }
        public void OnEvent(BaseEvent newEvent)
        {
            if (newEvent is OffGasEvent)
            {

                OffGasEvent offGasEvent = newEvent as OffGasEvent;
                pointPairLists[0].Add(currentSecond, offGasEvent.H2);
                pointPairLists[1].Add(currentSecond, offGasEvent.CO);
                pointPairLists[2].Add(currentSecond, offGasEvent.CO2);
                pointPairLists[3].Add(currentSecond, offGasEvent.N2);
                pointPairLists[4].Add(currentSecond, offGasEvent.O2);
                pointPairLists[5].Add(currentSecond, offGasEvent.Ar);
                currentSecond++;

                zedGraph.GraphPane.CurveList.Clear();
                zedGraph.GraphPane.AddCurve("H2", pointPairLists[0], Color.Green, SymbolType.None);
                zedGraph.GraphPane.AddCurve("O2", pointPairLists[1], Color.Blue, SymbolType.None);
                zedGraph.GraphPane.AddCurve("CO", pointPairLists[2], Color.Red, SymbolType.None);
                zedGraph.GraphPane.AddCurve("CO2", pointPairLists[3], Color.Orange, SymbolType.None);
                zedGraph.GraphPane.AddCurve("N2", pointPairLists[4], Color.Black, SymbolType.None);
                zedGraph.GraphPane.AddCurve("Ar", pointPairLists[5], Color.Turquoise, SymbolType.None);
                zedGraph.AxisChange();
                zedGraph.Invalidate();

                //TrendsViewer.Trends.ActiveForm.
                // тут добавляем на график по текущей сикунде
            }
        }
        public void OnEvent(BaseEvent evt)
        {
            using (var l = new Logger("SublanceGenerator Listener")) {
                if (evt is HeatChangeEvent) {
                    var hce = evt as HeatChangeEvent;
                    if (HeatNumber != hce.HeatNumber) {
                        l.msg("Heat Changed. New Heat ID: {0}\n", hce.HeatNumber);
                        HeatNumber = hce.HeatNumber;
                        Program.Reset();
                    }
                    else
                        l.msg("Heat No Changed. Heat ID: {0}\n", hce.HeatNumber);
                }

                if (evt is FlexEvent) {
                    var fxe = evt as FlexEvent;

                    CarbonEventHandler(fxe, 0, "OffGasDecarbonater");
                    CarbonEventHandler(fxe, 1, "SMFCarbon");
                    CarbonEventHandler(fxe, 2, "CPlusProcessor");
                    CarbonEventHandler(fxe, 3, "NeuralProcessorC");
                    CarbonEventHandler(fxe, 4, "CorrectionCT");
                }
            }
        }
 //public Listener()
 //{
 //}
 public void OnEvent(BaseEvent evt)
 {
     using (var l = new Logger("FlexEventSaver"))
     {
         if (evt is FlexEvent)
         {
             var fxe = evt as FlexEvent;
             if (fxe.Operation.StartsWith(Program.m_startsWith))
             {
                 l.msg(fxe.ToString());
             //    string str = "\n================================================";
             //    foreach(String key in fxe.Arguments.Keys)
             //    {
             //        str += String.Format("\n{0}\t:{1}", key, fxe.Arguments[key]);
             //    }
             //    l.msg(str);
             //}
             //else
             //{
             //    string s = String.Format("Id={0} Time={1}\nOperation={2}\nFlags={3}\nArguments:", fxe.Id, fxe.Time, fxe.Operation, fxe.Flags);
             //    s = fxe.Arguments.Keys.Aggregate(s, (current, key) => current + String.Format("\n\t{0}\t:{1}", key, fxe.Arguments[key]));
             //    l.msg("{0}\n==============================\n", s);
             }
         }
     }
 }
        public static void EventsHandler(BaseEvent evt, Logger l)
        {
            if (evt is BlowingEvent) {
                var be = evt as BlowingEvent;
                Keeper.SetBlowingStatus(be.BlowingFlag == 1);
            } else

            if (evt is FlexEvent) {
                var fxe = evt as FlexEvent;
                if (fxe.Operation.StartsWith("UDP.OffGasAnalysisEvent")) {
                    var fxh = new FlexHelper(fxe);

                    var co = fxh.GetDbl("CO");
                    var co2 = fxh.GetDbl("CO2");

                    SetGasAnalysis(co, co2);
                } else

                if (fxe.Operation.StartsWith("OPC.WatchdogsFromL1"))
                {
                    var fxh = new FlexHelper(fxe);
                    var wd1 = fxh.GetInt("WDPLC1");
                    var wd2 = fxh.GetInt("WDPLC2");
                    var wd3 = fxh.GetInt("WDPLC3");
                    var wd01 = fxh.GetInt("WDPLC01");

                    SetWatchdogReceive(wd1, wd2, wd3, wd01);
                }
            }
        }
        public void OnEvent(BaseEvent newEvent)
        {
            try
            {
                if (form.Status == MainForm.StatusEnum.Recorded)
                {
                    (form.Controls["tbMessages"] as System.Windows.Forms.TextBox).AppendText(newEvent.ToString() + "\n");
                }
            }

            catch { }

            if (newEvent is ConverterBaseEvent)
            {
                ConverterBaseEvent cbEvent = newEvent as ConverterBaseEvent;
                if (cbEvent is HeatChangeEvent && CurrentHeatNumber != (cbEvent as HeatChangeEvent).HeatNumber)
                {
                    SaveEvents(CurrentHeatNumber, AllEvents);
                    CurrentHeatNumber = (cbEvent as HeatChangeEvent).HeatNumber;
                    (form.Controls["tbMessages"] as System.Windows.Forms.TextBox).Clear();
                }
                if (CurrentHeatNumber != 0)
                {
                    AllEvents.Add(cbEvent);
                    WriteLog(CurrentHeatNumber, cbEvent);
                }
            }
        }
 public void OnEvent(BaseEvent newEvent)
 {
     if (newEvent is TestEvent) {
         var te = newEvent as TestEvent;
         Program.MainForm.Invoke(new MethodInvoker(delegate() { Program.MainForm.ListenerReceive(te); }));
     }
 }
 public void OnEvent(BaseEvent newEvent)
 {
     if (newEvent is comAdditionsEvent) {
         InstantLogger.log(newEvent.ToString(), "receive message", InstantLogger.TypeMessage.important);
         Program.OPCCon.Send(newEvent as comAdditionsEvent);
     }
 }
 public void OnEvent(BaseEvent evt)
 {
     if (evt is FlexEvent) {
         var flx = evt as FlexEvent;
         Program.Update(flx);
     }
 }
Exemplo n.º 10
0
 public void PushEvent(BaseEvent baseEvent)
 {
     try {
         if (clk.nextDay()) {
             InstantLogger.log("", "To be continued...", InstantLogger.TypeMessage.important);
             InstantLogger.LogFileInit();
             InstantLogger.log("", "...Continuing", InstantLogger.TypeMessage.important);
         }
         baseEvent.Time = DateTime.Now;
         //if (Core.Instance.Module != null)
         //{
         //    Core.Instance.Module.PushEvent(baseEvent);
         //}
         //else
         //{
         //    InstantLogger.log(baseEvent.ToString(), "Fail to transfer to Core.Instance.Module",
         //                      InstantLogger.TypeMessage.error);
         //}
         if (PushEventToClients(baseEvent))
             InstantLogger.log("", "Done processing", InstantLogger.TypeMessage.normal);
         else {
             InstantLogger.log(baseEvent.ToString(), "No listeners for admission",
                               InstantLogger.TypeMessage.error);
         }
     }
     catch (Exception e) {
         InstantLogger.log(string.Format("Exception:\n{0}\nProcessing:\n{1}", e, baseEvent.ToString()),
                           "Exception caught while processing", InstantLogger.TypeMessage.death);
     }
     return;
 }
 public void OnEvent(BaseEvent newEvent)
 {
     lock (Queue)
     {
         Queue.Enqueue(newEvent);
     }
 }
 public void OnEvent(BaseEvent newEvent)
 {
     Console.WriteLine("Event come {0}", newEvent.GetType().Name);
     lock (Queue)
     {
         Queue.Enqueue(newEvent);
     }
 }
 public void OnEvent(BaseEvent evt)
 {
     using (var l = new Logger("Listener")) {
         if (evt is FlexEvent) {
             var fxe = evt as FlexEvent;
             if (fxe.Operation.StartsWith("DBFlex.Request")) Program.Job(fxe);
         }
     }
 }
Exemplo n.º 14
0
        public bool PushEventToClients(BaseEvent baseEvent)
        {
            bool result = false;
            subscribers.ForEach(delegate(IMainGateCallback callback) {
                                    if (((ICommunicationObject) callback).State != CommunicationState.Opened) {
                                        InstantLogger.log(
                                            callback.ToString() + " is \"" +
                                            ((ICommunicationObject) callback).State.ToString() + "\"",
                                            "Dead callback is removed", InstantLogger.TypeMessage.warning);
                                        subscribers.Remove(callback);
                                    }
                                });
            try {
                bool firstLoop = true;
                foreach (var callback in subscribers) {
                    if (((ICommunicationObject) callback).State == CommunicationState.Opened) {
                        TaskInfo ti = new TaskInfo(baseEvent, callback);
                        result = System.Threading.ThreadPool.QueueUserWorkItem(new WaitCallback(OnEventTask), ti);
                        if (firstLoop) {
                            InstantLogger.log(baseEvent.ToString(),
                                              "message is delivered -- OnEvent processing initiated",
                                              InstantLogger.TypeMessage.unimportant);
                            firstLoop = false;
                        }
                        //callback.OnEvent(baseEvent);
                        result = true;
                    }
                    else {
                        InstantLogger.log(baseEvent.ToString(), "message is not delivered",
                                          InstantLogger.TypeMessage.important);
                        //subscribers.Remove(callback);
                    }
                }
            }
            catch (Exception e) {
                InstantLogger.err("source exception:\n{0}", e.ToString());
                result = false;
            }
            //subscribers.ForEach(delegate(IMainGateCallback callback)
            //{
            //    if (((ICommunicationObject)callback).State == CommunicationState.Opened)
            //    {
            //        InstantLogger.log(baseEvent.ToString(), "message is delivered", InstantLogger.TypeMessage.unimportant);
            //        callback.OnEvent(baseEvent);
            //        result = true;
            //    }
            //    else
            //    {
            //        InstantLogger.log(baseEvent.ToString(), "message is not delivered", InstantLogger.TypeMessage.important);
            //        //subscribers.Remove(callback);
            //    }

            //});

            return result;
        }
Exemplo n.º 15
0
 public static void Main(string[] args)
 {
     using (Logger l = new Logger("Bazooka"))
     {
         try
         {
             for (int i = 0; i < args.Count(); i++)
             {
                 l.msg("Command line argument {0} is <{1}>", i, args[i]);
                 if (i > 0)
                 {
                     string[] res = args[i].Split(new[] {'='}, 2);
                     ArgList.Add(res[0], res[1]);
                     l.msg("\tRecognized as <{0}>=<{1}> key-value pair", res[0], res[1]);
                 }
             }
             var o = new HeatChangeEvent(); /// нужно чтобы сборка загрузилась
             EventsList = BaseEvent.GetEvents();
             bool found = false;
             for (int index = 0; index < EventsList.Length; index++)
             {
                 if (EventsList[index].Name == args[0])
                 {
                     l.msg("Event {0} found -- preparing parameters:", args[0]);
                     EventToPush = (CommonTypes.BaseEvent) Activator.CreateInstance(EventsList[index]);
                     // Enum all the properties
                     foreach (var prop in EventsList[index].GetProperties())
                     {
                         l.msg("\tProperty {0} {1} == {2}", prop.PropertyType.ToString(), prop.Name,
                               prop.GetValue(EventToPush, null));
                     }
                     // real processing
                     found = true;
                     break;
                 }
             }
             if (found)
             {
                 m_pushGate = new ConnectionProvider.Client();
                 m_pushGate.PushEvent(EventToPush);
                 System.Threading.Thread.Sleep(1000);
                 l.msg("Event fired>\n{0}", EventToPush.ToString());
             }
             else
             {
                 l.err("Unknown event {0}", args[0]);
             }
         }
         catch (Exception e)
         {
             l.err("Exception caught:\n{0}", e.ToString());
         }
     }
 }
        public void OnEvent(BaseEvent newEvent)
        {
            if (window.StartTime == null)
            {
                window.StartTime = DateTime.Now;
            }
            if (newEvent is ConverterAngleEvent)
            {
                window.UpdateConverterAngle((newEvent as ConverterAngleEvent).Angle);
            }
            if (newEvent is LanceEvent)
            {
                if (isBlowing)
                {
                    if (gasCount == 10)
                    {
                        LanceEvent lEvent = newEvent as LanceEvent;
                        window.AddLancePoints(lEvent);
                    }
                }
            }

            if (newEvent is OffGasAnalysisEvent)
            {
                if (isBlowing)
                {
                    if (gasCount == 10)
                    {
                        OffGasAnalysisEvent ogaEvent = newEvent as OffGasAnalysisEvent;
                        window.AddGasPoints(ogaEvent);
                        gasCount = 0;
                    }
                    else
                    {
                        gasCount++;
                    }
                }
            }
            if (newEvent is BlowingEvent)
            {
                BlowingEvent be = newEvent as BlowingEvent;
                if (be.BlowingFlag == 1)
                {
                    isBlowing = true;
                    window.StartBlowingTime = DateTime.Now;
                }
                else
                {
                    isBlowing = false;
                    window.StartBlowingTime = null;
                }
            }
        }
 public void Process(BaseEvent _event)
 {
     if (_Methods.ContainsKey(_event.GetType().Name))
     {
         _Methods[_event.GetType().Name].Invoke(this, new object[] { _event });
     }
     else
     {
         //throw new NotImplementedException(string.Format("Метод обработки события {0} не найден.", _event.GetType().Name));
         Console.WriteLine(string.Format("Метод обработки события {0} не найден.", _event.GetType().Name));
     }
 }
        public static void SendMessage(BaseEvent classEvent)
        {
            m_message = new UDPMessage();
            m_message.PackEventClass(classEvent);
            DataContractJsonSerializer JSONSerializer = new DataContractJsonSerializer(typeof (UDPMessage));

            MemoryStream stream = new MemoryStream();
            JSONSerializer.WriteObject(stream, m_message);

            stream.Position = 0;
            m_udpSrv.Send(new StreamReader(stream).ReadToEnd());
        }
        public void OnEvent(BaseEvent newEvent)
        {
            //Logger.log(newEvent.ToString(), "Received", InstantLogger.TypeMessage.error);

            DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(newEvent.GetType());

            MemoryStream stream = new MemoryStream();
            jsonSerializer.WriteObject(stream, newEvent);

            stream.Position = 0;
            string str = new StreamReader(stream).ReadToEnd();

            InstantLogger.log(str, "Received and Serialize", InstantLogger.TypeMessage.normal);
        }
Exemplo n.º 20
0
 public void PushEvent(BaseEvent baseEvent)
 {
     lock (eventsQueue) {
         eventsQueue.Enqueue(baseEvent);
         if (!m_SendingThreadWork) {
             lock (m_PushEventThreadLocker) {
                 Thread thread = new Thread(SendingThread);
                 thread.IsBackground = true;
                 thread.Start();
                 m_SendingThreadWork = true;
             }
         }
     }
 }
        public void PackEventClass(BaseEvent classEvent)
        {
            var eventType = classEvent.GetType();
            m_eventClassName = eventType.Name;

            DataContractJsonSerializer JSONSerializer = new DataContractJsonSerializer(classEvent.GetType());

            MemoryStream stream = new MemoryStream();
            JSONSerializer.WriteObject(stream, classEvent);

            stream.Position = 0;
            m_eventClassJSONData = new StreamReader(stream).ReadToEnd();

            //Console.WriteLine(m_eventClassJSONData);
        }
        public void OnEvent(BaseEvent newEvent)
        {
            if (newEvent is BoundNameMaterialsEvent) {
                var bnme = newEvent as BoundNameMaterialsEvent;
                Program.MainForm.Invoke(new MethodInvoker(delegate() { Program.MainForm.MaterialsFill(bnme); }));
            }

            if (newEvent is SteelMakingPatternEvent) {
                var smpe = newEvent as SteelMakingPatternEvent;
                Program.MainForm.Invoke(new MethodInvoker(delegate() { Program.MainForm.DataFill(smpe); }));
            }

            if (
                (newEvent is comJobW3Event) ||
                (newEvent is comJobW4Event) ||
                (newEvent is comJobW5Event) ||
                (newEvent is comJobW6Event) ||
                (newEvent is comJobW7Event)
                )
                Program.MainForm.Invoke(new MethodInvoker(delegate() { Program.MainForm.ChangeBunker(newEvent); }));

            if (
                (newEvent is cntWeigher3JobReadyEvent) ||
                (newEvent is cntWeigher4JobReadyEvent) ||
                (newEvent is cntWeigher5JobReadyEvent) ||
                (newEvent is cntWeigher6JobReadyEvent) ||
                (newEvent is cntWeigher7JobReadyEvent)
                )
                Program.MainForm.Invoke(new MethodInvoker(delegate() { Program.MainForm.cntJobReady(newEvent); }));

            if (newEvent is HeatSchemaStepEvent) {
                var hsse = newEvent as HeatSchemaStepEvent;
                if (hsse.Step >= 0)
                    Program.MainForm.Invoke(new MethodInvoker(delegate() { Program.MainForm.BacklightStep(hsse.Step); }));
            }

            if (newEvent is ModeLanceEvent) {
                var MLE = newEvent as ModeLanceEvent;
                Program.MainForm.Invoke(new MethodInvoker(delegate() { Program.MainForm.SetLanceMode(MLE.LanceMode); }));
                Program.MainForm.Invoke(new MethodInvoker(delegate() { Program.MainForm.SetOxygenMode(MLE.O2FlowMode); }));
            }

            if (newEvent is ModeVerticalPathEvent) {
                var MVPE = newEvent as ModeVerticalPathEvent;
                Program.MainForm.Invoke(
                    new MethodInvoker(delegate() { Program.MainForm.SetVerticalPathMode(MVPE.VerticalPathMode); }));
            }
        }
Exemplo n.º 23
0
 public void CustomOnEvent(BaseEvent newEvent)
 {
     using (var l = new Logger("ConnectionProvider.PrimaryListener.EventProc")) {
         if (Client.protectedMode) {
             try {
                 m_EventListener.OnEvent(newEvent);
             }
             catch (Exception e) {
                 l.err("Event {0} exception {1}::{2} returned:\n{3} ", newEvent.ToString(), e.Source,
                       e.TargetSite, e.Message);
             }
         }
         else
             m_EventListener.OnEvent(newEvent);
     }
 }
        public void OnEvent(BaseEvent evt)
        {
            using (var l = new Logger("Listener")) {
                if (evt is FlexEvent) {
                    lock (Program.ResultList) {
                        var last = Program.ResultList.Count - 1;
                        var fxe = evt as FlexEvent;
                        if (fxe.Operation.StartsWith("CoreMeteringEvent")) {
                            for (int i = 0; i < Program.FlexList.Count; i++) {
                                if (fxe.Id == Program.FlexList[i].Id) {
                                    var fxhReceived = new FlexHelper(fxe);
                                    var fxhSended = new FlexHelper(Program.FlexList[i]);

                                    var timeReceive = DateTime.Now;
                                    var timeSend = (DateTime) fxhSended.GetArg("SendTime");
                                    var deltaTime = timeReceive - timeSend;
                                    var delayMs = deltaTime.TotalMilliseconds;

                                    delayMs = delayMs > 0 ? delayMs : 0;
                                    Program.ResultList[last].TotalDelayMs += delayMs;
                                    var previousDelay = Program.ResultList[last].MaxDelayMs;
                                    Program.ResultList[last].MaxDelayMs = delayMs > previousDelay
                                                                              ? delayMs
                                                                              : previousDelay;
                                    if (Program.ResultList[last].ReceivedEvents > 0) {
                                        Program.ResultList[last].AverageDelayMs =
                                            (Program.ResultList[last].TotalDelayMs/
                                             Program.ResultList[last].ReceivedEvents);
                                    }
                                    //Console.WriteLine(Program.ResultList[last].AverageDelayMs);
                                    //Console.WriteLine(delayMs);
                                    //Console.WriteLine(Program.ResultList[last].MaxDelayMs);
                                    //Console.WriteLine("send time = {0}; receive time = {1}", fxhSended.GetArg("SendTime"), fxhReceived.GetArg("SendTime"));
                                    Program.FlexList.RemoveAt(i);
                                    break;
                                }
                            }

                            Program.ResultList[last].ReceivedEvents++;
                            //Program.ResultList[last].LostEvents = Program.ResultList[last].FieredEvents -
                            //                                      Program.ResultList[last].ReceivedEvents;
                            //Console.WriteLine(Program.ResultList[last].LostEvents);
                        }
                    }
                }
            }
        }
        public void OnEvent(BaseEvent evt)
        {
            using (Logger l = new Logger("OnEvent"))
            {
                if (evt is FlexEvent)
                {
                    var fex = new FlexHelper(evt as FlexEvent);
                    if (fex.evt.Operation.StartsWith("OPC.HM-Chemistry.Event."))
                    {
                        lock (mixers)
                        {
                            mixers.Enqueue(fex);
                            mixerTimer.Interval = 1000;
                        }
                    }
                    else if (fex.evt.Operation.StartsWith("Model.Shixta-I"))
                    {
                        l.msg("{0}", fex.evt);
                    }
                }
                else if (evt is HeatChangeEvent)
                {
                    var hce = evt as HeatChangeEvent;
                    if (HeatNumber == hce.HeatNumber) return;
                    Int64 rem;
                    Int64 res = Math.DivRem(hce.HeatNumber, 10000, out rem);
                    var newHeatNumber = res * 100000 + rem;
                    HeatNumber = newHeatNumber;
                    Program.face.Invoke(new MethodInvoker(delegate()
                    {
                        Program.face.txbHeatNum.Text = Convert.ToString(HeatNumber);
                        Program.face.lblTitleHeading.Text
                            += Program.face.txbHeatNum.Text.Substring(0, 1);
                        Program.face.txbSteelTemp.Text = "1650";
                        Program.face.txbCarbonPercent.Text = "0,03";
                        Program.face.txbMgO.Text = "10";
                        Program.face.txbFeO.Text = "27";
                        Program.face.txbBasiticy.Text = "2,7";
                        Program.face.txbIronTask.Text = "300";
                        Program.face.txbIronTemp.Text = "1380";

                    }));
                }
            }
        }
        public void OnEvent(BaseEvent newEvent)
        {
            if (
                (newEvent is SteelMakingPatternEvent) ||
                (newEvent is BlowingEvent) ||
                (newEvent is WeighersStateEvent) ||
                (newEvent is ReleaseWeigherEvent) ||
                (newEvent is HeatChangeEvent) ||
                (newEvent is LanceEvent)
                ) {
                //HeatEngine.SmPattern = newEvent as SteelMakingPatternEvent;
                HeatEngine.Processor(newEvent);
                // InstantLogger.log(newEvent.ToString(), "receive message", InstantLogger.TypeMessage.important);
            }

            //InstantLogger.log(newEvent.ToString(), "receive message", InstantLogger.TypeMessage.important);
            // HeatEngine.ComSender();
            //throw new NotImplementedException();
        }
 public void OnEvent(BaseEvent evt)
 {
     using (var l = new Logger("ModelRunner::Listener"))
     {
         if (evt is OPCDirectReadEvent)
         {
             var odr = evt as OPCDirectReadEvent;
             if (odr.EventName == "HeatChangeEvent")
             {
                 var hce = new HeatChangeEvent();
                 hce.HeatNumber = /*++*/HeatNumber;
                 Program.m_pushGate.PushEvent(hce);
             }
             else if (odr.EventName == "visAdditionTotalEvent")
             {
                 var vate = new visAdditionTotalEvent();
                 vate.RB5TotalWeight = 5;
                 vate.RB6TotalWeight = 6;
                 vate.RB7TotalWeight = 7;
                 vate.RB8TotalWeight = 8;
                 vate.RB9TotalWeight = 9;
                 vate.RB10TotalWeight = 10;
                 vate.RB11TotalWeight = 11;
                 vate.RB12TotalWeight = 12;
                 Program.m_pushGate.PushEvent(vate);
             }
             else if (odr.EventName == "BoundNameMaterialsEvent")
             {
                 var bnme = new BoundNameMaterialsEvent();
                 bnme.Bunker5MaterialName = ReEncoder("ДОЛОМС");
                 bnme.Bunker6MaterialName = ReEncoder("ALKонц");
                 bnme.Bunker7MaterialName = ReEncoder("KOKS  ");
                 bnme.Bunker8MaterialName = ReEncoder("ИЗВЕСТ");
                 bnme.Bunker9MaterialName = ReEncoder("ИЗВЕСТ");
                 bnme.Bunker10MaterialName = ReEncoder("ФОМ   ");
                 bnme.Bunker11MaterialName = ReEncoder("ДОЛМИТ");
                 bnme.Bunker12MaterialName = ReEncoder("ДОЛОМС");
                 Program.m_pushGate.PushEvent(bnme);
             }
         }
     }
 }
 public void OnEvent(BaseEvent evt)
 {
     using (Logger l = new Logger("Corelistener.OnEvent")) {
         if (evt is FlexEvent) {
             var fex = new FlexHelper(evt as FlexEvent);
             if (fex.evt.Operation.StartsWith("OPC.HM-Chemistry.Event.")) {
                 lock (mixers) {
                     mixers.Enqueue(fex);
                     mixerTimer.Interval = 1000;
                     ClientFace.ironTable.dgw.RowCount = 0;
                 }
             }
             else if (fex.evt.Operation.StartsWith("Model.Shixta-I")) {
                 l.msg("{0}", fex.evt);
             }
         }
         else if (evt is HeatChangeEvent) {
             var hce = evt as HeatChangeEvent;
             Int64 rem;
             Int64 res = Math.DivRem(hce.HeatNumber, 10000, out rem);
             var newHeatNumber = res*100000 + rem;
             HeatNumber = newHeatNumber;
             ClientFace.Invoke(new MethodInvoker(delegate() {
                 ClientFace.txbHeatNum.Text = Convert.ToString(HeatNumber + 1);
                 if (ClientFace.m_cn !=
                     ClientFace.txbHeatNum.Text.Substring(0, 1)) {
                     ClientFace.m_cn = ClientFace.txbHeatNum.Text.Substring(
                         0, 1);
                     ClientFace.lblTitleHeading.Text =
                         ClientFace.lblTitleHeading.Text.Replace("X",
                                                                 ClientFace.
                                                                     m_cn);
                 }
                 ClientFace.lblTitleHeading.Text =
                     ClientFace.lblTitleHeading.Text.Replace(WhatToFind,
                                                             Convert.ToString
                                                                 (HeatNumber));
                 WhatToFind = Convert.ToString(HeatNumber);
             }));
         }
     }
 }
 public void OnEvent(BaseEvent evt)
 {
     using (Logger l = new Logger("OnEvent")) {
         const string OPKEY = "OPC.Read-";
         if (evt is FlexEvent) {
             var fex = evt as FlexEvent;
             if (fex.Operation.StartsWith(OPKEY)) {
                 var targetOpCode = fex.Operation.Substring(OPKEY.Length);
                 foreach (var d in Program.descriptions) {
                     if (d.Operation.StartsWith(targetOpCode))
                         Program.fireFlex(d);
                 }
             }
             else if ((fex.Flags & FlexEventFlag.FlexEventOpcNotification) == 0) {
                 int[] aE;
                 foreach (var d in Program.descriptions) {
                     if (fex.Operation == d.Operation) {
                         Console.WriteLine("Matching FlexEvent \"{0}\"", fex.Operation);
                         var sHandles = new List<int>();
                         var values = new List<object>();
                         foreach (var fa in fex.Arguments) {
                             foreach (var da in d.Arguments) {
                                 if (fa.Key == da.Key) {
                                     // Copy Value by ServerHandle
                                     sHandles.Add(((Element) da.Value).sHandle);
                                     ((Element) da.Value).val = fa.Value;
                                     values.Add(fa.Value);
                                 }
                             }
                             Program.OpcGroup_.Write(sHandles.ToArray(), values.ToArray(), out aE);
                         }
                         break;
                     }
                 }
             }
         }
     }
 }
 public void OnEvent(BaseEvent evt)
 {
     Program.MainGateProvider.PushEvent(evt);
 }