Exemplo n.º 1
0
        /// <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");
                        }
                    });
                }
            }
        }
Exemplo n.º 2
0
 public void Initialize()
 {
     Connections = SlxConnectionInfo.ListAllConnections();
     if (Connections.Count > 0)
     {
         SelectedConnection = Connections[0];
     }
     ModelPath = "";
 }
Exemplo n.º 3
0
 public void Initialize()
 {
     Connections = SlxConnectionInfo.ListAllConnections();
     if (Connections.Count > 0)
     {
         SelectedConnection = Connections[0];
     }
     ModelPath = @"E:\Projects\SSS\SlxBaseline\Model";
 }