Exemplo n.º 1
0
        private Stock stock = null; // реализует первичную обработку пакетов

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Инициализирует новый экземпляр класса
        /// </summary>
        /// <param name="stocker">Парсер пакетов</param>
        public Converter(Stock stocker, Float[] result)
        {
            parameters = result;

            p_locker = new ReaderWriterLock();
            f_locker = new ReaderWriterLock();

            formuls = new List<Formula>();

            stock = stocker;
            state = State.Default;

            t_mutex = new Mutex();
            sync_call = new TimerCallback(TimerCallback);
        }
Exemplo n.º 2
0
        private Mutex t_mutex = null; // синхронизатор таймера

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Инициализирует новый экземпляр класса
        /// </summary>
        protected Application()
        {
            signals = new Float[size];
            results = new Float[size];

            repository = new Repository();
            repository.onError += new ApplicationErrorHandler(ErrorHandler);

            for (int i = 0; i < size; i++)
            {
                signals[i] = new Float();
                results[i] = new Float();
            }

            journal = Journal.CreateInstance();

            p_locker = new ReaderWriterLock();

            crc = TypeCRC.Cycled;
            mode = ApplicationMode.Active;

            serial = new Serial(repository);
            serial.Secondary = new SecondaryPort(repository);

            stock = new Stock(signals);

            display = new DisplayUnit(repository);
            converter = new Converter(stock, results);

            devTcpOld = new TcpDevManager();

            t_mutex = new Mutex();
            timer = new Timer(TimerElapsed, null, Timeout.Infinite, period);

            devTcpOld.Place = repository.InstancePlace();

            saver = new Saver();
            service = new Service();
        }