Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
AffiliationsForm.xaml.cs
1using System.Windows;
2using System.Windows.Controls;
5
7{
11 public partial class AffiliationsForm : Window
12 {
13 private readonly string node;
14
15 public AffiliationsForm(string Node)
16 {
17 this.node = Node;
18
20 }
21
22 private void AffilationView_SelectionChanged(object Sender, SelectionChangedEventArgs e)
23 {
24 this.RemoveButton.IsEnabled = this.AffiliationView.SelectedIndex >= 0;
25 }
26
27 public void AddButton_Click(object Sender, RoutedEventArgs e)
28 {
30 {
31 Owner = this
32 };
33 bool? b = Form.ShowDialog();
34
35 if (b.HasValue && b.Value)
36 {
37 Affiliation NewAffiliation = new Affiliation(this.node, Form.Jid.Text, AffiliationItem.FromIndex(Form.Affiliation.SelectedIndex));
38 ListViewItem NewItem = new ListViewItem()
39 {
40 Content = new AffiliationItem(NewAffiliation)
41 };
42
43 this.AffiliationView.Items.Add(NewItem);
44 }
45 }
46
47 public void RemoveButton_Click(object Sender, RoutedEventArgs e)
48 {
49 this.AffiliationView.Items.RemoveAt(this.AffiliationView.SelectedIndex);
50 }
51
52 public void ApplyButton_Click(object Sender, RoutedEventArgs e)
53 {
54 this.DialogResult = true;
55 }
56
57 public void CancelButton_Click(object Sender, RoutedEventArgs e)
58 {
59 this.DialogResult = false;
60 }
61
62 }
63}
Interaction logic for AddAffiliateForm.xaml
Interaction logic for Affiliations.xaml
Contains information about a user affiliation.
Definition: Affiliation.cs:7