2using System.Threading.Tasks;
4using System.Windows.Controls;
16 private bool response;
24 public bool Response => this.response;
26 public override string QuestionString =>
"Allowed to connect?";
37 Details.Children.Add(
new TextBlock()
40 FontWeight = FontWeights.Bold,
41 Text =
"Allowed to connect?"
44 Details.Children.Add(TextBlock =
new TextBlock()
46 TextWrapping = TextWrapping.Wrap,
47 Margin =
new Thickness(0, 6, 0, 6)
50 TextBlock.Inlines.Add(
"Device: ");
53 Details.Children.Add(TextBlock =
new TextBlock()
55 TextWrapping = TextWrapping.Wrap,
56 Margin =
new Thickness(0, 6, 0, 6)
59 TextBlock.Inlines.Add(
"Caller: ");
62 Details.Children.Add(TextBlock =
new TextBlock()
64 TextWrapping = TextWrapping.Wrap,
65 Margin =
new Thickness(0, 6, 0, 6),
66 Text =
"Is the caller allowed to connect to your device?"
69 Details.Children.Add(Button =
new Button()
71 Margin =
new Thickness(0, 6, 0, 6),
75 Button.Click += this.YesButton_Click;
77 Details.Children.Add(Button =
new Button()
79 Margin =
new Thickness(0, 6, 0, 6),
83 Button.Click += this.NoButton_Click;
85 string s = this.RemoteJID;
86 int i = s.IndexOf(
'@');
89 s = s.Substring(i + 1);
91 Details.Children.Add(Button =
new Button()
93 Margin =
new Thickness(0, 6, 0, 6),
94 Content =
"Yes, to anyone from " + s
97 Button.Click += this.YesDomainButton_Click;
99 Details.Children.Add(Button =
new Button()
101 Margin =
new Thickness(0, 6, 0, 6),
102 Content =
"No, to no one from " + s
105 Button.Click += this.NoDomainButton_Click;
108 Details.Children.Add(Button =
new Button()
110 Margin =
new Thickness(0, 6, 0, 6),
111 Content =
"Yes, to anyone"
114 Button.Click += this.YesAllButton_Click;
116 Details.Children.Add(Button =
new Button()
118 Margin =
new Thickness(0, 6, 0, 6),
119 Content =
"No, to no one"
122 Button.Click += this.NoAllButton_Click;
125 internal static string GetDomain(
string s)
127 int i = s.IndexOf(
'@');
131 return s.Substring(i + 1);
134 private void Process(
bool Response,
RuleRange Range)
136 this.response = Response;
138 this.client.
IsFriendResponse(this.Sender, this.JID, this.RemoteJID, this.Key, Response, Range, this.RuleCallback,
null);
146 await this.Processed(this.questionView);
157 private void NoAllButton_Click(
object Sender, RoutedEventArgs e)
162 private void YesAllButton_Click(
object Sender, RoutedEventArgs e)
167 private void NoDomainButton_Click(
object Sender, RoutedEventArgs e)
172 private void YesDomainButton_Click(
object Sender, RoutedEventArgs e)
177 private void NoButton_Click(
object Sender, RoutedEventArgs e)
182 private void YesButton_Click(
object Sender, RoutedEventArgs e)
200 return (GetDomain(this.RemoteJID) == GetDomain(
IsFriendQuestion.RemoteJID));
Interaction logic for QuestionView.xaml
Interaction logic for xaml
Static class managing the application event log. Applications and services log events on this static ...
static Exception UnnestException(Exception Exception)
Unnests an exception, to extract the relevant inner exception.
Event arguments for responses to IQ queries.
bool Ok
If the response is an OK result response (true), or an error response (false).
string ErrorText
Any error specific text.
Implements an XMPP provisioning client interface.
Task IsFriendResponse(string JID, string RemoteJID, string Key, bool IsFriend, RuleRange Range, EventHandlerAsync< IqResultEventArgs > Callback, object State)
Sends a response to a previous "Is Friend" question.
RuleRange
Range of a rule change