Esempio n. 1
0
        public void SaveSelected()
        {
            _shell.AssertIsOnMainThread();
            if (string.IsNullOrEmpty(SelectedConnection.Name))
            {
                _shell.ShowMessage(Resources.ConnectionManager_ShouldHaveName, MessageButtons.OK);
                return;
            }

            if (string.IsNullOrEmpty(SelectedConnection.Path))
            {
                _shell.ShowMessage(Resources.ConnectionManager_ShouldHavePath, MessageButtons.OK);
                return;
            }

            var connection = _connectionManager.AddOrUpdateConnection(
                SelectedConnection.Name,
                SelectedConnection.Path,
                SelectedConnection.RCommandLineArguments);

            if (connection.Id != SelectedConnection.Id && SelectedConnection.Id != null)
            {
                _connectionManager.TryRemove(SelectedConnection.Id);
            }

            UpdateConnections();
        }
        public void Save(IConnectionViewModel connectionViewModel)
        {
            _shell.AssertIsOnMainThread();

            var connection = _connectionManager.AddOrUpdateConnection(
                connectionViewModel.Name,
                connectionViewModel.Path,
                connectionViewModel.RCommandLineArguments);

            if (connection.Id != connectionViewModel.Id && connectionViewModel.Id != null)
            {
                _connectionManager.TryRemove(connectionViewModel.Id);
            }

            EditedConnection = null;
            IsEditingNew     = false;
            UpdateConnections();
        }