-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlugin.cs
More file actions
52 lines (46 loc) · 1.56 KB
/
Plugin.cs
File metadata and controls
52 lines (46 loc) · 1.56 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
using System;
using System.Diagnostics;
using System.Linq;
using System.Windows.Forms;
using Yabe;
namespace ShowNetworkNumbers
{
public class Plugin : IYabePlugin
{
private YabeMainDialog _yabeFrm;
public void Init(YabeMainDialog yabeFrm)
{
_yabeFrm = yabeFrm;
ToolStripMenuItem menuItem = new ToolStripMenuItem
{
Text = "ShowNetworkNumbers"
};
menuItem.Click += MenuItem_Click;
yabeFrm.pluginsToolStripMenuItem.DropDownItems.Add(menuItem);
}
private void MenuItem_Click(object sender, EventArgs e)
{
try
{
if (_yabeFrm == null || _yabeFrm.YabeDiscoveredDevices == null || !_yabeFrm.YabeDiscoveredDevices.Any())
{
MessageBox.Show(
_yabeFrm,
"Bitte zuerst BACnet-Geraete in Yabe suchen. Das Plugin wird erst mit gefundenen Geraeten geoeffnet.",
"ShowNetworkNumbers",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
return;
}
Trace.WriteLine("Loading ShowNetworkNumbers window...");
ShowNetworkNumbersForm form = new ShowNetworkNumbersForm(_yabeFrm);
form.Show();
}
catch
{
Cursor.Current = Cursors.Default;
Trace.Fail("Failed to load the ShowNetworkNumbers window.");
}
}
}
}