-
Notifications
You must be signed in to change notification settings - Fork 0
/
AtopPlugin.cs
70 lines (58 loc) · 2.23 KB
/
AtopPlugin.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
using System.ComponentModel.Composition;
using AtopPlugin.Display;
using AtopPlugin.State;
using AtopPlugin.UI;
using vatsys;
using vatsys.Plugin;
namespace AtopPlugin;
[Export(typeof(IPlugin))]
public class AtopPlugin : ILabelPlugin, IStripPlugin
{
public AtopPlugin()
{
RegisterEventHandlers();
AtopMenu.Initialize();
TempActivationMessagePopup.PopUpActivationMessageIfFirstTime();
}
public string Name => "ATOP Plugin";
public CustomLabelItem? GetCustomLabelItem(string itemType, Track track, FDP2.FDR flightDataRecord,
RDP.RadarTrack radarTrack)
{
return LabelItemRenderer.RenderLabelItem(itemType, track, flightDataRecord, radarTrack);
}
public CustomStripItem? GetCustomStripItem(string itemType, Track track, FDP2.FDR flightDataRecord,
RDP.RadarTrack radarTrack)
{
return StripItemRenderer.RenderStripItem(itemType, track, flightDataRecord, radarTrack);
}
public void OnFDRUpdate(FDP2.FDR updated)
{
_ = AtopPluginStateManager.ProcessFdrUpdate(updated);
_ = AtopPluginStateManager.ProcessDisplayUpdate(updated);
_ = AtopPluginStateManager.RunConflictProbe(updated);
FdrPropertyChangesListener.RegisterHandler(updated);
// don't manage jurisdiction if not connected as ATC
if (Network.Me.IsRealATC) _ = JurisdictionManager.HandleFdrUpdate(updated);
}
public void OnRadarTrackUpdate(RDP.RadarTrack updated)
{
// don't manage jurisdiction if not connected as ATC
if (Network.Me.IsRealATC) _ = JurisdictionManager.HandleRadarTrackUpdate(updated);
}
public CustomColour? SelectASDTrackColour(Track track)
{
return TrackColorRenderer.GetAsdColor(track);
}
public CustomColour? SelectGroundTrackColour(Track track)
{
return null;
}
private static void RegisterEventHandlers()
{
Network.PrivateMessagesChanged += PrivateMessagesChangedHandler.Handle;
Network.Disconnected += DisconnectHandler.Handle;
// changes to cleared flight level do not register an FDR update
// we need to create custom handlers to be able to update the label/strip
FdrPropertyChangesListener.RegisterAllHandlers();
}
}