private void lbConnections_MouseDoubleClick(object sender, MouseButtonEventArgs e) { ConnectionConfigurationBase connectionConfiguration = ((ListBox)sender).SelectedItem as ConnectionConfigurationBase; if (connectionConfiguration != null) { string orginalConnectionConfiguration = ConfigurationSerializer.SerializeObject(connectionConfiguration, this.moduleLoader.GetModuleTypeList()); NewConnection newConnection = new NewConnection(this.moduleLoader.Modules, connectionConfiguration, orginalConnectionConfiguration); ShowNewConnectionWindow(newConnection); } }
private void ddSelectConnection_SelectionChanged(object sender, SelectionChangedEventArgs e) { ConnectionConfigurationBase selectedConnection = (ConnectionConfigurationBase)ddSelectConnection.SelectedItem; ((StepConfigurationBase)this.DataContext).SelectedConnectionConfigurationId = selectedConnection.ConfigurationId; if (this.ConfigurationContent.Content as IConnectionChanged != null) { IModule connection = Activator.CreateInstance(selectedConnection.ModuleDescription.ModuleType) as IModule; connection.SetConfiguration(selectedConnection); ((IConnectionChanged)this.ConfigurationContent.Content).ConnectionChanged(connection as IConnection); } }
public NewConnection(List <ModuleDescription> modules, ConnectionConfigurationBase configuration, string originalConnectionConfiguration) { newConfiguration = false; Initialize(modules); btnCreate.Content = "Update"; this.ddConnectionTypes.SelectedItem = this.ddConnectionTypes.Items.Cast <ModuleDescription>() .Where(t => t.ModuleType == configuration.ModuleDescription.ModuleType).FirstOrDefault(); this.ddConnectionTypes.IsEnabled = false; this.ConnectionConfiguration = configuration; this.OriginalConnectionConfiguration = originalConnectionConfiguration; SetModule(); ddConnectionTypes.IsEnabled = false; }
private void lbConnections_KeyUp(object sender, KeyEventArgs e) { switch (e.Key) { case Key.Delete: if (lbConnections.SelectedItem != null) { ConnectionConfigurationBase connectionConfiguration = ((ListBox)sender).SelectedItem as ConnectionConfigurationBase; if (MessageBox.Show("Do you really want to delete the connection \"" + connectionConfiguration.Name + "\"?", "Warning", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { this.Project.Connections.Remove(connectionConfiguration); } } break; } }