private void ModifyConnection_Click(object sender, RoutedEventArgs e) { if (_selectedConn == null) return; if (string.IsNullOrEmpty(_selectedConn.ConnectionString)) return; string name = _selectedConn.Name; Connection connection = new Connection(name, _selectedConn.ConnectionString); bool? result = connection.ShowDialog(); if (!result.HasValue || !result.Value) return; var configExists = ConfigFileExists(_selectedProject); if (!configExists) CreateConfigFile(_selectedProject); Expander.IsExpanded = false; AddOrUpdateConnection(_selectedProject, connection.ConnectionName, connection.ConnectionString, connection.OrgId, connection.Version, false); GetConnections(); foreach (CrmConn conn in Connections.Items) { if (conn.Name != connection.ConnectionName) continue; Connections.SelectedItem = conn; GetPlugins(conn.ConnectionString); break; } }
private void ModifyConnection_Click(object sender, RoutedEventArgs e) { if (SelectedConnection == null) return; if (string.IsNullOrEmpty(SelectedConnection.ConnectionString)) return; string name = SelectedConnection.Name; Connection connection = new Connection(name, SelectedConnection.ConnectionString); bool? result = connection.ShowDialog(); if (!result.HasValue || !result.Value) return; var configExists = SharedConfigFile.ConfigFileExists(SelectedProject); if (!configExists) CreateConfigFile(SelectedProject); Expander.IsExpanded = false; AddOrUpdateConnection(SelectedProject, connection.ConnectionName, connection.ConnectionString, connection.OrgId, connection.Version, false); //Keep to refresh the connections in the list GetConnections(); foreach (CrmConn conn in Connections.Items) { if (conn.Name != connection.ConnectionName) continue; Connections.SelectedItem = conn; OnConnectionModified(new ConnectionModifiedEventArgs { ModifiedConnection = conn }); break; } }
private void AddConnection_Click(object sender, RoutedEventArgs e) { Connection connection = new Connection(null, null); bool? result = connection.ShowDialog(); if (!result.HasValue || !result.Value) return; var configExists = ConfigFileExists(_selectedProject); if (!configExists) CreateConfigFile(_selectedProject); Expander.IsExpanded = false; Customizations.IsEnabled = true; Solutions.IsEnabled = true; bool change = AddOrUpdateConnection(_selectedProject, connection.ConnectionName, connection.ConnectionString, connection.OrgId, connection.Version, true); if (!change) return; GetConnections(); foreach (CrmConn conn in Connections.Items) { if (conn.Name != connection.ConnectionName) continue; Connections.SelectedItem = conn; GetPlugins(conn.ConnectionString); break; } }
private void AddConnection_Click(object sender, RoutedEventArgs e) { Connection connection = new Connection(null, null); bool? result = connection.ShowDialog(); if (!result.HasValue || !result.Value) return; var configExists = SharedConfigFile.ConfigFileExists(SelectedProject); if (!configExists) CreateConfigFile(SelectedProject); Expander.IsExpanded = false; AddOrUpdateConnection(SelectedProject, connection.ConnectionName, connection.ConnectionString, connection.OrgId, connection.Version, true); GetConnections(); foreach (CrmConn conn in Connections.Items) { if (conn.Name != connection.ConnectionName) continue; Connections.SelectedItem = conn; // TODO: Should this actually fire OnConnectionSelected? OnConnectionAdded(new ConnectionAddedEventArgs { AddedConnection = conn }); break; } }