forked from PeterWaher/IoTGateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResynchEventArgs.cs
More file actions
75 lines (68 loc) · 1.76 KB
/
ResynchEventArgs.cs
File metadata and controls
75 lines (68 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Waher.Events;
namespace Waher.Networking.XMPP.P2P
{
/// <summary>
/// Resynchronization event handler delegate.
/// </summary>
/// <param name="Sender">Sender of event.</param>
/// <param name="e">Event arguments.</param>
public delegate void ResynchEventHandler(object Sender, ResynchEventArgs e);
/// <summary>
/// Peer connection event arguments.
/// </summary>
public class ResynchEventArgs : EventArgs
{
private readonly ResynchEventHandler callback;
private readonly string remoteFullJid;
private bool ok = false;
/// <summary>
/// Peer connection event arguments.
/// </summary>
/// <param name="RemoteFullJid">Remote Full JID.</param>
/// <param name="Callback">Callback method.</param>
public ResynchEventArgs(string RemoteFullJid, ResynchEventHandler Callback)
{
this.remoteFullJid = RemoteFullJid;
this.callback = Callback;
}
/// <summary>
/// JID of the remote end-point.
/// </summary>
public string RemoteFullJid
{
get { return this.remoteFullJid; }
}
/// <summary>
/// If the synchronization method succeeded (true) or failed (false).
/// </summary>
public bool Ok
{
get { return this.ok; }
}
/// <summary>
/// Method called by callback, to report that the synchronization succeeded (<paramref name="Ok"/>=true), or
/// failed (<paramref name="Ok"/>=false).
/// </summary>
/// <param name="Ok">If the synchronization method succeeded (true) or failed (false).</param>
public void Done(bool Ok)
{
this.ok = Ok;
if (!(this.callback is null))
{
try
{
this.callback(this, this);
}
catch (Exception ex)
{
Log.Critical(ex);
}
}
}
}
}