public VisMain()
        {
            InitializeComponent();

            dgHaderLance.RowCount = LanceStringsCount;
            dgPatternLance.RowCount = LanceStringsCount;

            dgHaderAdditions.RowCount = MaterialsCount;
            dgPatternAdditions.RowCount = MaterialsCount;

            m_cntJobReadyList = new List<int>();
            for (int i = 0; i < WeigherNum; i++)
                m_cntJobReadyList.Add(0);

            PushGate = new Client();

            var o = new TestEvent();
            ListenGate = new Client(new Listener());
            ListenGate.Subscribe();

            initTimer.Interval = 2000;
            initTimer.Start();

            LanceHaderFill();

            comJobW3Old = new comJobW3Event();
            comJobW4Old = new comJobW4Event();
            comJobW5Old = new comJobW5Event();
            comJobW6Old = new comJobW6Event();
            comJobW7Old = new comJobW7Event();

            //gbW3.BackColor = Color.FromArgb(0,0,50);
            //gbW4.BackColor = Color.FromArgb(255,100,0);
        }
 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 EventsStack()
 {
     _processingHeat = false;
     _eventsQueue = new Queue<BaseEvent>();
     var t = new Thread(StartProcessingStack);
     t.Start();
     _gate = new Client();
     _gate.Subscribe();
 }
        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 static void Init()
 {
     CapturedEvents = new List<CEDataFormat>();
     var o = new FlexEvent();
     MainGate = new Client(new Listener());
     MainGate.Subscribe();
     Load();
     SaveTimer.Elapsed += new ElapsedEventHandler(SaveTimeOut);
     SaveTimer.Enabled = true;
 }
 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();
     }
 }
        private static void Main(string[] args)
        {
            MainConf = System.Configuration.ConfigurationManager.OpenExeConfiguration("");
            Destination = MainConf.AppSettings.Settings["OPCDestination"].Value;
            CfgPath = MainConf.AppSettings.Settings["CfgPath"].Value;
            var reqUpdateRateMs = Convert.ToInt32(MainConf.AppSettings.Settings["OPCReqUpdateRate"].Value);

            MainGate = new ConnectionProvider.Client(new CoreListener());
            MainGate.Subscribe();

            var descriptionLoader = new LoaderCSV(Destination);
            descriptions = descriptionLoader.LoadAndGet(CfgPath);

            OpcServer_ = new OpcServer();
            OpcServer_.Connect(MainConf.AppSettings.Settings["OPCServerProgID"].Value);
            OpcGroup_ = OpcServer_.AddGroup(Destination + "-flex-events", false, reqUpdateRateMs);
            OpcGroup_.DataChanged += OnDataChange;

            var hClient = 0;
            for (int dix = 0; dix < descriptions.Count; dix++) {
                var d = descriptions[dix];
                foreach (var item in d.Arguments) {
                    OpcItemDefs_.Add(new OPCItemDef(((Element) item.Value).opcItemID, true, ++hClient, VarEnum.VT_EMPTY));
                    ((Element) item.Value).cHandle = hClient;
                }
            }
            int[] aE;
            int addCount = 0;
            while (!OpcGroup_.AddItems(OpcItemDefs_.ToArray(), out OpcItemResults_)) {
                //if (++addCount > 1) throw new InvalidDataException("!!!AddItems failed");
                for (var i = 0; i < OpcItemResults_.Count(); i++) {
                    if (HRESULTS.Failed(OpcItemResults_[i].Error)) {
                        OpcItemDefs_.RemoveAt(i);
                        break;
                    }
                }
                OpcGroup_.RemoveItems(OpcItemResults_.Select(ir => ir.HandleServer).ToArray(), out aE);
            }
            int k = 0;
            for (int j = 0; j < OpcItemDefs_.Count(); j++)
                SetServerHandle(OpcItemDefs_[j].HandleClient, OpcItemResults_[k++].HandleServer);
            for (int dix = 0; dix < descriptions.Count; dix++)
                Console.WriteLine(descriptions[dix]);
            OpcGroup_.Active = true;
            Console.WriteLine("OPCFlex is running, press enter to exit");
            Console.ReadLine();
            OpcGroup_.DataChanged -= OnDataChange;
            OpcGroup_.RemoveItems(OpcItemResults_.Select(ir => ir.HandleServer).ToArray(), out aE);
            OpcGroup_.Remove(false);
            OpcServer_.Disconnect();
            Console.WriteLine("Bye!");
        }
        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();
        }
 public static void Main()
 {
     using (CheckTimer)
     {
         _mainGate = new Client();
         _mainGate.Subscribe();
          _dB = new DBLayer(Convert.ToInt32(ConfigurationManager.AppSettings["UnitNumber"]));
         CheckTimer.Elapsed += CheckTimerElapsed;
         CheckTimer.Start();
         Console.WriteLine("Sync started. Press any key to stop.");
         Console.ReadKey();
         CheckTimer.Stop();
     }
 }
        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 Main()
 {
     _previousLoadEvent = new ScrapLoadEvent() { Id = 91854, LoadDateTime = Convert.ToDateTime("2012-05-07 23:13:19.000") };
     using (CheckTimer)
     {
         _mainGate = new Client();
         _mainGate.Subscribe();
         CheckTimer.Elapsed += CheckTimerElapsed;
         CheckTimer.Start();
         Console.WriteLine("Sync started. Press any key to stop.");
         Console.ReadKey();
         CheckTimer.Stop();
     }
 }
        public CTMainForm()
        {
            InitializeComponent();

            PushGate = new Client();

            var o = new TestEvent();
            ListenGate = new Client(new Listener());
            ListenGate.Subscribe();

            m_pushEvent = 0;
            m_receiveEvent = 0;
            m_loss = 0;
            isStarted = false;
        }
 public void Init()
 {
     MainGate = new Client(ClientName, this);
     MainGate.Subscribe();
     mixerTimer.Interval = 1000;
     mixerTimer.AutoReset = false;
     mixerTimer.Enabled = true;
     mixerTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
     // список доступных миксеров
     var fex = new FlexHelper("OPC.Read-OPC.HM-Chemistry.Event.");
     ClientFace.ironTable.dgw.RowCount = 0;
     fex.Fire(MainGate);
     // текущий номер плавки
     MainGate.PushEvent(new OPCDirectReadEvent() {EventName = typeof (HeatChangeEvent).Name});
 }
        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);
        }
        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_mainGate = new ConnectionProvider.Client(new Listener());
     m_mainGate.Subscribe();
 }
        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 static void Main()
 {
     var o = new HeatChangeEvent();
     var eListener = new Listener();
     var listener = new Client(eListener);
     listener.Subscribe();
     Console.WriteLine("Started");
     Console.ReadKey();
 }
        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 Init()
        {
            MatrixT = new CSVTableParser();
            MatrixC = new CSVTableParser();
            MainConf = System.Configuration.ConfigurationManager.OpenExeConfiguration("");

            CurrentScheme = Int32.Parse(MainConf.AppSettings.Settings["Scheme"].Value);

            Separator = MainConf.AppSettings.Settings["separator"].Value.ToArray()[0];
            MatrixT.FileName = MainConf.AppSettings.Settings["matrixT"].Value;
            MatrixT.Separator = Separator;

            var o = new FlexEvent();
            MainGate = new ConnectionProvider.Client(new Listener());
            MainGate.Subscribe();

            MatrixTDescription = new List<ColumnPath>();
            MatrixTDescription.Add(new ColumnPath() { ColumnName = "CMin", ColumnType = typeof(double) });
            MatrixTDescription.Add(new ColumnPath() { ColumnName = "CMax", ColumnType = typeof(double) });
            MatrixTDescription.Add(new ColumnPath() { ColumnName = "OxygenOnHeating", ColumnType = typeof(int) });
            MatrixTDescription.Add(new ColumnPath() { ColumnName = "Heating", ColumnType = typeof(int) });
            #if IS_DBFLEX
            ReqScheme(CurrentScheme);
            #else
            MatrixT.Description = MatrixTDescription;
            MatrixT.Load();
            #endif

            MatrixC.FileName = MainConf.AppSettings.Settings["matrixC"].Value;
            MatrixC.Separator = Separator;

            MatrixC.Description.Add(new ColumnPath() {ColumnName = "CMin", ColumnType = typeof (double)});
            MatrixC.Description.Add(new ColumnPath() {ColumnName = "CMax", ColumnType = typeof (double)});
            MatrixC.Description.Add(new ColumnPath() {ColumnName = "OxygenOnCarbon", ColumnType = typeof (int)});

            MatrixC.Load();

            WaitSublanceData = new Timer();
            WaitSublanceData.Elapsed += new ElapsedEventHandler(SublanceDataLost);

            CarbonIterateTimer.Elapsed += new ElapsedEventHandler(CarbonIterator);
            CarbonIterateTimer.Enabled = true;

            Reset();
        }
        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 static void ListenThread()
 {
     var o = new HeatChangeEvent();
     m_listenGate = new ConnectionProvider.Client(new Listener());
     m_listenGate.Subscribe();
        // Logger.log("Listener subscribe");
 }