static void Main(string[] args) { var o = new HeatChangeEvent(); var mainConf = System.Configuration.ConfigurationManager.OpenExeConfiguration(""); m_listenGate = new ConnectionProvider.Client(new Listener()); m_listenGate.Subscribe(); m_pushGate = new ConnectionProvider.Client(); Thread.Sleep(1000); // запрашиваем привязку бункеров к материалам m_pushGate.PushEvent(new OPCDirectReadEvent() { EventName = typeof(BoundNameMaterialsEvent).Name }); // навески m_pushGate.PushEvent(new OPCDirectReadEvent() { EventName = typeof(visAdditionTotalEvent).Name }); Thread.Sleep(1000); // текущий номер плавки m_pushGate.PushEvent(new OPCDirectReadEvent() { EventName = typeof(HeatChangeEvent).Name }); Console.WriteLine("TransferModelBunkers is running, press enter to exit"); Console.ReadLine(); Console.WriteLine("Bye!"); }
static void Main(string[] args) { var mainConf = System.Configuration.ConfigurationManager.OpenExeConfiguration(""); var conf = new System.ServiceModel.Configuration.ClientSection(); //((System.ServiceModel.Configuration.ClientSection)mainConf.SectionGroups["system.serviceModel"].Sections["client"]).Endpoints[0] mainGate = new ConnectionProvider.Client(); mainGate.Subscribe(); Console.WriteLine("Press Enter"); Console.ReadLine(); mainGate.PushEvent(new HeatChangeEvent() { HeatNumber = 1001 }); Console.WriteLine("Press Enter"); Console.ReadLine(); mainGate.PushEvent(new HeatChangeEvent() { HeatNumber = 100 }); Console.WriteLine("Press Enter"); Console.ReadLine(); mainGate.PushEvent(new HeatChangeEvent() { HeatNumber = 101 }); Console.WriteLine("Press Enter"); Console.ReadLine(); CultureInfo culture = CultureInfo.InvariantCulture; Assembly executingAssembly = Assembly.GetExecutingAssembly(); // load spim-generated data from embedded resource file //const string spimDataName = ; for (int i = 0; i < 1000; i++) { Console.WriteLine("Press Enter"); Console.ReadLine(); // mainGate.PushEvent(new Esms.FingersStateEvent { FingersOpened = true, Time = DateTime.Now }); } //mainGate.PushEvent(new HeatChangeEvent() { HeatNumber = 1001, iCnvNr = DateTime.Now.Second % 2 + 1, Time = DateTime.Now }); //Console.ReadLine(); mainGate.PushEvent(new LanceEvent() { O2TotalVol = 20 }); Console.ReadLine(); for (int i = 0; i < 1000; i++) { Thread.Sleep(100); mainGate.PushEvent(new LanceEvent() { O2TotalVol = i * 20 }); } Console.ReadLine(); }
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 Play() { try { EventsListener el = new EventsListener(this); mainGate = new ConnectionProvider.Client(el); DateTime? lastTime = null; this.Invoke((Action)delegate { pbProgress.Step = 1; }); this.Invoke((Action)delegate { tbMessages.Clear(); }); int ProgressBarUpdatePeriod = (int)(allEvents.Last().Time - allEvents.First().Time).TotalSeconds / 100; DateTime LastProgressbarUpdate = allEvents.First().Time; foreach (BaseEvent _event in allEvents) { while (PauseThread) { System.Threading.Thread.Sleep(1); } if (lastTime != null) { try { Thread.Sleep((int)((_event.Time - lastTime.Value).TotalMilliseconds) / speed); } catch (Exception e) { Thread.Sleep(0); } } //this.Invoke((Action)delegate { tbMessages.AppendText(string.Format("{0}\n\n", allEvents[time].ToString())); }); lastTime = _event.Time; mainGate.PushEvent(_event); if ((_event.Time - LastProgressbarUpdate).TotalSeconds > ProgressBarUpdatePeriod) { this.Invoke((Action)delegate { pbProgress.PerformStep(); }); LastProgressbarUpdate = _event.Time; } //this.Invoke((InvokeDelegate)((String s) => { tbMessages.AppendText(s + "\n"); }), allEvents[time].ToString()); } this.Invoke((Action)delegate { pbProgress.Value = 0; }); Status = StatusEnum.Stopped; this.Invoke((Action)delegate { UpdateControls(""); }); } catch (Exception e) { e.ToString(); } }