private static void Main(string[] args) { InstantLogger.writeLogConsole = false; using (Logger l = new Logger("Fledged")) { try { var o = new HeatChangeEvent(); /// нужно чтобы сборка загрузилась m_pushGate = new ConnectionProvider.Client(); var mainConf = System.Configuration.ConfigurationManager.OpenExeConfiguration(""); var progId = mainConf.AppSettings.Settings["OPCServerProgID"].Value; var addrFmt = mainConf.AppSettings.Settings["OPCAddressFormat"].Value; var dest = mainConf.AppSettings.Settings["OPCDestination"].Value; var convSchema = Convert.ToInt32(mainConf.AppSettings.Settings["OPCConvSchema"].Value); var reqUpdateRateMs = Convert.ToInt32(mainConf.AppSettings.Settings["OPCCReqUpdateRate_ms"].Value); l.msg("OPC Fledged started with ProgID=[{0}] for {1} aids conv schema {2}", progId, dest, convSchema); OPCCon = new OpcConnector(progId, dest, addrFmt, convSchema, reqUpdateRateMs); var receiverThread = new Thread(Receiver); receiverThread.Start(); Console.WriteLine("Нажмите <ENTER> для выхода."); Console.ReadLine(); OPCCon.CloseConnection(); l.msg("OPC Fledged exit"); } catch (Exception e) { l.err("Exception <{0}> -- execution terminated", e.ToString()); } catch { l.err("Unknown exception -- execution terminated"); } } }
private static void Main(string[] args) { var o = new HeatChangeEvent(); MainGate = new Client(new Listener()); MainGate.Subscribe(); Iterator.Init(); Console.WriteLine("Press Enter for exit"); Console.ReadLine(); }
public MainForm(bool autoStart) { InitializeComponent(); if (autoStart) { Record(); } var o = new HeatChangeEvent(); }
static void Main(string[] args) { ConnectionProvider.Client mainGate; var o = new HeatChangeEvent(); mainGate = new ConnectionProvider.Client(new Listener()); mainGate.Subscribe(); Console.WriteLine("Breake Listenere Started"); Console.ReadLine(); }
private static void Main(string[] args) { var o = new HeatChangeEvent(); MainGateReceiver = new Client("Receiv", new Listener()); MainGateReceiver.Subscribe(); MainGateProvider = new Client("Fire"); Console.WriteLine("Press Enter for exit"); Console.ReadLine(); }
public void Init() { lbSteelType.ItemsSource = GetSteelTypesData(); var o = new HeatChangeEvent(); Requester.MainGate = new Client(new Listener()); Requester.MainGate.Subscribe(); Requester.ReqPatternNames(Requester.MainGate); }
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 Process(HeatChangeEvent _event) { //this.Converter1Heat.HeatChangeEvent. if (this._Module._Heat.Number != _event.HeatNumber) { this._Module._Heat = new Heat(); this._Module._Heat.Number = _event.HeatNumber; this._Module._Heat.AggregateNumber = this._Module.ConverterNumber; this._Module._Heat.StartDate = _event.Time; } }
private static void Receiver(object state) { using (Logger l = new Logger("CoreListener")) { var o = new HeatChangeEvent(); var mainConf = System.Configuration.ConfigurationManager.OpenExeConfiguration(""); m_listenGate = new ConnectionProvider.Client(new CoreListener( mainConf.AppSettings.Settings["OPCAddressFormat"].Value, mainConf.AppSettings.Settings["OPCDestination"].Value )); m_listenGate.Subscribe(); } }
public Graph() { InitializeComponent(); bpIsCreated = false; Init(); m_onLoad = new System.Threading.Timer(new TimerCallback(TimerOnload)); m_onLoad.Change(500, 0); PaintGraphs = new SimpleGrp(pbGraph.Font); var o = new HeatChangeEvent(); m_listenGate = new ConnectionProvider.Client(new Listener()); m_listenGate.Subscribe(); }
private static void Main(string[] args) { m_pushGate = new Client(); // m_pushGate.PushEvent(new BlowingEvent()); /* MemoryStream stream = new MemoryStream(); BlowingEvent be = new BlowingEvent() {BlowingFlag = 1,O2TotalVol = 333}; DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(be.GetType()); jsonSerializer.WriteObject(stream, be); stream.Position = 0; string str = new StreamReader(stream).ReadToEnd(); Console.WriteLine(str); byte[] b = new byte[str.Length]; for (int i = 0; i < str.Length; i++) { b[i] = Convert.ToByte(str.ToCharArray()[i]); } MemoryStream stream2 = new MemoryStream(b); stream.Position = 0; var des = jsonSerializer.ReadObject(stream); Console.WriteLine(des.ToString()); stream2.Position = 0; var des2 = jsonSerializer.ReadObject(stream2); Console.WriteLine(des2.ToString());*/ //UDPTools srv = new UDPTools(); //srv.StartUDPServer(); var o = new HeatChangeEvent(); m_listenGate = new ConnectionProvider.Client(new Listener()); m_listenGate.Subscribe(); UDPDataProvider.Init(); while (true) { Thread.Sleep(1000); UDPDataProvider.SendMessage(o); } //UDPMessage m = new UDPMessage(); //m.PackEventClass(o); //var res = m.RestoreEventClass(BaseEvent.GetEvents()); //Console.WriteLine(res.ToString()); Console.WriteLine("JSONClient стартовал, нажмите \"Enter\" для выхода"); Console.ReadLine(); }
public static void Init() { MainConf = System.Configuration.ConfigurationManager.OpenExeConfiguration(""); var o = new HeatChangeEvent(); MainGate = new Client(new Listener()); MainGate.Subscribe(); Cfg = new Conf(); Cfg.FirstModel = Int32.Parse(MainConf.AppSettings.Settings["DefFirstModel"].Value); Cfg.SecondModel = Int32.Parse(MainConf.AppSettings.Settings["DefSecondModel"].Value); Cfg.ThirdModel = Int32.Parse(MainConf.AppSettings.Settings["DefThirdModel"].Value); Reset(); }
private static void Main(string[] args) { var o = new HeatChangeEvent(); MainGate = new Client(new Listener()); MainGate.Subscribe(); EventLoop.Init(); Keeper.SetMainGate(MainGate); EventLoop.HandlerList.Add(Keeper.MainHandler); EventLoop.RunLoop(); Console.WriteLine("Press Enter for exit\n"); Console.ReadLine(); }
private static void receiver(object state) { var o = new HeatChangeEvent(); mainGate = new ConnectionProvider.Client(new Listener()); mainGate.Subscribe(); //Thread.Sleep(5000); //mainGate.Unsubscribe(); //Console.BackgroundColor = ConsoleColor.Black; //Console.ForegroundColor = ConsoleColor.Green; /*lock (consoleLock) { Console.WriteLine("receiver......................................................................................[started]\n"); }*/ InstantLogger.log("receiver", "Started", InstantLogger.TypeMessage.important); }
private static void Init() { MainConf = System.Configuration.ConfigurationManager.OpenExeConfiguration(""); var o = new HeatChangeEvent(); MainGate = new Client(new Listener()); MainGate.Subscribe(); Separator = MainConf.AppSettings.Settings["separator"].Value.ToArray()[0]; StorePath = MainConf.AppSettings.Settings["StorePath"].Value; ConverterNumber = Int32.Parse(MainConf.AppSettings.Settings["converterNumber"].Value); DefaultPattern = MainConf.AppSettings.Settings["DefPattrn"].Value; InitTbl = new CSVTableParser(); TablePaths = ScanStore(StorePath); try { Tables = LoadTables(DefaultPattern, ref InitTbl); InstantLogger.msg("default pattern \"{0}\" loaded", DefaultPattern); } catch (Exception) { InstantLogger.err("can't load pattern \"{0}\",\nTry load pattern \"default\"", DefaultPattern); Tables = LoadTables("default", ref InitTbl); } if (Tables == null) InstantLogger.err("default pattern not loaded"); CalcModeIsAutomatic = false; Saver = new DataSaver(); IterateTimer.Elapsed += new ElapsedEventHandler(IterateTimeOut); IterateTimer.Enabled = true; Reset(); //SaveTables("new", InitTbl, Tables); ////////////////////////////////// //CSVTP_FlexEventConverter.AppName = "Charge5"; //var tableFlex = CSVTP_FlexEventConverter.PackToFlex("newToFlex", InitTbl, Tables); //var name = ""; //CSVTP_FlexEventConverter.UnpackFromFlex(tableFlex, ref InitTbl, ref Tables, ref name); //Console.WriteLine("Pare: {0}", name); //SaveTables("newFromFlex", InitTbl, Tables); }
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!"); }
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 Init() { MainConf = System.Configuration.ConfigurationManager.OpenExeConfiguration(""); //CfgMainDir = ConfigurationManager.OpenExeConfiguration("").AppSettings.Settings["CfgMainDir"].Value; var o = new HeatChangeEvent(); MainGate = new Client(new Listener()); MainGate.Subscribe(); TableData = new List<TableRow>(); StandartTableData = new List<TableRow>(); dgScheme.ItemsSource = TableData; dgScheme.Items.Refresh(); TableSchema = new List<string>(); TableSchema.Add("Схема 1"); TableSchema.Add("Схема 2"); TableSchema.Add("Схема 3"); cbScheme.ItemsSource = TableSchema; }
private static void Main(string[] args) { var o = new HeatChangeEvent(); MainGate = new Client(new Listener()); MainGate.Subscribe(); MainConf = System.Configuration.ConfigurationManager.OpenExeConfiguration(""); ConverterNumber = Convertion.StrToInt32( ConfigurationManager.OpenExeConfiguration("").AppSettings.Settings["converterNumber"].Value); Iterator.CSVHimFilePath = ConfigurationManager.OpenExeConfiguration("").AppSettings.Settings["CSVHimFilePath"].Value; //Iterator.MatrixFileName = // ConfigurationManager.OpenExeConfiguration("").AppSettings.Settings["MatrixFileName"].Value; Iterator.Init(); Console.WriteLine("Press Enter for exit\n"); Console.ReadLine(); }
private static void Main(string[] args) { try { ConverterNumber = Convertion.StrToInt32( (string) ConfigurationManager.OpenExeConfiguration("").AppSettings.Settings["converterNumber"].Value); } catch (Exception e) { InstantLogger.err("Bad config called error: {0}", e.ToString()); throw e; } CIterator.Init(); var o = new HeatChangeEvent(); PushGate = new Client(); m_listenGate = new Client(new Listener()); m_listenGate.Subscribe(); CIterator.IterateTimer.Elapsed += new ElapsedEventHandler(CIterator.IterateTimeOut); CIterator.IterateTimer.Enabled = true; Console.WriteLine("Carbone processor is running, press enter to exit"); Console.ReadLine(); }
private static void Receiver(object state) { var o = new HeatChangeEvent(); m_listenGate = new ConnectionProvider.Client(new Listener()); m_listenGate.Subscribe(); InstantLogger.log("receiver", "Started", InstantLogger.TypeMessage.important); }
private void Record() { switch (Status) { case StatusEnum.Recorded: if (mainGate != null) { mainGate.Unsubscribe(); Status = StatusEnum.Stopped; UpdateControls("Запись приостановлена"); } break; default: try { Status = StatusEnum.Recorded; var o = new HeatChangeEvent(); mainGate = new ConnectionProvider.Client(new EventsListener(this)); //mainGate = new ConnectionProvider.Client(); mainGate.Subscribe(); UpdateControls("Идёт запись"); } catch { Status = StatusEnum.Stopped; UpdateControls("Не могу подключиться для записи."); return; } break; } }
private static void Main(string[] args) { var o = new HeatChangeEvent(); MainGate = new Client(new Listener()); MainGate.Subscribe(); MainConf = System.Configuration.ConfigurationManager.OpenExeConfiguration(""); MatrixPath = MainConf.AppSettings.Settings["MatrixPath"].Value; MatrixTotalDir = MainConf.AppSettings.Settings["MatrixTotalDir"].Value; Directory.CreateDirectory(MatrixTotalDir); MatrixTotalPath = MatrixTotalDir + "\\" + ArchNameGenerate("TOTAL"); COMax = Double.Parse(MainConf.AppSettings.Settings["COMax"].Value); COMin = Double.Parse(MainConf.AppSettings.Settings["COMin"].Value); Iterator.Init(); Console.WriteLine("Press Enter for exit\n"); Console.ReadLine(); }
private bool ProcessEvent(HeatChangeEvent _event) { _event.HeatNumber = int.Parse(_event.HeatNumber.ToString().Insert(2, "0")); int prevHeatNumber; if (!Repositary.ContainsKey("PrevHeatNumber")) { Repositary.Add("PrevHeatNumber", HeatNumber); prevHeatNumber = 0; } else { prevHeatNumber = (int)Repositary["PrevHeatNumber"]; } if (prevHeatNumber != _event.HeatNumber) { try { DBWorker.Instance.Insert((int)HeatPassportOperations.HeatChangeEvent, _event.Time, m_ConverterNumber, HeatNumber, _event.HeatNumber); m_Repositary = new Dictionary<string, object>(); Repositary.Add("PrevHeatNumber", _event.HeatNumber); } catch { return false; } } m_HeatNumber = _event.HeatNumber; Repositary["PrevHeatNumber"] = _event.HeatNumber; return true; }
static void Main(string[] args) { MainConf = System.Configuration.ConfigurationManager.OpenExeConfiguration(""); CfgMainDir = ConfigurationManager.OpenExeConfiguration("").AppSettings.Settings["CfgMainDir"].Value; ConnectionStr = ConfigurationManager.OpenExeConfiguration("").AppSettings.Settings["ConnectionString"].Value; Cfg = new CfgLoader(CfgMainDir); var o = new HeatChangeEvent(); MainGate = new Client(new Listener()); MainGate.Subscribe(); Console.WriteLine("Press Enter for exit"); Console.ReadLine(); }
private static void Main(string[] args) { var o = new HeatChangeEvent(); MainGate = new Client(new Listener()); MainGate.Subscribe(); //var fex = new FlexHelper("ccc"); //fex.Fire(MainGate); Directory.CreateDirectory(Dir); FlexList = new List<FlexEvent>(); ResultList = new List<HourResult> {new HourResult()}; FireTimer.Elapsed += new ElapsedEventHandler(FireTimerHandler); FireTimer.Enabled = true; HourTimer.Elapsed += new ElapsedEventHandler(HourTimerHandler); HourTimer.Enabled = true; Console.WriteLine("Press Enter for exit\n"); Console.ReadLine(); }
private static void ListenThread() { var o = new HeatChangeEvent(); m_listenGate = new ConnectionProvider.Client(new Listener()); m_listenGate.Subscribe(); // Logger.log("Listener subscribe"); }
private static void Receiver(object state) { var o = new HeatChangeEvent(); m_mainGate = new ConnectionProvider.Client(new Listener()); m_mainGate.Subscribe(); }
private static void Main(string[] args) { Directory.CreateDirectory(PathArch); try { Separator = ((string) ConfigurationManager.OpenExeConfiguration("").AppSettings.Settings["separator"].Value). ToCharArray()[0]; ConverterNumber = Convertion.StrToInt32( (string) ConfigurationManager.OpenExeConfiguration("").AppSettings.Settings["converterNumber"].Value); } catch (Exception e) { InstantLogger.err("Bad config called error: {0}", e.ToString()); throw e; } AnyMatryxLoader(); CIterator.Init(); CIterator.IterateTimer.Elapsed += new ElapsedEventHandler(CIterator.IterateTimeOut); CIterator.IterateTimer.Enabled = true; //CIterator.DataCurrentHeat.MatrixStateData = MFCMDataGenerate(MatrixStateDataFull); var o = new HeatChangeEvent(); PushGate = new Client(); m_listenGate = new Client(new Listener()); m_listenGate.Subscribe(); Console.WriteLine("Carbone processor is running, press enter to exit"); Console.ReadLine(); }
private bool DoHeatChangeEvent(int iIdxInPointLi) { bool bErg = false; try { HeatChangeEvent evHeatChange = new HeatChangeEvent(); evHeatChange.iCnvNr = pointLi[iIdxInPointLi].iCnvNr; j = findPoint("NEWHEATID",pointLi[iIdxInPointLi].iCnvNr); if (j >= 0) { evHeatChange.HeatNumber = pointLi[j].iDataValue; sLfdEvtMsg = evHeatChange.ToString(); mainGate.PushEvent(evHeatChange); bErg = true;//К2 Смена плавки 218521 -> 218522 AddLogg("K" + pointLi[iIdxInPointLi].iCnvNr + " Смена плавки,новый номер "+pointLi[j].iDataValue); } else { AddLogg("При HeatChangeEvent не найдена точка K" + pointLi[iIdxInPointLi].iCnvNr + " NEWHEATID"); } } catch (Exception eXc) { sLfdEvtErr = eXc.Message; AddLogg("При HeatChangeEvent K" + pointLi[iIdxInPointLi].iCnvNr + " Exception: " + eXc.Message); } return bErg; }