forked from rgott/VSCodeBlockEndTag
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CBEOptionPageControl.cs
139 lines (114 loc) · 5.11 KB
/
CBEOptionPageControl.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
namespace CodeBlockEndTag
{
public partial class CBEOptionPageControl : UserControl
{
private const string DonateUrl = @"https://www.paypal.com/us/cgi-bin/webscr?cmd=_flow&SESSION=zy33NAY9x6TPiFGk26vXckTW9Nf1ffD_E4RDdAq3kXHpzeFaSsPIkFbZv9y&dispatch=5885d80a13c0db1f8e263663d3faee8d64813b57e559a2578463e58274899069";
private const string GitHubUrl = @"https://github.com/KhaosCoders/VSCodeBlockEndTag";
public CBEOptionPageControl()
{
InitializeComponent();
}
internal CBEOptionPage optionsPage;
public void Initialize()
{
chkCBETaggerEnabled.Checked = optionsPage.CBETaggerEnabled;
rdbAlways.Checked = (optionsPage.CBEVisibilityMode == (int)CBEOptionPage.VisibilityModes.Always);
rdbHeaderInvisible.Checked = (optionsPage.CBEVisibilityMode == (int)CBEOptionPage.VisibilityModes.HeaderNotVisible);
rdbSingleClick.Checked = (optionsPage.CBEClickMode == (int)CBEOptionPage.ClickMode.SingleClick);
rdbDoubleClick.Checked = (optionsPage.CBEClickMode == (int)CBEOptionPage.ClickMode.DoubleClick);
rdbCtrlClick.Checked = (optionsPage.CBEClickMode == (int)CBEOptionPage.ClickMode.CtrlClick);
rdbIconAndText.Checked = (optionsPage.CBEDisplayMode == (int)CBEOptionPage.DisplayModes.IconAndText);
rdbIconOnly.Checked = (optionsPage.CBEDisplayMode == (int)CBEOptionPage.DisplayModes.Icon);
rdbTextOnly.Checked = (optionsPage.CBEDisplayMode == (int)CBEOptionPage.DisplayModes.Text);
tbrTagSize.Value = (int)(optionsPage.CBETagScale * 10);
UpdateSizeLabel();
lviLanguages.Items.Clear();
var langs = optionsPage.SupportedLangDisplayNames;
for (int i = 0; i<langs.Length; i++)
{
lviLanguages.Items.Add(langs[i]);
if(optionsPage.SupportedLangActive[i])
{
lviLanguages.SetItemChecked(i, true);
}
}
}
private void lblLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
var sInfo = new ProcessStartInfo(DonateUrl);
Process.Start(sInfo);
}
private void lnkGitHub_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
var sInfo = new ProcessStartInfo(GitHubUrl);
Process.Start(sInfo);
}
private void chkCBETaggerEnabled_CheckedChanged(object sender, EventArgs e)
{
optionsPage.CBETaggerEnabled = chkCBETaggerEnabled.Checked;
}
private void rdbAlways_CheckedChanged(object sender, EventArgs e)
{
if (rdbAlways.Checked)
optionsPage.CBEVisibilityMode = (int)CBEOptionPage.VisibilityModes.Always;
}
private void rdbHeaderInvisible_CheckedChanged(object sender, EventArgs e)
{
if (rdbHeaderInvisible.Checked)
optionsPage.CBEVisibilityMode = (int)CBEOptionPage.VisibilityModes.HeaderNotVisible;
}
private void rdbSingleClick_CheckedChanged(object sender, EventArgs e)
{
if (rdbSingleClick.Checked)
optionsPage.CBEClickMode = (int)CBEOptionPage.ClickMode.SingleClick;
}
private void rdbDoubleClick_CheckedChanged(object sender, EventArgs e)
{
if (rdbDoubleClick.Checked)
optionsPage.CBEClickMode = (int)CBEOptionPage.ClickMode.DoubleClick;
}
private void rdbCtrlClick_CheckedChanged(object sender, EventArgs e)
{
if (rdbCtrlClick.Checked)
optionsPage.CBEClickMode = (int)CBEOptionPage.ClickMode.CtrlClick;
}
private void rdbIconAndText_CheckedChanged(object sender, EventArgs e)
{
if (rdbIconAndText.Checked)
optionsPage.CBEDisplayMode = (int)CBEOptionPage.DisplayModes.IconAndText;
}
private void rdbIconOnly_CheckedChanged(object sender, EventArgs e)
{
if (rdbIconOnly.Checked)
optionsPage.CBEDisplayMode = (int)CBEOptionPage.DisplayModes.Icon;
}
private void rdbTextOnly_CheckedChanged(object sender, EventArgs e)
{
if (rdbTextOnly.Checked)
optionsPage.CBEDisplayMode = (int)CBEOptionPage.DisplayModes.Text;
}
private void lviLanguages_ItemCheck(object sender, ItemCheckEventArgs e)
{
optionsPage.SetSupportedLangActive(e.Index, e.NewValue == CheckState.Checked);
}
private void tbrTagSize_ValueChanged(object sender, EventArgs e)
{
optionsPage.CBETagScale = (sender as TrackBar).Value / 10.0d;
UpdateSizeLabel();
}
private void UpdateSizeLabel()
{
lblTagSize.Text = string.Format("{0} %", optionsPage.CBETagScale * 100);
}
}
}