コード例 #1
0
        private void BtnAcceptClick(object sender, EventArgs e)
        {
            if (tabControl.SelectedTab == tabPageEmpty)
            {
                trigger      = null;
                DialogResult = DialogResult.OK;
                return;
            }

            // котировки
            if (tabControl.SelectedTab == tabPageQuote)
            {
                trigger = new ScriptTriggerNewQuote
                {
                    quotesToCheck = cbQuote.GetCheckedItems().Cast <string>().ToList()
                };
                DialogResult = DialogResult.OK;
                return;
            }

            // ордера
            if (tabControl.SelectedTab == tabPageOrder)
            {
                trigger = new ScriptTriggerDealEvent();
                for (var i = 0; i < cbOrder.Items.Count; i++)
                {
                    if (!cbOrder[i])
                    {
                        continue;
                    }
                    var evType = (ScriptTriggerDealEventType)cbOrder.Items[i];
                    ((ScriptTriggerDealEvent)trigger).eventType |= evType;
                }

                DialogResult = DialogResult.OK;
                return;
            }

            // формула
            if (tabControl.SelectedTab == tabPageFormula)
            {
                var trigForm = new ScriptTriggerPriceFormula {
                    Formula = tbFormula.Text
                };
                if (!string.IsNullOrEmpty(trigForm.FormulaError))
                {
                    MessageBox.Show("Ошибка в формуле: \n" + trigForm.FormulaError,
                                    "Ошибка ввода", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                trigger      = trigForm;
                DialogResult = DialogResult.OK;
            }
        }
コード例 #2
0
        private void BtnAcceptClick(object sender, EventArgs e)
        {
            if (tabControl.SelectedTab == tabPageEmpty)
            {
                trigger = null;
                DialogResult = DialogResult.OK;
                return;
            }

            // котировки
            if (tabControl.SelectedTab == tabPageQuote)
            {
                trigger = new ScriptTriggerNewQuote
                    {
                        quotesToCheck = cbQuote.GetCheckedItems().Cast<string>().ToList()
                    };
                DialogResult = DialogResult.OK;
                return;
            }

            // ордера
            if (tabControl.SelectedTab == tabPageOrder)
            {
                trigger = new ScriptTriggerDealEvent();
                for (var i = 0; i < cbOrder.Items.Count; i++)
                {
                    if (!cbOrder[i]) continue;
                    var evType = (ScriptTriggerDealEventType) cbOrder.Items[i];
                    ((ScriptTriggerDealEvent) trigger).eventType |= evType;
                }

                DialogResult = DialogResult.OK;
                return;
            }

            // формула
            if (tabControl.SelectedTab == tabPageFormula)
            {
                var trigForm = new ScriptTriggerPriceFormula {Formula = tbFormula.Text};
                if (!string.IsNullOrEmpty(trigForm.FormulaError))
                {
                    MessageBox.Show("Ошибка в формуле: \n" + trigForm.FormulaError,
                                    "Ошибка ввода", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                trigger = trigForm;
                DialogResult = DialogResult.OK;
            }
        }