-
Notifications
You must be signed in to change notification settings - Fork 5
/
ModalSubPage.cs
47 lines (40 loc) · 1.47 KB
/
ModalSubPage.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
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
namespace Daniels.UI
{
public class ModalSubPage: SubPage
{
private ShowModalCallback _callBack;
public ModalSubPage(SubPageParameters subPageParameters)
: base(subPageParameters)
{
}
public ModalSubPage(string name, uint visibilityJoin, uint transitionJoin, List<uint> closeJoins, uint booleanOffset, uint analogOffset, uint serialOffset)
: base(name, visibilityJoin, transitionJoin, closeJoins, booleanOffset, analogOffset, serialOffset)
{
}
public delegate void ShowModalCallback(ModalSubPage sender, SubPageClosedEventArgs args);
public void ShowModal(ShowModalCallback callBack)
{
Visible = true;
_callBack = callBack;
}
protected override void panel_SigChange(BasicTriList currentDevice, SigEventArgs args)
{
base.panel_SigChange(currentDevice, args);
if (args.Sig.Type == eSigType.Bool && _closeJoins.Contains(AnalogRelativeJoin(args.Sig.Number)))
{
if (_callBack != null)
{
_callBack.Invoke(this, new SubPageClosedEventArgs(AnalogRelativeJoin(args.Sig.Number)));
_callBack = null;
}
}
}
}
}