public DataAccessLevel ( AbstractOutput output ) { if (ReferenceEquals(output, null)) { throw new ArgumentNullException("output"); } Output = output; string sqlConnectionString = CM.AppSettings["sql-connection-string"]; Db = new DbManager ( new Sql2008DataProvider(), sqlConnectionString ); Output.WriteLine ( "Подключились к SQL-серверу" ); string irbisConnectionString = CM.AppSettings["irbis-connection-string"]; Client = new IrbisConnection(); Client.ParseConnectionString(irbisConnectionString); Client.Connect(); Output.WriteLine("Подключились к ИРБИС-серверу"); _timer = new Timer { Enabled = true, Interval = 60 * 1000 }; _timer.Tick += _timer_Tick; }
/// <summary> /// Dump the array of data to <see cref="AbstractOutput"/>. /// </summary> public static void DumpToOutput <T> ( [NotNull] AbstractOutput output, [NotNull] T[] data ) where T : struct { Code.NotNull(output, "output"); Code.NotNull(data, "data"); string text = DumpToText(data); output.WriteLine(text); }
private async void _pressMeButton_Click ( object sender, EventArgs e ) { try { using (IrbisConnection connection = new IrbisConnection()) { _pressMeButton.Enabled = false; _press2Button.Enabled = false; try { //AsyncClientSocket socket // = new AsyncClientSocket(connection); //connection.SetSocket(socket); //AsyncSocketAdapter adapter // = new AsyncSocketAdapter // ( // connection, // connection.Socket // ); //connection.SetSocket(adapter); connection.ParseConnectionString ( _connectionString ); await connection.ConnectAsync(); _output.WriteLine("Connected"); int maxMfn = await connection.GetMaxMfnAsync(); _output.WriteLine ( "Max MFN={0}", maxMfn ); await connection.DisconnectAsync(); } finally { _pressMeButton.Enabled = true; _press2Button.Enabled = true; } } _output.WriteLine("Diconnected"); _output.WriteLine(string.Empty); } catch (Exception exception) { _output.WriteLine ( exception.ToString() ); Clipboard.SetText(exception.ToString()); } }