Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
MessageForm.xaml.cs
1using System;
2using System.Windows;
3using System.Windows.Input;
4using System.Windows.Media;
5using System.Xml;
6
8{
12 public partial class MessageForm : Window
13 {
14 private bool xmlOk = true;
15 private bool toOk = false;
16
17 public MessageForm()
18 {
20 }
21
22 private void CustomXml_TextInput(object Sender, TextCompositionEventArgs e)
23 {
24 try
25 {
26 string s = e.Text.Trim();
27
28 if (!string.IsNullOrEmpty(s))
29 {
30 XmlDocument Doc = new XmlDocument();
31 Doc.LoadXml(s);
32
33 this.CustomXml.Background = null;
34 this.xmlOk = true;
35 }
36 }
37 catch (Exception)
38 {
39 this.CustomXml.Background = new SolidColorBrush(Colors.PeachPuff);
40 this.xmlOk = false;
41 }
42 finally
43 {
44 this.SendButton.IsEnabled = this.xmlOk && this.toOk;
45 }
46 }
47
48 private void To_TextChanged(object Sender, System.Windows.Controls.TextChangedEventArgs e)
49 {
50 string s = this.To.Text.Trim();
51
52 this.toOk = !string.IsNullOrEmpty(s);
53 this.To.Background = this.toOk ? null : new SolidColorBrush(Colors.PeachPuff);
54
55 this.SendButton.IsEnabled = this.xmlOk && this.toOk;
56 }
57
58 private void SendButton_Click(object Sender, RoutedEventArgs e)
59 {
60 if (this.xmlOk && this.toOk)
61 this.DialogResult = true;
62 }
63
64 private void CancelButton_Click(object Sender, RoutedEventArgs e)
65 {
66 this.DialogResult = false;
67 }
68 }
69}
Interaction logic for MessageForm.xaml
void InitializeComponent()
InitializeComponent