-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCallLookupPlugin.cs
87 lines (57 loc) · 2.01 KB
/
CallLookupPlugin.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
using System;
using System.ComponentModel.Composition;
using VE3NEA.HamCockpit.PluginAPI;
using System.Windows.Forms;
using System.Reflection;
namespace W6OP
{
[Export(typeof(IPlugin))]
[Export(typeof(IVisualPlugin))]
public class CallLookupPlugin : IPlugin, IDisposable, IVisualPlugin
{
private CallLookupPanel lookupPanel;
private Settings settings = new Settings();
#region iPlugin Implementation
public string Name => "Call Lookup";
public string Author => "W6OP";
private bool enabled;
public bool Enabled { get => enabled; set => enabled = value; }
// public object Settings { get => settings; set => settings = (value as Settings); }
public object Settings { get => GetSettings(); set => ApplySettings(value as Settings); }
public object GetSettings()
{
return settings;
}
public void ApplySettings(Settings value)
{
settings = value;
}
public ToolStrip ToolStrip => null;
public ToolStripItem StatusItem => null;
public bool CanCreatePanel => true;
#endregion
public void Dispose()
{
//throw new NotImplementedException();
}
public UserControl CreatePanel()
{
lookupPanel = new CallLookupPanel { Name = GetTitleAndVersion() };
lookupPanel.Plugin = this;
return lookupPanel;
}
public void DestroyPanel(UserControl panel)
{
lookupPanel.Dispose();
lookupPanel = null;
}
private string GetTitleAndVersion()
{
// get the version number
Assembly asm = Assembly.GetExecutingAssembly();
AssemblyName an = asm.GetName();
string version = an.Version.Major + "." + an.Version.Minor + "." + an.Version.Build + "." + an.Version.Revision;
return "Call Lookup (" + version + ")";
}
}// end class
}