📄 wmpiexec.cs
字号:
} extra_options_textBox.Text = extra_options_textBox.Text.Trim(); if (extra_options_textBox.Text.Length > 0) { cmd = cmd + " " + extra_options_textBox.Text; } application_comboBox.Text = application_comboBox.Text.Trim(); // Don't add quotes because they would enclose any arguments to the application // The user must provide the quotes as necessary in the combo box. /* if (application_comboBox.Text.IndexOf(' ') != -1) { cmd = cmd + " \"" + application_comboBox.Text + "\""; } else { cmd = cmd + " " + application_comboBox.Text; } */ cmd = cmd + " -noprompt " + application_comboBox.Text; // add -noprompt since we can't send input to stdin mpiexec_command_args = cmd.Replace(mpiexec, ""); // save the command line minus the mpiexec path } else if (configfile_radioButton.Checked) { configfile_textBox.Text = configfile_textBox.Text.Trim(); if (configfile_textBox.Text.IndexOf(' ') != -1) { cmd = cmd + " -configfile \"" + configfile_textBox.Text + "\""; } else { cmd = cmd + " -configfile " + configfile_textBox.Text; } } else if (mpich1_radioButton.Checked) { mpich1_textBox.Text = mpich1_textBox.Text.Trim(); if (mpich1_textBox.Text.IndexOf(' ') != -1) { cmd = cmd + " -file \"" + mpich1_textBox.Text + "\""; } else { cmd = cmd + " -file " + mpich1_textBox.Text; } } else { cmd = ""; } return cmd; } private void show_command_button_Click(object sender, System.EventArgs e) { command_line_textBox.Text = get_command_line(); } private void output_richTextBox_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (process != null) { char_written.WaitOne(); ch = e.KeyChar; char_written.Reset(); char_available.Set(); } } #region Radio buttons enabling and disabling functions /// <summary> /// Enable and disable controls based on which radio button is selected /// </summary> private void DisableApplicationControls() { application_label.Enabled = false; application_comboBox.Enabled = false; application_browse_button.Enabled = false; nproc_label.Enabled = false; nproc_numericUpDown.Enabled = false; wdir_label.Enabled = false; wdir_textBox.Enabled = false; wdir_browse_button.Enabled = false; hosts_label.Enabled = false; hosts_textBox.Enabled = false; hosts_reset_button.Enabled = false; env_label.Enabled = false; env_textBox.Enabled = false; drive_map_label.Enabled = false; drive_map_textBox.Enabled = false; channel_label.Enabled = false; channel_comboBox.Enabled = false; extra_options_label.Enabled = false; extra_options_textBox.Enabled = false; log_checkBox.Enabled = false; } private void EnableApplicationControls() { application_label.Enabled = true; application_comboBox.Enabled = true; application_browse_button.Enabled = true; nproc_label.Enabled = true; nproc_numericUpDown.Enabled = true; wdir_label.Enabled = true; wdir_textBox.Enabled = true; wdir_browse_button.Enabled = true; hosts_label.Enabled = true; hosts_textBox.Enabled = true; hosts_reset_button.Enabled = true; env_label.Enabled = true; env_textBox.Enabled = true; drive_map_label.Enabled = true; drive_map_textBox.Enabled = true; channel_label.Enabled = true; channel_comboBox.Enabled = true; extra_options_textBox.Enabled = true; extra_options_label.Enabled = true; log_checkBox.Enabled = true; } private void DisableConfigfileControls() { configfile_label.Enabled = false; configfile_textBox.Enabled = false; configfile_browse_button.Enabled = false; } private void EnableConfigfileControls() { configfile_label.Enabled = true; configfile_textBox.Enabled = true; configfile_browse_button.Enabled = true; } private void DisableMPICH1Controls() { mpich1_label.Enabled = false; mpich1_textBox.Enabled = false; mpich1_browse_button.Enabled = false; } private void EnableMPICH1Controls() { mpich1_label.Enabled = true; mpich1_textBox.Enabled = true; mpich1_browse_button.Enabled = true; } private void application_radioButton_CheckedChanged(object sender, System.EventArgs e) { if (application_radioButton.Checked) { EnableApplicationControls(); DisableConfigfileControls(); DisableMPICH1Controls(); } } private void configfile_radioButton_CheckedChanged(object sender, System.EventArgs e) { if (configfile_radioButton.Checked) { DisableApplicationControls(); EnableConfigfileControls(); DisableMPICH1Controls(); } } private void mpich1_radioButton_CheckedChanged(object sender, System.EventArgs e) { if (mpich1_radioButton.Checked) { DisableApplicationControls(); DisableConfigfileControls(); EnableMPICH1Controls(); } } #endregion #region Dialog expansion and contraction /// <summary> /// Manage expansion and contraction of the extra dialog controls /// </summary> private void DisableAnchors() { show_bottom_checkBox.Anchor = AnchorStyles.Top; wdir_label.Anchor = AnchorStyles.Top; wdir_textBox.Anchor = AnchorStyles.Top; wdir_browse_button.Anchor = AnchorStyles.Top; hosts_label.Anchor = AnchorStyles.Top; hosts_textBox.Anchor = AnchorStyles.Top; hosts_reset_button.Anchor = AnchorStyles.Top; configfile_label.Anchor = AnchorStyles.Top; configfile_textBox.Anchor = AnchorStyles.Top; configfile_browse_button.Anchor = AnchorStyles.Top; mpich1_label.Anchor = AnchorStyles.Top; mpich1_textBox.Anchor = AnchorStyles.Top; mpich1_browse_button.Anchor = AnchorStyles.Top; env_label.Anchor = AnchorStyles.Top; env_textBox.Anchor = AnchorStyles.Top; drive_map_label.Anchor = AnchorStyles.Top; drive_map_textBox.Anchor = AnchorStyles.Top; channel_label.Anchor = AnchorStyles.Top; channel_comboBox.Anchor = AnchorStyles.Top; output_richTextBox.Anchor = AnchorStyles.Top; configfile_radioButton.Anchor = AnchorStyles.Top; mpich1_radioButton.Anchor = AnchorStyles.Top; extra_options_label.Anchor = AnchorStyles.Top; extra_options_textBox.Anchor = AnchorStyles.Top; log_checkBox.Anchor = AnchorStyles.Top; jumpshot_button.Anchor = AnchorStyles.Top; } private void EnableAnchors() { show_bottom_checkBox.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left); wdir_label.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left))); wdir_textBox.Anchor = ((AnchorStyles)(((AnchorStyles.Bottom | AnchorStyles.Left) | AnchorStyles.Right))); wdir_browse_button.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right))); hosts_label.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left))); hosts_textBox.Anchor = ((AnchorStyles)(((AnchorStyles.Bottom | AnchorStyles.Left) | AnchorStyles.Right))); hosts_reset_button.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right))); configfile_label.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left))); configfile_textBox.Anchor = ((AnchorStyles)(((AnchorStyles.Bottom | AnchorStyles.Left) | AnchorStyles.Right))); configfile_browse_button.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right))); mpich1_label.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left))); mpich1_textBox.Anchor = ((AnchorStyles)(((AnchorStyles.Bottom | AnchorStyles.Left) | AnchorStyles.Right))); mpich1_browse_button.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right))); env_label.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left))); env_textBox.Anchor = ((AnchorStyles)(((AnchorStyles.Bottom | AnchorStyles.Left) | AnchorStyles.Right))); drive_map_label.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left))); drive_map_textBox.Anchor = ((AnchorStyles)(((AnchorStyles.Bottom | AnchorStyles.Left) | AnchorStyles.Right))); channel_label.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left))); channel_comboBox.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right))); output_richTextBox.Anchor = ((AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right))); configfile_radioButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left))); mpich1_radioButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left))); extra_options_label.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left))); extra_options_textBox.Anchor = ((AnchorStyles)(((AnchorStyles.Bottom | AnchorStyles.Left) | AnchorStyles.Right))); log_checkBox.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right))); jumpshot_button.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right))); } private void HideExtraOptions() { wdir_label.Hide(); wdir_textBox.Hide(); wdir_browse_button.Hide(); hosts_label.Hide(); hosts_textBox.Hide(); hosts_reset_button.Hide(); configfile_label.Hide(); configfile_textBox.Hide(); configfile_browse_button.Hide(); mpich1_label.Hide(); mpich1_textBox.Hide(); mpich1_browse_button.Hide(); env_label.Hide(); env_textBox.Hide(); drive_map_label.Hide(); drive_map_textBox.Hide(); channel_label.Hide(); channel_comboBox.Hide(); configfile_radioButton.Hide(); mpich1_radioButton.Hide(); extra_options_textBox.Hide(); extra_options_label.Hide(); log_checkBox.Hide(); jumpshot_button.Hide(); } private void ShowExtraOptions() { wdir_label.Show(); wdir_textBox.Show(); wdir_browse_button.Show(); hosts_label.Show(); hosts_textBox.Show(); hosts_reset_button.Show(); configfile_label.Show(); configfile_textBox.Show(); configfile_browse_button.Show(); mpich1_label.Show(); mpich1_textBox.Show(); mpich1_browse_button.Show(); env_label.Show(); env_textBox.Show(); drive_map_label.Show(); drive_map_textBox.Show(); channel_label.Show(); channel_comboBox.Show(); configfile_radioButton.Show(); mpich1_radioButton.Show(); extra_options_label.Show(); extra_options_textBox.Show(); log_checkBox.Show(); jumpshot_button.Show(); } private void UpdateExtraControls(bool bShow) { DisableAnchors(); if (bShow) { ShowExtraOptions(); Height = Height + expanded_dialog_difference;//230; } else { HideExtraOptions(); Height = Height - expanded_dialog_difference;//230; } EnableAnchors(); } private void show_bottom_checkBox_CheckedChanged(object sender, System.EventArgs e) { UpdateExtraControls(show_bottom_checkBox.Checked); } #endregion private void wmpiexec_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (process != null) { process.Kill(); } if (last_execute_result != null) { run_command.EndInvoke(last_execute_result); last_execute_result = null; } } private void jumpshot_button_Click(object sender, System.EventArgs e) { Process p; string args = "-Xms32m -Xmx256m -jar " + get_jumpshot() + " " + get_clog2(); //MessageBox.Show("javaw.exe " + args); //output_richTextBox.AppendText("javaw.exe " + args + "\r\n"); try { p = Process.Start("javaw.exe", args); } catch (Exception x) { MessageBox.Show("Unable to start: javaw.exe " + args + "\r\n" + x.Message, "Error"); } } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -