示例#1
0
        private void runSendAction()
        {
            ParametersReader.ReadDefaultNames();
            ParametersReader.ReadDefaultVariables();

/*            RequestsHandler.requestTypeIndex = requestTypeComboBox.SelectedIndex;
 *          RequestsHandler.entityTypeIndex = entityTypeComboBox.SelectedIndex;*/
            RequestsHandler.SendJson();
        }
示例#2
0
        public static DialogResult SystemVariablesInputBox()
        {
            ParametersReader.ReadDefaultVariables();

            Form  form   = new Form();
            Label label1 = new Label();
            Label label2 = new Label();

            TextBox textBox1 = new TextBox();
            TextBox textBox2 = new TextBox();

            Button buttonSave   = new Button();
            Button buttonCancel = new Button();

            form.Text      = "System Variables";
            form.BackColor = Color.White;
            label1.Text    = "Default Product Qty:";
            label2.Text    = "Random number contains digit(s):";

            textBox1.Text = productQuantityValue;
            textBox2.Text = RequestsHandler.randomNumberLength;

            buttonSave.Text           = "Save";
            buttonCancel.Text         = "Cancel";
            buttonSave.DialogResult   = DialogResult.OK;
            buttonCancel.DialogResult = DialogResult.Cancel;

            label1.SetBounds(10, 20, 170, 22);
            textBox1.SetBounds(180, 18, 30, 22);

            label2.SetBounds(10, 55, 170, 22);
            textBox2.SetBounds(180, 53, 30, 22);

            buttonSave.SetBounds(50, 90, 75, 23);
            buttonCancel.SetBounds(130, 90, 75, 23);

            textBox1.Anchor = textBox1.Anchor | AnchorStyles.Right;
            textBox2.Anchor = textBox2.Anchor | AnchorStyles.Right;

            buttonSave.Anchor   = AnchorStyles.Bottom | AnchorStyles.Right;
            buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;

            buttonSave.ForeColor = Color.White;
            buttonSave.Font      = new Font("Microsoft Sans Serif", 8, FontStyle.Bold);
            buttonSave.FlatStyle = FlatStyle.Flat;
            buttonSave.BackColor = Color.FromArgb(45, 177, 53);

            buttonCancel.FlatStyle = FlatStyle.Flat;
            buttonCancel.BackColor = Color.FromArgb(236, 100, 75);
            buttonCancel.ForeColor = Color.White;
            buttonCancel.Font      = new Font("Microsoft Sans Serif", 8, FontStyle.Bold);

            form.ClientSize = new Size(225, 130);
            form.Controls.AddRange(new Control[] { label1, label2, textBox1, textBox2, buttonSave, buttonCancel });
            form.ClientSize      = new Size(Math.Max(300, label1.Right + 10), form.ClientSize.Height);
            form.FormBorderStyle = FormBorderStyle.FixedDialog;
            form.StartPosition   = FormStartPosition.CenterScreen;
            form.MinimizeBox     = false;
            form.MaximizeBox     = false;
            form.AcceptButton    = buttonSave;
            form.CancelButton    = buttonCancel;

            textBox1.Validating += new CancelEventHandler(Number_Validating);
            textBox2.Validating += new CancelEventHandler(Number_Validating);

            DialogResult dialogResult = form.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                newProductQuantityValue = textBox1.Text;
                RequestsHandler.newRandomNumberLength = textBox2.Text;
                ParametersReader.UpdateDefaultVariables();
            }
            else
            {
                Console.Out.WriteLine("Dialog cancelled");
            }

            return(dialogResult);
        }