-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSearchHelpForm.cs
65 lines (55 loc) · 1.71 KB
/
SearchHelpForm.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
using System;
using System.Drawing;
using System.Windows.Forms;
namespace Grepy2
{
public partial class SearchHelpForm : Form
{
private bool bWindowInitComplete; // set form window is done initializing
public SearchHelpForm()
{
bWindowInitComplete = false; // we aren't done initializing the window yet, don't overwrite any .config settings
InitializeComponent();
int pos_x = -1;
int pos_y = -1;
if( Config.Get(Config.KEY.SearchHelpPosX, ref pos_x) && Config.Get(Config.KEY.SearchHelpPosY, ref pos_y) )
{
this.StartPosition = FormStartPosition.Manual;
this.Location = new Point(pos_x, pos_y);
}
else // otherwise, center the window on the parent form
{
this.StartPosition = FormStartPosition.CenterParent;
}
}
private void SearchHelpForm_Shown(object sender, EventArgs e)
{
bWindowInitComplete = true; // window initialization is complete, okay to write config settings now
}
private void SearchHelpForm_Closing(object sender, FormClosingEventArgs e)
{
e.Cancel = true; // don't let the 'X' button close the form (the SearchForm will close this form)
Hide();
}
private void SearchHelpForm_Move(object sender, EventArgs e)
{
if( bWindowInitComplete )
{
Config.Set(Config.KEY.SearchHelpPosX, Location.X);
Config.Set(Config.KEY.SearchHelpPosY, Location.Y);
}
}
private void SearchHelpMoreButton_Click(object sender, EventArgs e)
{
Help.ShowHelp(this, "Grepy2Help.chm", HelpNavigator.TopicId, "1");
}
private void SearchHelpOkButton_Click(object sender, EventArgs e)
{
Hide();
}
private void SearchHelpForm_LinkClicked(object sender, LinkClickedEventArgs e)
{
System.Diagnostics.Process.Start(e.LinkText);
}
}
}