PageRenderTime 18ms CodeModel.GetById 10ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/Debugger/ILSpy.Debugger/UI/ExecuteProcessWindow.xaml.cs

http://github.com/icsharpcode/ILSpy
C# | 84 lines | 69 code | 10 blank | 5 comment | 5 complexity | e657d4dc02e24f1fe4d573aad58247a9 MD5 | raw file
 1// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 2// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 3
 4using System;
 5using System.Collections.Generic;
 6using System.IO;
 7using System.Text;
 8using System.Windows;
 9using System.Windows.Forms;
10
11namespace ICSharpCode.ILSpy.Debugger.UI
12{
13	/// <summary>
14	/// Interaction logic for ExecuteProcessWindow.xaml
15	/// </summary>
16	public partial class ExecuteProcessWindow : Window
17	{
18		public ExecuteProcessWindow()
19		{
20			InitializeComponent();
21		}
22		
23		public string SelectedExecutable {
24			get {
25				return pathTextBox.Text;
26			}
27			set {
28				pathTextBox.Text = value;
29				workingDirectoryTextBox.Text = Path.GetDirectoryName(value);
30			}
31		}
32		
33		public string WorkingDirectory {
34			get {
35				return workingDirectoryTextBox.Text;
36			}
37			set {
38				workingDirectoryTextBox.Text = value;
39			}
40		}
41		
42		public string Arguments {
43			get {
44				return argumentsTextBox.Text;
45			}
46		}
47		
48		void pathButton_Click(object sender, RoutedEventArgs e)
49		{
50			OpenFileDialog dialog = new OpenFileDialog() {
51				Filter = ".NET Executable (*.exe) | *.exe",
52				InitialDirectory = workingDirectoryTextBox.Text,
53				RestoreDirectory = true,
54				DefaultExt = "exe"
55			};
56			
57			if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
58				SelectedExecutable = dialog.FileName;
59			}
60		}
61		
62		void ExecuteButton_Click(object sender, RoutedEventArgs e)
63		{
64			if (string.IsNullOrEmpty(SelectedExecutable))
65				return;
66			this.DialogResult = true;
67		}
68		
69		void CancelButton_Click(object sender, RoutedEventArgs e)
70		{
71			this.Close();
72		}
73		
74		void workingDirectoryButton_Click(object sender, RoutedEventArgs e)
75		{
76			FolderBrowserDialog dialog = new FolderBrowserDialog() {
77				SelectedPath = workingDirectoryTextBox.Text
78			};
79			if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
80				workingDirectoryTextBox.Text = dialog.SelectedPath;
81			}
82		}
83	}
84}