forked from ArduPilot/MissionPlanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample16-donate.cs
86 lines (75 loc) · 2.38 KB
/
example16-donate.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
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;
using MissionPlanner.Comms;
using System.Net.Sockets;
using System.Net;
using System.Threading.Tasks;
using System.Threading;
namespace donate
{
public class Donate : MissionPlanner.Plugin.Plugin
{
public override string Name
{
get { return "Donate"; }
}
public override string Version
{
get { return "0.10"; }
}
public override string Author
{
get { return "Example"; }
}
public override bool Init()
{
return true;
}
public override bool Loaded()
{
return true;
var MenuCustom = new System.Windows.Forms.ToolStripButton();
MenuCustom.Name = "MenuCustom";
MenuCustom.Margin = new System.Windows.Forms.Padding(0);
MenuCustom.Size = new Size(56, 47);
MenuCustom.Text = "DONATE";
MenuCustom.TextAlign = ContentAlignment.BottomCenter;
MenuCustom.TextImageRelation = TextImageRelation.ImageAboveText;
var idx = MainV2.instance.MainMenu.Items.IndexOfKey("MenuHelp");
MainV2.instance.MainMenu.Items.Insert(idx+1, MenuCustom);
var custom = new Bitmap(47, 47);
using (var g = Graphics.FromImage(custom))
{
g.FillRectangle(new SolidBrush(System.Drawing.ColorTranslator.FromHtml("#0057b7")), new Rectangle(0, 0, 47, 47 / 2));
g.FillRectangle(new SolidBrush(System.Drawing.ColorTranslator.FromHtml("#ffd700")), new Rectangle(0, 47 / 2, 47, 47 / 2));
g.Flush();
}
MenuCustom.Image = custom;
MenuCustom.Click += (s, e) =>
{
System.Diagnostics.Process.Start("https://www.unicef.org.au/appeals/ukraine-emergency-appeal");
};
return true;
}
public override bool Loop()
{
return true;
}
public override bool Exit()
{
return true;
}
}
}