-
Notifications
You must be signed in to change notification settings - Fork 50
/
FormHelp.cs
112 lines (107 loc) · 3.74 KB
/
FormHelp.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
using System;
using System.Drawing;
using System.Windows.Forms;
namespace KeeTrayTOTP
{
/// <summary>
/// Form providing help information on the Tray TOTP Plugin.
/// </summary>
internal partial class FormHelp : Form
{
/// <summary>
/// Getting started flag.
/// </summary>
private readonly bool _gettingStarted;
/// <summary>
/// Windows Form Constructor.
/// </summary>
/// <param name="plugin">Plugin Host.</param>
/// <param name="gettingStarted">Getting Started Display Flag.</param>
internal FormHelp(bool gettingStarted = false)
{
_gettingStarted = gettingStarted;
InitializeComponent();
}
/// <summary>
/// Windows Form Load.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void FormHelp_Load(object sender, EventArgs e)
{
Size = new Size(550, 350);
Text = Localization.Strings.Help + @" - " + Localization.Strings.TrayTOTPPlugin;
foreach (Control ctl in SplitContainerHelp.Panel2.Controls)
{
ctl.Location = new Point(3, 3);
ctl.Size = new Size(SplitContainerHelp.Panel2.Width - 3, SplitContainerHelp.Panel2.Height - 3);
}
TreeViewHelp.ExpandAll();
TreeViewHelp.SelectedNode = _gettingStarted ? TreeViewHelp.Nodes["GettingStarted"] : TreeViewHelp.Nodes["Welcome"];
}
/// <summary>
/// Windows Form Closing.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void FormHelp_FormClosing(object sender, FormClosingEventArgs e)
{
Hide();
e.Cancel = true;
}
/// <summary>
/// TreeView Node Selection.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void TreeViewHelp_AfterSelect(object sender, TreeViewEventArgs e)
{
try
{
switch (e.Node.Name)
{
case "Welcome":
PanelWelcome.BringToFront();
break;
case "GettingStarted":
PanelGettingStarted.BringToFront();
break;
case "Components":
PanelComponents.BringToFront();
break;
case "EntryList":
PanelEntryList.BringToFront();
break;
case "ContextMenu":
PanelContextMenu.BringToFront();
break;
case "CopyTOTP":
PanelCopyTOTP.BringToFront();
break;
case "SetupTOTP":
PanelSetupTOTP.BringToFront();
break;
case "CustomColumn":
PanelCustomColumn.BringToFront();
break;
case "TrayIcon":
PanelTrayIcon.BringToFront();
break;
case "AutoType":
PanelAutoType.BringToFront();
break;
case "TimeCorrection":
PanelTimeCorrection.BringToFront();
break;
case "Storage":
PanelStorage.BringToFront();
break;
}
}
catch (Exception)
{
// ignored
}
}
}
}