📄 wmpiexec.cs
字号:
using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;using Microsoft.Win32;using System.IO;using System.Threading;using System.Diagnostics;namespace wmpiexec{ /// <summary> /// Summary description for Form1. /// </summary> public class wmpiexec : System.Windows.Forms.Form { private System.Windows.Forms.Label application_label; private System.Windows.Forms.Button application_browse_button; private System.Windows.Forms.Label nproc_label; private System.Windows.Forms.NumericUpDown nproc_numericUpDown; private System.Windows.Forms.Label wdir_label; private System.Windows.Forms.TextBox wdir_textBox; private System.Windows.Forms.Button wdir_browse_button; private System.Windows.Forms.Label hosts_label; private System.Windows.Forms.TextBox hosts_textBox; private System.Windows.Forms.Button hosts_reset_button; private System.Windows.Forms.Label configfile_label; private System.Windows.Forms.TextBox configfile_textBox; private System.Windows.Forms.Button configfile_browse_button; private System.Windows.Forms.Label mpich1_label; private System.Windows.Forms.TextBox mpich1_textBox; private System.Windows.Forms.Button mpich1_browse_button; private System.Windows.Forms.Label env_label; private System.Windows.Forms.TextBox env_textBox; private System.Windows.Forms.Label drive_map_label; private System.Windows.Forms.TextBox drive_map_textBox; private System.Windows.Forms.Label channel_label; private System.Windows.Forms.ComboBox channel_comboBox; private System.Windows.Forms.Button save_job_button; private System.Windows.Forms.Button load_job_button; private System.Windows.Forms.Button execute_button; private System.Windows.Forms.Button break_button; private System.Windows.Forms.RichTextBox output_richTextBox; private System.Windows.Forms.ComboBox application_comboBox; private System.Windows.Forms.Button show_command_button; private System.Windows.Forms.TextBox command_line_textBox; private System.Windows.Forms.RadioButton application_radioButton; private System.Windows.Forms.RadioButton configfile_radioButton; private System.Windows.Forms.RadioButton mpich1_radioButton; private System.Windows.Forms.CheckBox show_bottom_checkBox; private System.Windows.Forms.TextBox extra_options_textBox; private System.Windows.Forms.Label extra_options_label; private System.Windows.Forms.CheckBox popup_checkBox; private System.Windows.Forms.Button jumpshot_button; private System.Windows.Forms.CheckBox log_checkBox; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null; private RunCommandDelegate run_command; private IAsyncResult last_execute_result; private Process process; private string thread_command; private string thread_mpiexec_command; private string thread_mpiexec_command_args; private bool thread_popup; private TextReader thread_output_stream; private TextReader thread_error_stream; private TextWriter thread_input_stream; delegate void RunCommandDelegate(string command, string mpiexec_command, string mpiexec_command_args, bool popup); delegate void ReadOutputDelegate(TextReader stream); delegate void ReadErrorDelegate(TextReader stream); delegate void WriteInputDelegate(TextWriter stream); delegate void AppendTextDelegate(string str); delegate void SetProcessDelegate(Process p); delegate void ResetExecuteButtonsDelegate(); private string mpiexec_command, mpiexec_command_args; private int expanded_dialog_difference; public wmpiexec() { // // Required for Windows Form Designer support // InitializeComponent(); expanded_dialog_difference = mpich1_browse_button.Bottom - show_bottom_checkBox.Bottom + 8; //MessageBox.Show(string.Format("difference = {0}", mpich1_browse_button.Bottom - show_bottom_checkBox.Bottom)); run_command = null; last_execute_result = null; UpdateExtraControls(show_bottom_checkBox.Checked); EnableApplicationControls(); DisableConfigfileControls(); DisableMPICH1Controls(); } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(wmpiexec)); this.application_label = new System.Windows.Forms.Label(); this.application_browse_button = new System.Windows.Forms.Button(); this.nproc_label = new System.Windows.Forms.Label(); this.nproc_numericUpDown = new System.Windows.Forms.NumericUpDown(); this.wdir_label = new System.Windows.Forms.Label(); this.wdir_textBox = new System.Windows.Forms.TextBox(); this.wdir_browse_button = new System.Windows.Forms.Button(); this.hosts_label = new System.Windows.Forms.Label(); this.hosts_textBox = new System.Windows.Forms.TextBox(); this.hosts_reset_button = new System.Windows.Forms.Button(); this.configfile_label = new System.Windows.Forms.Label(); this.configfile_textBox = new System.Windows.Forms.TextBox(); this.configfile_browse_button = new System.Windows.Forms.Button(); this.mpich1_label = new System.Windows.Forms.Label(); this.mpich1_textBox = new System.Windows.Forms.TextBox(); this.mpich1_browse_button = new System.Windows.Forms.Button(); this.env_label = new System.Windows.Forms.Label(); this.env_textBox = new System.Windows.Forms.TextBox(); this.drive_map_label = new System.Windows.Forms.Label(); this.drive_map_textBox = new System.Windows.Forms.TextBox(); this.channel_label = new System.Windows.Forms.Label(); this.channel_comboBox = new System.Windows.Forms.ComboBox(); this.save_job_button = new System.Windows.Forms.Button(); this.load_job_button = new System.Windows.Forms.Button(); this.execute_button = new System.Windows.Forms.Button(); this.break_button = new System.Windows.Forms.Button(); this.output_richTextBox = new System.Windows.Forms.RichTextBox(); this.application_comboBox = new System.Windows.Forms.ComboBox(); this.show_command_button = new System.Windows.Forms.Button(); this.command_line_textBox = new System.Windows.Forms.TextBox(); this.application_radioButton = new System.Windows.Forms.RadioButton(); this.configfile_radioButton = new System.Windows.Forms.RadioButton(); this.mpich1_radioButton = new System.Windows.Forms.RadioButton(); this.show_bottom_checkBox = new System.Windows.Forms.CheckBox(); this.extra_options_textBox = new System.Windows.Forms.TextBox(); this.extra_options_label = new System.Windows.Forms.Label(); this.popup_checkBox = new System.Windows.Forms.CheckBox(); this.jumpshot_button = new System.Windows.Forms.Button(); this.log_checkBox = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.nproc_numericUpDown)).BeginInit(); this.SuspendLayout(); // // application_label // this.application_label.Location = new System.Drawing.Point(24, 8); this.application_label.Name = "application_label"; this.application_label.Size = new System.Drawing.Size(64, 23); this.application_label.TabIndex = 1; this.application_label.Text = "Application"; // // application_browse_button // this.application_browse_button.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.application_browse_button.Location = new System.Drawing.Point(480, 8); this.application_browse_button.Name = "application_browse_button"; this.application_browse_button.Size = new System.Drawing.Size(24, 21); this.application_browse_button.TabIndex = 3; this.application_browse_button.Text = "..."; this.application_browse_button.Click += new System.EventHandler(this.application_browse_button_Click); // // nproc_label // this.nproc_label.Location = new System.Drawing.Point(24, 32); this.nproc_label.Name = "nproc_label"; this.nproc_label.Size = new System.Drawing.Size(112, 23); this.nproc_label.TabIndex = 3; this.nproc_label.Text = "Number of processes"; // // nproc_numericUpDown // this.nproc_numericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.nproc_numericUpDown.Location = new System.Drawing.Point(456, 32); this.nproc_numericUpDown.Maximum = new System.Decimal(new int[] { 10000, 0, 0, 0}); this.nproc_numericUpDown.Minimum = new System.Decimal(new int[] { 1, 0, 0, 0}); this.nproc_numericUpDown.Name = "nproc_numericUpDown"; this.nproc_numericUpDown.Size = new System.Drawing.Size(48, 20); this.nproc_numericUpDown.TabIndex = 4; this.nproc_numericUpDown.Value = new System.Decimal(new int[] { 1, 0, 0, 0}); // // wdir_label // this.wdir_label.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.wdir_label.Location = new System.Drawing.Point(24, 368); this.wdir_label.Name = "wdir_label"; this.wdir_label.Size = new System.Drawing.Size(96, 24); this.wdir_label.TabIndex = 5; this.wdir_label.Text = "working directory"; // // wdir_textBox // this.wdir_textBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.wdir_textBox.Location = new System.Drawing.Point(152, 368); this.wdir_textBox.Name = "wdir_textBox"; this.wdir_textBox.Size = new System.Drawing.Size(328, 20); this.wdir_textBox.TabIndex = 13; this.wdir_textBox.Text = ""; // // wdir_browse_button // this.wdir_browse_button.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.wdir_browse_button.Location = new System.Drawing.Point(480, 368); this.wdir_browse_button.Name = "wdir_browse_button"; this.wdir_browse_button.Size = new System.Drawing.Size(24, 20); this.wdir_browse_button.TabIndex = 14; this.wdir_browse_button.Text = "..."; this.wdir_browse_button.Click += new System.EventHandler(this.wdir_browse_button_Click); // // hosts_label // this.hosts_label.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.hosts_label.Location = new System.Drawing.Point(24, 392); this.hosts_label.Name = "hosts_label"; this.hosts_label.Size = new System.Drawing.Size(32, 23); this.hosts_label.TabIndex = 8; this.hosts_label.Text = "hosts"; // // hosts_textBox // this.hosts_textBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.hosts_textBox.Location = new System.Drawing.Point(152, 392); this.hosts_textBox.Name = "hosts_textBox"; this.hosts_textBox.Size = new System.Drawing.Size(312, 20); this.hosts_textBox.TabIndex = 15; this.hosts_textBox.Text = ""; // // hosts_reset_button // this.hosts_reset_button.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.hosts_reset_button.Location = new System.Drawing.Point(464, 392); this.hosts_reset_button.Name = "hosts_reset_button"; this.hosts_reset_button.Size = new System.Drawing.Size(40, 20); this.hosts_reset_button.TabIndex = 16; this.hosts_reset_button.Text = "reset"; this.hosts_reset_button.Click += new System.EventHandler(this.hosts_reset_button_Click); // // configfile_label // this.configfile_label.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.configfile_label.Location = new System.Drawing.Point(24, 524); this.configfile_label.Name = "configfile_label"; this.configfile_label.Size = new System.Drawing.Size(88, 16); this.configfile_label.TabIndex = 11; this.configfile_label.Text = "configuration file"; // // configfile_textBox // this.configfile_textBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.configfile_textBox.Location = new System.Drawing.Point(152, 522); this.configfile_textBox.Name = "configfile_textBox"; this.configfile_textBox.Size = new System.Drawing.Size(320, 20); this.configfile_textBox.TabIndex = 22; this.configfile_textBox.Text = ""; // // configfile_browse_button // this.configfile_browse_button.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.configfile_browse_button.Location = new System.Drawing.Point(480, 522); this.configfile_browse_button.Name = "configfile_browse_button"; this.configfile_browse_button.Size = new System.Drawing.Size(24, 20); this.configfile_browse_button.TabIndex = 23; this.configfile_browse_button.Text = "..."; this.configfile_browse_button.Click += new System.EventHandler(this.configfile_browse_button_Click); // // mpich1_label // this.mpich1_label.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.mpich1_label.Location = new System.Drawing.Point(24, 548); this.mpich1_label.Name = "mpich1_label"; this.mpich1_label.Size = new System.Drawing.Size(128, 16); this.mpich1_label.TabIndex = 14; this.mpich1_label.Text = "mpich1 configuration file"; // // mpich1_textBox // this.mpich1_textBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.mpich1_textBox.Location = new System.Drawing.Point(152, 546); this.mpich1_textBox.Name = "mpich1_textBox"; this.mpich1_textBox.Size = new System.Drawing.Size(320, 20); this.mpich1_textBox.TabIndex = 25; this.mpich1_textBox.Text = ""; // // mpich1_browse_button // this.mpich1_browse_button.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.mpich1_browse_button.Location = new System.Drawing.Point(480, 546); this.mpich1_browse_button.Name = "mpich1_browse_button"; this.mpich1_browse_button.Size = new System.Drawing.Size(24, 20); this.mpich1_browse_button.TabIndex = 26; this.mpich1_browse_button.Text = "..."; this.mpich1_browse_button.Click += new System.EventHandler(this.mpich1_browse_button_Click); // // env_label // this.env_label.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.env_label.Location = new System.Drawing.Point(24, 416); this.env_label.Name = "env_label"; this.env_label.Size = new System.Drawing.Size(120, 23); this.env_label.TabIndex = 17; this.env_label.Text = "environment variables"; // // env_textBox // this.env_textBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.env_textBox.Location = new System.Drawing.Point(152, 416); this.env_textBox.Name = "env_textBox"; this.env_textBox.Size = new System.Drawing.Size(352, 20); this.env_textBox.TabIndex = 17; this.env_textBox.Text = ""; // // drive_map_label // this.drive_map_label.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -