some more UI logic
This commit is contained in:
parent
a86b02d541
commit
66b2691c41
@ -82,7 +82,18 @@ namespace RoleEditor
|
|||||||
|
|
||||||
private void buttonParticipantSave_Click(object sender, RoutedEventArgs e)
|
private void buttonParticipantSave_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
Participant? p = this.listBoxParticipant.SelectedItem as Participant;
|
||||||
|
if (p != null)
|
||||||
|
{
|
||||||
|
p.Name = this.textBoxParticipantName.Text.Trim();
|
||||||
|
p.Street = this.textBoxParticipantStreet.Text.Trim();
|
||||||
|
p.PostalCode = this.textBoxParticipantPostalCode.Text.Trim();
|
||||||
|
p.City = this.textBoxParticipantCity.Text.Trim();
|
||||||
|
p.Save(_dbManager);
|
||||||
|
this.listBoxParticipant.ItemsSource = null;
|
||||||
|
this.listBoxParticipant.ItemsSource = _users;
|
||||||
|
this.listBoxParticipant.SelectedItem = p;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonUserSave_Click(object sender, RoutedEventArgs e)
|
private void buttonUserSave_Click(object sender, RoutedEventArgs e)
|
||||||
@ -107,6 +118,7 @@ namespace RoleEditor
|
|||||||
u.Save(_dbManager);
|
u.Save(_dbManager);
|
||||||
this.listBoxUser.ItemsSource = null;
|
this.listBoxUser.ItemsSource = null;
|
||||||
this.listBoxUser.ItemsSource = _users;
|
this.listBoxUser.ItemsSource = _users;
|
||||||
|
this.listBoxUser.SelectedItem = u;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,12 +144,29 @@ namespace RoleEditor
|
|||||||
|
|
||||||
private void buttonSaveSecurable_Click(object sender, RoutedEventArgs e)
|
private void buttonSaveSecurable_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
Securable? s = this.listBoxSecurables.SelectedItem as Securable;
|
||||||
|
if(s != null)
|
||||||
|
{
|
||||||
|
s.Name = this.textBoxSecurableName.Text.Trim();
|
||||||
|
s.Save(_dbManager);
|
||||||
|
this.listBoxSecurables.ItemsSource = null;
|
||||||
|
this.listBoxSecurables.ItemsSource = _securables;
|
||||||
|
this.listBoxSecurables.SelectedItem = s;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonSaveRole_Click(object sender, RoutedEventArgs e)
|
private void buttonSaveRole_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
Role? r = this.listBoxRoles.SelectedItem as Role;
|
||||||
|
if(r != null)
|
||||||
|
{
|
||||||
|
r.Name = this.textBoxRoleName.Text.Trim();
|
||||||
|
r.Description = this.textBoxRoleDescription.Text.Trim();
|
||||||
|
r.Save(_dbManager);
|
||||||
|
this.listBoxRoles.ItemsSource = null;
|
||||||
|
this.listBoxRoles.ItemsSource = _roles;
|
||||||
|
this.listBoxRoles.SelectedItem = r;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -164,7 +193,9 @@ namespace RoleEditor
|
|||||||
|
|
||||||
private void listBoxRoles_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void listBoxRoles_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
|
Role? r = this.listBoxRoles.SelectedItem as Role;
|
||||||
|
this.textBoxRoleName.Text = (r != null) ? r.Name : string.Empty;
|
||||||
|
this.textBoxRoleDescription.Text = (r != null) ? r.Description : string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void listBoxUser_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void listBoxUser_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
@ -181,7 +212,8 @@ namespace RoleEditor
|
|||||||
|
|
||||||
private void listBoxSecurables_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void listBoxSecurables_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
|
Securable? s = this.listBoxSecurables.SelectedItem as Securable;
|
||||||
|
this.textBoxSecurableName.Text = (s != null) ? s.Name : string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -195,7 +227,9 @@ namespace RoleEditor
|
|||||||
|
|
||||||
private void menuItemNewParticipant_Click(object sender, RoutedEventArgs e)
|
private void menuItemNewParticipant_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
Participant p = new();
|
||||||
|
this._participants.Add(p);
|
||||||
|
this.listBoxParticipant.SelectedItem = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void menuItemNewUser_Click(object sender, RoutedEventArgs e)
|
private void menuItemNewUser_Click(object sender, RoutedEventArgs e)
|
||||||
@ -217,7 +251,9 @@ namespace RoleEditor
|
|||||||
|
|
||||||
private void menuItemNewRole_Click(object sender, RoutedEventArgs e)
|
private void menuItemNewRole_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
Role r = new();
|
||||||
|
this._roles.Add(r);
|
||||||
|
this.listBoxRoles.SelectedItem = r;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void menuItemDeleteRole_Click(object sender, RoutedEventArgs e)
|
private void menuItemDeleteRole_Click(object sender, RoutedEventArgs e)
|
||||||
@ -227,7 +263,9 @@ namespace RoleEditor
|
|||||||
|
|
||||||
private void menuItemNewSecurable_Click(object sender, RoutedEventArgs e)
|
private void menuItemNewSecurable_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
Securable s = new Securable();
|
||||||
|
_securables.Add(s);
|
||||||
|
this.listBoxSecurables.SelectedItem = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void menuItemDeleteSecurable_Click(object sender, RoutedEventArgs e)
|
private void menuItemDeleteSecurable_Click(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
Reference in New Issue
Block a user