-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathguideFrmConfig.cs
More file actions
98 lines (83 loc) · 4.12 KB
/
guideFrmConfig.cs
File metadata and controls
98 lines (83 loc) · 4.12 KB
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
using System;
using System.Windows.Forms;
using System.IO;
using System.Linq;
using OccultWatcher.Guide.Properties;
namespace OccultWatcher.Guide
{
public partial class guideFrmConfig : Form
{
private OWGuide m_ParentAddin;
public guideFrmConfig(OWGuide parentAddin)
{
m_ParentAddin = parentAddin;
InitializeComponent();
GuideConfig.LoadRegistryConfig();
tbxPathToGuide.Text = GuideConfig.GuidePath;
tbxGuideConfig.Text = GuideConfig.GuideConfiguration;
tbxAdditionalArguments.Text = GuideConfig.CommandLineArguments;
cbxAlwaysInNewInstance.Checked = GuideConfig.AlwaysNewInstance;
}
private void guideFrmConfig_Load(object sender, EventArgs e)
{
btnOK.Text = m_ParentAddin.GetResourceString("OK", "OK");
btnCancel.Text = m_ParentAddin.GetResourceString("Cancel", "Cancel");
btnAbout.Text = m_ParentAddin.GetResourceString("About", "About");
Text = m_ParentAddin.GetResourceString(OWGuide.OWGuideConfigTitle, "OW Guide Add-in Configuration");
btnOpenFileDialog.Text = m_ParentAddin.GetResourceString(OWGuide.OWGuideBrowse, "Browse ...");
lblOptional.Text = m_ParentAddin.GetResourceString(OWGuide.OWGuideOptional, "Optional: Add name of Guide configuration (exactly 8 characters)");
lblGuidePath.Text = m_ParentAddin.GetResourceString(OWGuide.OWGuideGuidePath, "Set the path to Guide's executable on your computer");
lblAdditionalArguments.Text = m_ParentAddin.GetResourceString(OWGuide.OWGuideAdditionalCommandLineArguments, "Optional: Additional command line arguments");
cbxAlwaysInNewInstance.Text = m_ParentAddin.GetResourceString(OWGuide.OWGuideAlwaysInNewInstance, "Open events in a new instance of Guide");
}
private void btnOK_Click(object sender, EventArgs e)
{
if (Directory.Exists(tbxPathToGuide.Text))
{
var guideExe = Directory.GetFiles(tbxPathToGuide.Text, "guide?.exe").SingleOrDefault();
if (guideExe != null)
{
tbxPathToGuide.Text += guideExe;
}
}
if (!File.Exists(tbxPathToGuide.Text))
{
MessageBox.Show(this,
string.Format(m_ParentAddin.GetResourceString(OWGuide.OWGuideCouldNotFindPath, "Could not find path '{0}'"), tbxPathToGuide.Text),
m_ParentAddin.GetResourceString(OWGuide.OWGuideAddinName, "OW Guide Add-in"),
MessageBoxButtons.OK,
MessageBoxIcon.Error);
tbxPathToGuide.Focus();
return;
}
GuideConfig.GuidePath = tbxPathToGuide.Text;
GuideConfig.GuideConfiguration = tbxGuideConfig.Text;
GuideConfig.CommandLineArguments = tbxAdditionalArguments.Text;
GuideConfig.AlwaysNewInstance = cbxAlwaysInNewInstance.Checked;
GuideConfig.SaveRegistryConfig();
Close();
}
private void btnOpenFileDialog_Click(object sender, EventArgs e)
{
// Displays an OpenFileDialog so the user can select a Cursor.
using (OpenFileDialog openFileDialog1 = new OpenFileDialog())
{
openFileDialog1.Filter = "guide|guide?.exe";
openFileDialog1.Title = "Select path to guide9.exe";
string path = string.Empty;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
path = openFileDialog1.FileName;
tbxPathToGuide.Clear();
tbxPathToGuide.AppendText(path);
}
}
}
private void btnAbout_Click(object sender, EventArgs e)
{
MessageBox.Show(this,
m_ParentAddin.GetResourceString(OWGuide.OWGuideAddinCredits, "This add-in was created by Andreas Eberle"),
m_ParentAddin.GetResourceString(OWGuide.OWGuideAddinName, "OW Guide Add-in"));
}
}
}