/// <summary> /// Check validity of the connection asynchronously. /// </summary> private void CheckConnection() { SlxConnectionInfo con = SelectedConnection; lock (_validationErrors) { if (con == null) { _validationErrors["SelectedConnection"] = "Please select connection"; } else { ThreadPool.QueueUserWorkItem(delegate { lock (_validationErrors) { DbHelper db = new DbHelper(SelectedConnection.BuildConnectionString(Password)); try { db.GetField("1", "SYSTEMINFO", ""); if (_validationErrors.ContainsKey("SelectedConnection")) { _validationErrors.Remove("SelectedConnection"); } } catch (Exception x) { _validationErrors["SelectedConnection"] = "Failed to connect: " + x.Message; } OnPropertyChanged("SelectedConnection"); } }); } } }
public void Initialize() { Connections = SlxConnectionInfo.ListAllConnections(); if (Connections.Count > 0) { SelectedConnection = Connections[0]; } ModelPath = ""; }
public void Initialize() { Connections = SlxConnectionInfo.ListAllConnections(); if (Connections.Count > 0) { SelectedConnection = Connections[0]; } ModelPath = @"E:\Projects\SSS\SlxBaseline\Model"; }