Beispiel #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");
                        }
                    });
                }
            }
        }
Beispiel #2
0
        public bool RemoveConnection(String _sConnectionName)
        {
            if (_sConnectionName == null)
            {
                return(false);
            }

            if (_sConnectionName.Trim().Length == 0)
            {
                return(false);
            }

            if (!ConnectionNameExist(_sConnectionName))
            {
                return(false);
            }

            if (IsConnectionOpen(_sConnectionName))
            {
                CloseConnection(_sConnectionName);
            }

            if (SelectedConnection.Equals(_sConnectionName))
            {
                ResetConnectionInfo();
            }

            GetConnectionList().Remove(_sConnectionName);
            return(true);
        }
Beispiel #3
0
 void GetTransportConfiguration(string TransportName)
 {
     SelectedConnection.SelectTransport(TransportName);
     if (SelectedConnection.Transport != null)
     {
         TransportProperties.ConfigData = SelectedConnection.Transport.ConfigData;
     }
     else
     {
         TransportProperties.ConfigData = null;
     }
 }
Beispiel #4
0
 private void GetEmulatorConfiguration(string EmulatorName)
 {
     SelectedConnection.SelectTerminal(EmulatorName);
     if (SelectedConnection.Terminal != null)
     {
         EmulatorProperties.ConfigData = SelectedConnection.Terminal.ConfigData;
     }
     else
     {
         EmulatorProperties.ConfigData = null;
     }
 }
Beispiel #5
0
 private void GetModemConfiguration(string ModemName)
 {
     SelectedConnection.SelectModem(ModemName);
     if (SelectedConnection.Modem != null)
     {
         ModemProperties.ConfigData = SelectedConnection.Modem.ConfigData;
     }
     else
     {
         ModemProperties.ConfigData = null;
     }
 }
    public TransoftEntryController(Action <Func <DbConnection> > connectionChanged, DatabaseConnectionStorage databaseConnectionStorage)
    {
        _connectionChanged         = connectionChanged;
        _databaseConnectionStorage = databaseConnectionStorage;

        SaveCommand           = new DelegateCommand(Save);
        DeleteCommand         = new DelegateCommand(Delete);
        MakeActiveCommand     = new DelegateCommand(MakeConnectionActive);
        TestConnectionCommand = new DelegateCommand(TestConnection);

        SelectedConnection.Subscribe(SelectedConnectionChanged);
        if (databaseConnectionStorage.OdbcDsnDtos.Any())
        {
            SelectedConnection.Value = databaseConnectionStorage.OdbcDsnDtos.First();
        }
    }
Beispiel #7
0
        private void Login()
        {
            ApplicationContext.Initialize(Guid.NewGuid().ToString());
            ApplicationContext.Current.Services.Add <IDataService>(new ConnectionStringDataService(SelectedConnection.BuildConnectionString(Password)));
            IProject project = ProjectUtility.InitProject(ModelPath);

            ApplicationContext.Current.Services.Add <IProjectContextService>(new SimpleProjectContextService(project));
            if (LoginSuccessful != null)
            {
                LoginSuccessful(this, EventArgs.Empty);
            }
        }
Beispiel #8
0
 public void CancelSelected()
 {
     _shell.AssertIsOnMainThread();
     SelectedConnection?.Reset();
 }
Beispiel #9
0
        static void Main(string[] args)
        {
            ApplicationContext.Initialize(Guid.NewGuid().ToString());
            ApplicationContext.Current.Services.Add <IDataService>(new ConnectionStringDataService(SelectedConnection.BuildConnectionString(Password)));
            IProject project = ProjectUtility.InitProject(ModelPath);

            ApplicationContext.Current.Services.Add <IProjectContextService>(new SimpleProjectContextService(project));
        }