-
Notifications
You must be signed in to change notification settings - Fork 0
/
FormCommunicator.cs
38 lines (34 loc) · 997 Bytes
/
FormCommunicator.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
namespace ISNemocniceKlient
{
public static class FormCommunicator
{
private static Dictionary<Control, Control> FormPairList = new Dictionary<Control,Control>();
/// <summary>
/// Zavolat po nacteni controlu.
/// </summary>
/// <param name="parent">Rodic okna.</param>
/// <param name="child">Potomek okna.</param>
public static void RegisterForm(Control parent, Control child)
{
try
{
FormPairList.Add(parent, child);
}
catch { }
}
public static Control GetChild(Control parent)
{
return FormPairList[parent];
}
public static Control GetParent(Control child)
{
return FormPairList.First(p => p.Value == child).Key;
}
}
}