예제 #1
0
        static void DoBenchmark()
        {
            using (IrbisConnection connection = new IrbisConnection())
            {
                connection.ParseConnectionString(ConnectionString);
                connection.Connect();
                Console.WriteLine("Connected");

                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();

                for (int i = 0; i < RetryCount; i++)
                {
                    connection.NoOp();
                }

                stopwatch.Stop();
                connection.Dispose();
                Console.WriteLine("Disconnected");

                long ms = stopwatch.ElapsedMilliseconds;
                Console.WriteLine("Elapsed: {0} ms", ms);
                long one = ms / RetryCount;
                Console.WriteLine("One: {0} ms", one);
            }
        }
예제 #2
0
        public static bool Ping()
        {
            using (IrbisConnection connection = GetIrbisConnection())
            {
                WriteLine("Pinging IRBIS-server");
                connection.NoOp();
            }

            return(true);
        }
예제 #3
0
        private void _startupTimer_Tick
        (
            object sender,
            EventArgs e
        )
        {
            Timer timer = (Timer)sender;

            timer.Enabled = false;

            _litresTag = ConfigurationUtility.GetInt32("litresTag", 101);

            using (IrbisConnection connection = GetConnection())
            {
                connection.NoOp();
            }
        }
예제 #4
0
        private void _idleTimer_Tick
        (
            object sender,
            EventArgs e
        )
        {
            try
            {
                //    if (_emulation == null)
                //    {
                //        string emulationFile = CM.AppSettings["emulation"];
                //        if (!string.IsNullOrEmpty(emulationFile))
                //        {
                //            _emulation = File.ReadAllLines(emulationFile)
                //                .ToList();
                //            _logBox.Output.WriteLine
                //                (
                //                    "Включена эмуляция RFID из файла {0}",
                //                    emulationFile
                //                );
                //        }
                //        else
                //        {
                //            if (_rfid == null)
                //            {
                //                string readerName = CM.AppSettings["rfid-reader"];

                //                _rfid = new RfidReader(readerName);
                //                _logBox.Output.WriteLine
                //                    (
                //                        "Открыт RFID-считыватель: {0}",
                //                        readerName
                //                    );
                //            }
                //        }
                //    }

                if (_client == null)
                {
                    _InitClient();
                }
                else
                {
                    try
                    {
                        _client.NoOp();

                        _ReadRfid();
                    }
                    catch (Exception ex)
                    {
                        _logBox.Output.WriteErrorLine
                        (
                            "Ошибка: {0}",
                            ex.Message
                        );
                    }
                }
            }
            catch (Exception ex)
            {
                _logBox.Output.WriteErrorLine
                (
                    "Функционирование остановлено из-за ошибки: {0}",
                    ex.ToString()
                );
                _SetHtml
                (
                    "Функционирование остановлено из-за ошибки: {0}",
                    ex.ToString()
                );
                _idleTimer.Enabled = false;
            }
        }