public bool OpenConnection() { if (!string.IsNullOrEmpty(iniFile)) { if (connection == null) { connection = new DSSERVERLib.Connection(); connection.Disconnected += Connection_Disconnected; connection.NetIntegrityOk += Connection_NetIntegrityOk; connection.NetIntegrityLost += Connection_NetIntegrityLost; connection.LoginOk += Connection_LoginOk; connection.LoginFailed += Connection_LoginFailed; } try { if (!isConnected) { isConnected = connection.Open(iniFile, "", "", ""); } } catch (Exception ex) { isConnected = false; message = ex.Message; } } return(isConnected); }
public static void RestartConnection(int seconds) { if (quotesTableConId != 0 && tableQuotes != null) { tableQuotes.Close(quotesTableConId); } if (etsConnection != null) { etsConnection.Close(); } tableQuotes = null; etsConnection = null; // First variant of timing //Thread.Sleep(seconds * 1000); // Second variant DateTime curTime = DateTime.Now; DateTime newTime = curTime.AddSeconds(seconds); while (newTime <= DateTime.Now) { } }
private static void OpenConnection() { etsConnection = new DSSERVERLib.Connection(); etsConnection.Disconnected += EtsConnection_Disconnected; try { etsConnection.Open("Online_test.ini", "", "", ""); } catch (Exception) { etsConnection = null; } }
private static void OpenConnection(bool isTest = false) { etsConnection = new DSSERVERLib.Connection(); try { etsConnection.Open(@"Online_" + (isTest ? "test" : "war") + ".ini", "", "", ""); } catch (Exception ex) { MessageBox.Show("Ошибка подключения к ЕТС: " + ex.ToString()); etsConnection = null; } }
public void GetConnectedServer() { AppJournal.Write("DbETSManager", "Connect to ETS"); connectionETS = new DSSERVERLib.Connection(); try { if (curBroker.Contains("TRN")) { connectionETS.Open(@"Online.ini", "", "", ""); } else { connectionETS.Open(@"Online (war).ini", "", "", ""); } } catch (Exception e) { AppJournal.Write("DbETSManager", "Connection err: " + e.ToString()); MessageBox.Show(e.Message); } }