void EditClick(object sender, RoutedEventArgs e) { if (DBConnectInfo == null) { return; } var result = EditDatabaseConnectDialog.Run(Owner, DBConnectInfo); if (result != null) { DBConnectInfos[DBConnectInfos.IndexOf(DBConnectInfo)] = result; } }
void MoveDownClick(object sender, RoutedEventArgs e) { if (DBConnectInfo == null) { return; } var oldIndex = DBConnectInfos.IndexOf(DBConnectInfo); var newIndex = Math.Min(DBConnectInfos.Count - 1, oldIndex + 1); if (oldIndex != newIndex) { DBConnectInfos.Move(oldIndex, newIndex); } }
void MoveUpClick(object sender, RoutedEventArgs e) { if (DBConnectInfo == null) { return; } var oldIndex = DBConnectInfos.IndexOf(DBConnectInfo); var newIndex = Math.Max(0, oldIndex - 1); if (oldIndex != newIndex) { DBConnectInfos.Move(oldIndex, newIndex); } }