/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. using System;
  4. using System.Collections.Generic;
  5. using System.IO;
  6. using System.Text;
  7. using System.Windows;
  8. using System.Windows.Forms;
  9. namespace ICSharpCode.ILSpy.Debugger.UI
  10. {
  11. /// <summary>
  12. /// Interaction logic for ExecuteProcessWindow.xaml
  13. /// </summary>
  14. public partial class ExecuteProcessWindow : Window
  15. {
  16. public ExecuteProcessWindow()
  17. {
  18. InitializeComponent();
  19. }
  20. public string SelectedExecutable {
  21. get {
  22. return pathTextBox.Text;
  23. }
  24. set {
  25. pathTextBox.Text = value;
  26. workingDirectoryTextBox.Text = Path.GetDirectoryName(value);
  27. }
  28. }
  29. public string WorkingDirectory {
  30. get {
  31. return workingDirectoryTextBox.Text;
  32. }
  33. set {
  34. workingDirectoryTextBox.Text = value;
  35. }
  36. }
  37. public string Arguments {
  38. get {
  39. return argumentsTextBox.Text;
  40. }
  41. }
  42. void pathButton_Click(object sender, RoutedEventArgs e)
  43. {
  44. OpenFileDialog dialog = new OpenFileDialog() {
  45. Filter = ".NET Executable (*.exe) | *.exe",
  46. InitialDirectory = workingDirectoryTextBox.Text,
  47. RestoreDirectory = true,
  48. DefaultExt = "exe"
  49. };
  50. if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
  51. SelectedExecutable = dialog.FileName;
  52. }
  53. }
  54. void ExecuteButton_Click(object sender, RoutedEventArgs e)
  55. {
  56. if (string.IsNullOrEmpty(SelectedExecutable))
  57. return;
  58. this.DialogResult = true;
  59. }
  60. void CancelButton_Click(object sender, RoutedEventArgs e)
  61. {
  62. this.Close();
  63. }
  64. void workingDirectoryButton_Click(object sender, RoutedEventArgs e)
  65. {
  66. FolderBrowserDialog dialog = new FolderBrowserDialog() {
  67. SelectedPath = workingDirectoryTextBox.Text
  68. };
  69. if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
  70. workingDirectoryTextBox.Text = dialog.SelectedPath;
  71. }
  72. }
  73. }
  74. }