📄 ifclausedialog.cs
字号:
txtCondition.Focus();
}
/// <summary>
/// Handles the Click event of the And button
/// </summary>
/// <param name="sender">Object that fired the event</param>
/// <param name="e">.NET supplied event parameters</param>
private void btnAnd_Click(object sender, EventArgs e)
{
txtCondition.AppendText("AND ");
txtCondition.Focus();
}
/// <summary>
/// Handles the Click event of the Or button
/// </summary>
/// <param name="sender">Object that fired the event</param>
/// <param name="e">.NET supplied event parameters</param>
private void btnOr_Click(object sender, EventArgs e)
{
txtCondition.AppendText("OR ");
txtCondition.Focus();
}
/// <summary>
/// Handles the Click event of the Yes button
/// </summary>
/// <param name="sender">Object that fired the event</param>
/// <param name="e">.NET supplied event parameters</param>
private void btnYes_Click(object sender, EventArgs e)
{
txtCondition.AppendText(Configuration.GetNewInstance().Settings.RepresentationOfYes + " ");
txtCondition.Focus();
}
/// <summary>
/// Handles the Click event of the No button
/// </summary>
/// <param name="sender">Object that fired the event</param>
/// <param name="e">.NET supplied event parameters</param>
private void btnNo_Click(object sender, EventArgs e)
{
txtCondition.AppendText(Configuration.GetNewInstance().Settings.RepresentationOfNo + " ");
txtCondition.Focus();
}
/// <summary>
/// Handles the Click event of the Missing button
/// </summary>
/// <param name="sender">Object that fired the event</param>
/// <param name="e">.NET supplied event parameters</param>
private void btnMissing_Click(object sender, EventArgs e)
{
txtCondition.AppendText(Configuration.GetNewInstance().Settings.RepresentationOfMissing + " ");
txtCondition.Focus();
}
/// <summary>
/// Handles the Selection Change event for variables in the combobox
/// </summary>
/// <param name="sender">Object that fired the event</param>
/// <param name="e">.NET supplied event parameters</param>
private void cbxVariables_SelectedIndexChanged(object sender, EventArgs e)
{
txtCondition.AppendText(cbxVariables.SelectedItem.ToString() + " ");
txtCondition.Focus();
}
/// <summary>
/// Handles the MouseDown event of the Then button
/// </summary>
/// <param name="sender">Object that fired the event</param>
/// <param name="e">.NET supplied event parameters</param>
private void btnThen_MouseDown(object sender, MouseEventArgs e)
{
CurrentContextMenuType = CommandContextMenuType.Then;
BuildCommandContextMenu().Show((Control)sender, e.Location);
}
/// <summary>
/// Handles the Mouse Down event of the Else button
/// </summary>
/// <param name="sender">Object that fired the event</param>
/// <param name="e">.NET supplied event parameters</param>
private void btnElse_MouseDown(object sender, MouseEventArgs e)
{
CurrentContextMenuType = CommandContextMenuType.Else;
BuildCommandContextMenu().Show((Control)sender, e.Location);
}
/// <summary>
/// Handles the Click event of the Help menu item
/// </summary>
/// <param name="sender">Object that fired the event</param>
/// <param name="e">.NET supplied event parameters</param>
void mnuHelp_Click(object sender, EventArgs e)
{
MsgBox.ShowInformation("This functionality will be available in a later build."); // TODO: Hard coded string
}
/// <summary>
/// Handles the Click event of the Dialog menu item
/// </summary>
/// <param name="sender">Object that fired the event</param>
/// <param name="e">.NET supplied event parameters</param>
void mnuDialog_Click(object sender, EventArgs e)
{
DesignStatement(new DialogConfigDialog(MainForm));
}
/// <summary>
/// Handles the Click event of the Assign menu item
/// </summary>
/// <param name="sender">Object that fired the event</param>
/// <param name="e">.NET supplied event arguments</param>
void mnuAssign_Click(object sender, EventArgs e)
{
DesignStatement(new VariableAssignmentDialog(MainForm));
}
/// <summary>
/// Handles the Click event of the Execute menu item
/// </summary>
/// <param name="sender">Object that fired the event</param>
/// <param name="e">.NET supplied event arguments</param>
void mnuExecute_Click(object sender, EventArgs e)
{
DesignStatement(new ExecuteDialog(MainForm));
}
/// <summary>
/// Handles the Click event of the AutoSearch menu item
/// </summary>
/// <param name="sender">Object that fired the event</param>
/// <param name="e">.NET supplied event arguments</param>
void mnuAutosearch_Click(object sender, EventArgs e)
{
DesignStatement(new AutoSearchDialog(MainForm));
}
/// <summary>
/// Handles the Click event of the GoTo menu item
/// </summary>
/// <param name="sender">Object that fired the event</param>
/// <param name="e">.NET supplied event arguments</param>
void mnuGoto_Click(object sender, EventArgs e)
{
DesignStatement(new GoToDialog(MainForm));
}
/// <summary>
/// Handles the Click event of the Clear menu item
/// </summary>
/// <param name="sender">Object that fired the event</param>
/// <param name="e">.NET supplied event parameters</param>
void mnuClear_Click(object sender, EventArgs e)
{
DesignStatement(new ClearDialog(MainForm));
}
/// <summary>
/// Handles the Click event of the Unhide menu item
/// </summary>
/// <param name="sender">Object that fired the event</param>
/// <param name="e">.NET supplied event parameters</param>
void mnuUnhide_Click(object sender, EventArgs e)
{
DesignStatement(new UnhideDialog(MainForm));
}
/// <summary>
/// Handles the Click event of the Hide menu item
/// </summary>
/// <param name="sender">Object that fired the event</param>
/// <param name="e">.NET supplied event parameters</param>
void mnuHide_Click(object sender, EventArgs e)
{
DesignStatement(new HideDialog(MainForm));
}
/// <summary>
/// Handles the Click event of the Then menu item
/// </summary>
/// <param name="sender">Object that fired the event</param>
/// <param name="e">.NET supplied event parameters</param>
private void btnThen_Click(object sender, EventArgs e)
{
}
#endregion //Private Event Handlers
/// <summary>
/// Builds a context menu for commands
/// </summary>
/// <returns>A commands context menu</returns>
private ContextMenuStrip BuildCommandContextMenu()
{
ContextMenuStrip contextMenu = new ContextMenuStrip();
ToolStripMenuItem mnuAssign = new ToolStripMenuItem("Assign");
mnuAssign.Click += new EventHandler(mnuAssign_Click);
ToolStripMenuItem mnuAutosearch = new ToolStripMenuItem("Autosearch");
mnuAutosearch.Click += new EventHandler(mnuAutosearch_Click);
ToolStripMenuItem mnuClear = new ToolStripMenuItem("Clear");
mnuClear.Click += new EventHandler(mnuClear_Click);
ToolStripMenuItem mnuDialog = new ToolStripMenuItem("Dialog");
mnuDialog.Click += new EventHandler(mnuDialog_Click);
ToolStripMenuItem mnuExecute = new ToolStripMenuItem("Execute");
mnuExecute.Click += new EventHandler(mnuExecute_Click);
ToolStripMenuItem mnuGoto = new ToolStripMenuItem("Goto");
mnuGoto.Click += new EventHandler(mnuGoto_Click);
ToolStripMenuItem mnuHelp = new ToolStripMenuItem("Help");
mnuHelp.Enabled = false;
mnuHelp.Click += new EventHandler(mnuHelp_Click);
ToolStripMenuItem mnuHide = new ToolStripMenuItem("Hide");
mnuHide.Click += new EventHandler(mnuHide_Click);
ToolStripMenuItem mnuUnhide = new ToolStripMenuItem("Unhide");
mnuUnhide.Click += new EventHandler(mnuUnhide_Click);
contextMenu.Items.AddRange(new ToolStripMenuItem[] { mnuAssign, mnuAutosearch, mnuClear, mnuDialog, mnuExecute, mnuGoto, mnuHelp, mnuHide, mnuUnhide });
return contextMenu;
}
/// <summary>
/// Handles text for the Then menu item
/// </summary>
/// <param name="dialog">A check code dialog</param>
private void DesignStatement(CheckCodeDesignDialog dialog)
{
dialog.View = view;
DialogResult result = ((Form)dialog).ShowDialog();
if (result == DialogResult.OK)
{
if (CurrentContextMenuType == CommandContextMenuType.Then)
{
if (txtThen.Lines.Length > 0)
{
txtThen.AppendText(Environment.NewLine);
}
txtThen.AppendText(dialog.Output);
}
else
{
if (txtElse.Lines.Length > 0)
{
txtElse.AppendText(Environment.NewLine);
}
txtElse.AppendText(dialog.Output);
}
((Form)dialog).Close();
}
}
#region Private Enumerations
private enum CommandContextMenuType
{
Then,
Else
}
#endregion //Private Enumerations
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -