-
Notifications
You must be signed in to change notification settings - Fork 6
/
Class1.cs
88 lines (76 loc) · 3.16 KB
/
Class1.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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
using BusylightTester;
using System;
using System.Windows.Forms;
using MyPhonePlugins;
using System.Reflection;
namespace MyCRMPlugins
{
[CRMPluginLoader]
public class MyCrmPlugin
{
private static MyCrmPlugin _instance;
private static IMyPhoneCallHandler _callHandler;
// disabled because not used
// private Busylight.SDK busylight = null;
[CRMPluginInitializer]
public static void Loader(IMyPhoneCallHandler callHandler)
{
//show busylight Mainform Disabled in final version
frmMain frm = new frmMain();
// frm.Show();
_instance = new MyCrmPlugin(callHandler);
//start busylight Green on load
frm.busylight.Light(Busylight.BusylightColor.Green);
// Test button click another form
// frm.btnRedWithSound_Click(null, EventArgs.Empty);
}
public MyCrmPlugin(IMyPhoneCallHandler callHandler)
{
_callHandler = callHandler;
_callHandler.OnCallStatusChanged += CallHandlerOnOnCallStatusChanged;
_callHandler.OnMyPhoneStatusChanged += CallHandlerOnOnMyPhoneStatusChanged;
}
public void CallHandlerOnOnCallStatusChanged(object sender, CallStatus callInfo)
{
if (callInfo.State == CallState.Connected)
{
frmMain frm = new frmMain();
frm.busylight.Light(Busylight.BusylightColor.Red);
}
else if (callInfo.State == CallState.Ringing)
{
frmMain frm = new frmMain();
// Blue Light (Working)
//frm.busylight.Light(Busylight.BusylightColor.Blue);
// Blink Red Light (non working)
// Busylight.PulseSequence ps = Busylight.PulseSequence.Standard;
// ps.Color = Busylight.BusylightColor.Red;
// busylight.Pulse(ps);
//frm.btnRBFlash_Click(null, EventArgs.Empty);
// Blink Red Light and Play sound (non working)
//Busylight.BusylightVolume vol = Busylight.BusylightVolume.Max;
//busylight.Alert(Busylight.BusylightColor.Red, Busylight.BusylightSoundClip.KuandoTrain, vol);
frm.btnRedWithSound_Click(null, EventArgs.Empty);
}
else if (callInfo.State == CallState.Ended)
{
frmMain frm = new frmMain();
frm.busylight.Light(Busylight.BusylightColor.Green);
}
else if (callInfo.State == CallState.Dialing)
{
frmMain frm = new frmMain();
frm.busylight.Light(Busylight.BusylightColor.Yellow);
}
}
private void CallHandlerOnOnMyPhoneStatusChanged(object sender, MyPhoneStatus Status)
{
}
public CallStatus MakeCall(string destination)
{
frmMain frm = new frmMain();
frm.busylight.Light(Busylight.BusylightColor.Red);
return _callHandler.MakeCall(destination);
}
}
}