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); } }
private void MainForm_FormClosed ( object sender, FormClosedEventArgs e ) { _client.Dispose(); }
private void MainForm_FormClosed ( object sender, FormClosedEventArgs e ) { _pinger.Active = false; _pinger.Dispose(); _connection.Dispose(); }
private void MainForm_FormClosed ( object sender, FormClosedEventArgs e ) { if (_client != null) { _client.Dispose(); _client = null; } //if (_rfid != null) //{ // _rfid.Close(); // _rfid = null; //} }
public Form5() { InitializeComponent(); string connectionString = CM.AppSettings["connectionString"]; Connection = new IrbisConnection(); Connection.ParseConnectionString(connectionString); Connection.Connect(); Grid = new SiberianFoundGrid { Dock = DockStyle.Fill }; Controls.Add(Grid); List <FoundLine> lines = new List <FoundLine>(); for (int i = 1; i < 100; i++) { try { string description = Connection.FormatRecord("@brief", i); FoundLine line = new FoundLine { Mfn = i, Materialized = true, Description = description }; lines.Add(line); } catch { // Nothing to do } } Connection.Dispose(); Grid.Load(lines.ToArray()); //FormClosed += _FormClosed; }