/
WebhookForwardHandler.cs
85 lines (77 loc) · 2.85 KB
/
WebhookForwardHandler.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
using System;
using System.Collections.Generic;
using System.Text;
using Growl.Destinations;
namespace Pushover_plugin
{
/// <summary>
/// Manages the creation and operation of the webhook forwarder.
/// </summary>
public class WebhookForwardHandler : IForwardDestinationHandler
{
#region IDestinationHandler Members
/// <summary>
/// The name of the webhook instance
/// </summary>
/// <value>string</value>
public string Name
{
get { return "Pushover Plugin"; }
}
/// <summary>
/// Registers the forwarder with Growl.
/// </summary>
/// <returns><see cref="List[Type]"/></returns>
public List<Type> Register()
{
List<Type> list = new List<Type>();
list.Add(typeof(WebhookDestination));
return list;
}
/// <summary>
/// Gets the list of <see cref="DestinationListItem"/>s to display as choices when
/// the user chooses 'Add Forward'.
/// </summary>
/// <returns><see cref="List[DestinationListItem]"/></returns>
public List<DestinationListItem> GetListItems()
{
ForwardDestinationListItem item = new ForwardDestinationListItem("Forward to your Pushover account", GetIcon(), this);
List<DestinationListItem> list = new List<DestinationListItem>();
list.Add(item);
return list;
}
/// <summary>
/// Gets the settings panel associated with this forwarder.
/// </summary>
/// <param name="dbli">The <see cref="DestinationListItem"/> as selected by the user</param>
/// <returns><see cref="DestinationSettingsPanel"/></returns>
/// <remarks>
/// This is called when a user is adding a new forwarding destination.
/// </remarks>
public DestinationSettingsPanel GetSettingsPanel(DestinationListItem dbli)
{
return new WebhookInputs();
}
/// <summary>
/// Gets the settings panel associated with this forwarder.
/// </summary>
/// <param name="db">The <see cref="DestinationBase"/> of an exiting forwarder</param>
/// <returns><see cref="DestinationSettingsPanel"/></returns>
/// <remarks>
/// This is called when a user is editing an existing forwarder.
/// </remarks>
public DestinationSettingsPanel GetSettingsPanel(DestinationBase db)
{
return new WebhookInputs();
}
#endregion
/// <summary>
/// Gets the icon associated with this forwarder.
/// </summary>
/// <returns><see cref="System.Drawing.Image"/></returns>
internal static System.Drawing.Image GetIcon()
{
return new System.Drawing.Bitmap(Properties.Resources.internet);
}
}
}