1
// SharpDevelop samples
2
// Copyright (c) 2007, AlphaSierraPapa
3
// All rights reserved.
5
// Redistribution and use in source and binary forms, with or without modification, are
6
// permitted provided that the following conditions are met:
8
// - Redistributions of source code must retain the above copyright notice, this list
9
// of conditions and the following disclaimer.
11
// - Redistributions in binary form must reproduce the above copyright notice, this list
12
// of conditions and the following disclaimer in the documentation and/or other materials
13
// provided with the distribution.
15
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
16
// endorse or promote products derived from this software without specific prior written
19
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
20
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
using System.Windows.Forms;
30
using ICSharpCode.Core;
31
using ICSharpCode.SharpDevelop.Gui;
32
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
34
namespace ICSharpCode.NAnt.Gui
37
/// Options panel for the NAnt add-in.
39
public class NAntAddInOptionPanel : XmlFormsOptionPanel
41
static readonly string commandTextBoxName = "nantCommandTextBox";
42
static readonly string argumentsTextBoxName = "argumentsTextBox";
43
static readonly string verboseCheckBoxName = "verboseCheckBox";
44
static readonly string browseButtonName = "browseButton";
45
static readonly string showLogoCheckBoxName = "showLogoCheckBox";
46
static readonly string quietCheckBoxName = "quietCheckBox";
47
static readonly string debugModeCheckBoxName = "debugModeCheckBox";
49
public override void LoadPanelContents()
51
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("ICSharpCode.NAnt.Resources.NAntAddInOptionPanel.xfrm"));
53
ControlDictionary[commandTextBoxName].Text = AddInOptions.NAntFileName;
54
ControlDictionary[argumentsTextBoxName].Text = AddInOptions.NAntArguments;
55
((CheckBox)ControlDictionary[verboseCheckBoxName]).Checked = AddInOptions.Verbose;
56
((CheckBox)ControlDictionary[showLogoCheckBoxName]).Checked = AddInOptions.ShowLogo;
57
((CheckBox)ControlDictionary[quietCheckBoxName]).Checked = AddInOptions.Quiet;
58
((CheckBox)ControlDictionary[debugModeCheckBoxName]).Checked = AddInOptions.DebugMode;
60
ControlDictionary[browseButtonName].Click += new EventHandler(OnBrowse);
63
public override bool StorePanelContents()
65
AddInOptions.NAntFileName = ControlDictionary[commandTextBoxName].Text;
66
AddInOptions.NAntArguments = ControlDictionary[argumentsTextBoxName].Text;
67
AddInOptions.Verbose = ((CheckBox)ControlDictionary[verboseCheckBoxName]).Checked;
68
AddInOptions.ShowLogo = ((CheckBox)ControlDictionary[showLogoCheckBoxName]).Checked;
69
AddInOptions.Quiet = ((CheckBox)ControlDictionary[quietCheckBoxName]).Checked;
70
AddInOptions.DebugMode = ((CheckBox)ControlDictionary[debugModeCheckBoxName]).Checked;
76
/// Allows the user to browse for the NAnt executable.
78
void OnBrowse(object sender, EventArgs e)
80
using (OpenFileDialog openFileDialog = new OpenFileDialog()) {
82
openFileDialog.CheckFileExists = true;
83
openFileDialog.Filter = StringParser.Parse("${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe|${res:SharpDevelop.FileFilter.AllFiles}|*.*");
85
if (openFileDialog.ShowDialog() == DialogResult.OK) {
86
ControlDictionary[commandTextBoxName].Text = openFileDialog.FileName;