68 lines
2.0 KiB
C#
68 lines
2.0 KiB
C#
using BeWoLauncher.Logic;
|
|
using BS.SharedLauncher;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Media;
|
|
|
|
namespace BeWoLauncher.Components
|
|
{
|
|
/// <summary>
|
|
/// Interaktionslogik für ProfileEditView.xaml
|
|
/// </summary>
|
|
public partial class ProfileEditView : UserControl
|
|
{
|
|
private ObservableCollection<ConnectionProfile> _Profiles;
|
|
|
|
public ObservableCollection<ConnectionProfile> Profiles
|
|
{
|
|
get { return _Profiles; }
|
|
set
|
|
{
|
|
_Profiles = value;
|
|
profileControl.ItemsSource = value;
|
|
}
|
|
}
|
|
|
|
public ProfileEditView()
|
|
{
|
|
InitializeComponent();
|
|
Profiles = new ObservableCollection<ConnectionProfile>();
|
|
}
|
|
|
|
private void ProfileAddClick(object sender, RoutedEventArgs e)
|
|
{
|
|
var bp = new ConnectionProfile("<Neuer Eintrag>", string.Empty, string.Empty);
|
|
|
|
if (Profiles.Contains(bp))
|
|
return;
|
|
|
|
Profiles.Add(bp);
|
|
}
|
|
|
|
private void ProfileDeleteClick(object sender, RoutedEventArgs e)
|
|
{
|
|
if (Profiles.Count == 1)
|
|
{
|
|
MessageBox.Show("Es muss mindestens ein Profil vorhanden sein.\nLöschen nicht möglich",
|
|
"Löschen nicht möglich", MessageBoxButton.OK, MessageBoxImage.Warning);
|
|
return;
|
|
}
|
|
if(profileControl.SelectedItem is null)
|
|
{
|
|
MessageBox.Show("Wählen Sie ein Profil aus",
|
|
"Löschen nicht möglich", MessageBoxButton.OK);
|
|
return;
|
|
}
|
|
|
|
Profiles.Remove(profileControl.SelectedItem as ConnectionProfile);
|
|
}
|
|
|
|
private void ProfileControl_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|