Files
BeWoPlaner/BeWoLauncher/Components/ProfileEditView.xaml.cs

64 lines
2.0 KiB
C#

using BS.SharedLauncher;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
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;
listView.ItemsSource = _Profiles;
}
}
public ProfileEditView()
{
InitializeComponent();
Profiles = new ObservableCollection<ConnectionProfile>();
}
private void ProfileAddClick(object sender, RoutedEventArgs e)
{
//var bp = new BeWoProfile(profileNameTextBox.Text, profileServerTextBox.Text, profileTenantBox.Text);
var bp = new ConnectionProfile("<Neues Profil>", "", "");
if (Profiles.Contains(bp))
return;
Profiles.Add(bp);
//profileNameTextBox.Text = string.Empty;
//profileTenantBox.Text = string.Empty;
//profileServerTextBox.Text = string.Empty;
}
private void btn_deleteProfileClick(object sender, RoutedEventArgs e)
{
//var selectedItem = (BeWoLaProfile)((((Button)sender).Tag as EditGridCellData).RowData.Row);
//if (!Profiles.Contains(selectedItem))
// return;
//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;
//}
//Profiles.Remove(selectedItem);
}
}
}