Exemplo n.º 1
0
        /// <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();
        }
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();
        }