Exemplo n.º 1
0
        private void toolStripMenuItem4_Click(object sender, EventArgs e)
        {
            ToolStripItem TSItem = (ToolStripItem)sender;
            ContextMenuStrip CMenu = (ContextMenuStrip)TSItem.Owner;
            SmartButton SButton = (SmartButton)CMenu.SourceControl;
            //pop up a dialog box to change the smart button

            //decide what kind of edit window to open based on the type of button
            if (SButton.buttonType == SmartButton.buttonTypes.ScriptRunner)
            {
                PromptScriptEdit Edit = new PromptScriptEdit(SButton);
                //center the window
                Edit.Location = centerNewWindow(Edit.Width, Edit.Height);
            }
            else if (SButton.buttonType == SmartButton.buttonTypes.SerialCommand)
            {
                PromptSmartButtonEdit Edit = new PromptSmartButtonEdit(SButton);
                //center the window
                Edit.Location = centerNewWindow(Edit.Width, Edit.Height);
            }
        }
Exemplo n.º 2
0
        private void setDelayToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //update the script runner timeout

            PromptScriptEdit testDialog = new PromptScriptEdit();
            int new_timeout = 1000;

            // Show testDialog as a modal dialog and determine if DialogResult = OK.
            if (testDialog.ShowDialog(this) == DialogResult.OK)
            {
                Console.WriteLine("OK");
                // Read the contents of testDialog's TextBox.
                Int32.TryParse(testDialog.textBoxDelayTime.Text, out new_timeout);
            }
            else
            {
            }
            testDialog.Dispose();

            if (serialScript != null)
            {
                serialScript.changeDelay(new_timeout);
            }
        }