Repository navigation
Expand file tree
/
Copy pathexample9-hudonoff.cs
More file actions
103 lines (87 loc) · 2.84 KB
/
Copy pathexample9-hudonoff.cs
File metadata and controls
103 lines (87 loc) · 2.84 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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MissionPlanner.Utilities;
using MissionPlanner.Controls;
using System.IO;
using System.Windows.Forms;
using System.Diagnostics;
using MissionPlanner;
using System.Drawing;
using GMap.NET.WindowsForms;
using MissionPlanner.GCSViews;
using MissionPlanner.Maps;
namespace hudonoff
{
public class Plugin : MissionPlanner.Plugin.Plugin
{
public override string Name
{
get { return "HUD"; }
}
public override string Version
{
get { return "0.10"; }
}
public override string Author
{
get { return "Michael Oborne"; }
}
public override bool Init()
{
return true;
}
private string configname = "HudItems";
public override bool Loaded()
{
var rootbut = new ToolStripMenuItem("HUD Items");
ToolStripItemCollection col = Host.FDMenuHud.Items;
col.Add(rootbut);
var items = new Dictionary<string,string>()
{
{"displayheading", "Heading"},
{"displayspeed", "Speed"},
{"displayalt", "Alt"},
{"displayconninfo", "Connection"},
{"displayxtrack", "X-Track"},
{"displayrollpitch", "Roll/Pitch"},
{"displaygps", "GPS"},
{"batteryon", "Battery"},
{"displayekf", "EKF"},
{"displayvibe", "Vibe"},
{"displayAOASSA", "AOA"},
};
var hide = Settings.Instance.GetList(configname);
foreach (var item in items)
{
var but = new ToolStripMenuItem(item.Value);
but.CheckOnClick = true;
but.Checked = true;
but.Click += (s,e)=>
{
FlightData.myhud.GetType().GetProperty(item.Key).SetValue(FlightData.myhud, but.Checked);
if (!but.Checked)
Settings.Instance.AppendList(configname, item.Value);
if (but.Checked)
Settings.Instance.RemoveList(configname, item.Value);
};
if (hide.Contains(item.Value))
{
but.Checked = false;
FlightData.myhud.GetType().GetProperty(item.Key).SetValue(FlightData.myhud, but.Checked);
}
rootbut.DropDownItems.Add(but);
}
return true;
}
public override bool Loop()
{
return true;
}
public override bool Exit()
{
return true;
}
}
}