private void projectListView_PreviewKeyDown(object sender, KeyEventArgs e) { if (projectListView.SelectedItem != null) { if (Keyboard.IsKeyDown(Key.Enter)) { var project = projectListView.SelectedItem as Project; var window = new ProjectManagerWindow(project.ID); window.Show(); } else if (Keyboard.IsKeyDown(Key.Delete)) { int currentIndex = projectListView.SelectedIndex; if (projectListView.Items.Count > 0) { var project = projectListView.SelectedItem as Project; GlobalConfig.Connection.DeleteProject(project); Projects.Remove(project); //LoadProjectsFromDB(); WireUpLists(); SetListviewSelectedItemVia(currentIndex); } } } }
public ProjectNavigationWindow() { InitializeComponent(); // Initialize the database connection. GlobalConfig.InitializeConnections(DatabaseType.Sql); LoadProjectsFromDB(); WireUpLists(); var window = new ProjectManagerWindow(24); window.ShowDialog(); //Close(); }