/// <summary> /// Insert the clicked token in the rich text box. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void InsertToken(object sender, EventArgs e) { ToolStripButton button = sender as ToolStripButton; if (button != null) { switch (button.Text) { case Tokens.WMIData: using (WMIQueryForm WQF = new WMIQueryForm()) { if (WQF.ShowDialog() == System.Windows.Forms.DialogResult.OK) { LayoutRichTextBox.SelectedText = Program.WrapTokenKey(TokenIDs.WMIData + "[" + WQF.listQueries.SelectedItem + "]"); } WQF.Close(); } break; case Tokens.WSHScript: using (WSHScriptForm WSHF = new WSHScriptForm()) { if (WSHF.ShowDialog() == System.Windows.Forms.DialogResult.OK) { LayoutRichTextBox.SelectedText = Program.WrapTokenKey(TokenIDs.WSHScript + "[" + WSHF.listQueries.SelectedItem + "]"); } WSHF.Close(); } break; case Tokens.RegistryValue: using (RegistryForm RF = new RegistryForm()) { if (RF.ShowDialog() == System.Windows.Forms.DialogResult.OK) { LayoutRichTextBox.SelectedText = Program.WrapTokenKey(TokenIDs.Registry + "[" + RF.listQueries.SelectedItem + "]"); } RF.Close(); } break; default: LayoutRichTextBox.SelectedText = Program.WrapTokenKey(button.Text); break; } } }
private void windowsScriptsToolStripMenuItem_Click(object sender, EventArgs e) { WSHScriptForm WSH = new WSHScriptForm(); DialogResult result = WSH.ShowDialog(); }
/// <summary> /// Insert the clicked token in the rich text box. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void InsertToken(object sender, EventArgs e) { ToolStripButton button = sender as ToolStripButton; if (button != null) { switch (button.Text) { case Tokens.WMIData: using (WMIQueryForm WQF = new WMIQueryForm()) { if (WQF.ShowDialog() == System.Windows.Forms.DialogResult.OK) LayoutRichTextBox.SelectedText = Program.WrapTokenKey(TokenIDs.WMIData + "[" + WQF.listQueries.SelectedItem + "]"); WQF.Close(); } break; case Tokens.WSHScript: using (WSHScriptForm WSHF = new WSHScriptForm()) { if (WSHF.ShowDialog() == System.Windows.Forms.DialogResult.OK) LayoutRichTextBox.SelectedText = Program.WrapTokenKey(TokenIDs.WSHScript + "[" + WSHF.listQueries.SelectedItem + "]"); WSHF.Close(); } break; case Tokens.RegistryValue: using (RegistryForm RF = new RegistryForm()) { if (RF.ShowDialog() == System.Windows.Forms.DialogResult.OK) LayoutRichTextBox.SelectedText = Program.WrapTokenKey(TokenIDs.Registry + "[" + RF.listQueries.SelectedItem + "]"); RF.Close(); } break; default: LayoutRichTextBox.SelectedText = Program.WrapTokenKey(button.Text); break; } } }