Exemplo n.º 1
0
        /// <summary>
        /// Create a formula string with parameters
        /// </summary>
        /// <param name="FormulaName">Formula name</param>
        /// <returns>Formula string with parameters</returns>
        private string TextBoxToParam(string FormulaName)
        {
            //string s = "";
            int j = FormulaName.IndexOf('(');

            if (j >= 0)
            {
                FormulaName = FormulaName.Substring(0, j);
            }

//			foreach(Control c in gbParam.Controls)
//				if (c is TextBox)
//				{
//					if (s!="") s +=",";
//					s +=((TextBox)c).Text;
//				}
//			if (s!="") s = "("+s+")";

            string s = SelectFormula.GetParam(gbParam);

            FormulaBase fb = FormulaBase.GetFormulaByName(FormulaName);

            if (fb != null)
            {
                return(FormulaName + s);
            }
            else
            {
                return("");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Extract the formula name and and parameters from a string
        /// </summary>
        /// <param name="NameAndParam">Name and parameter string , such as MA(50)</param>
        /// <param name="tbs">TextBox array, the method will extract parameters to this array</param>
        /// <param name="FormulaName">return the formula name</param>
        public void ParamToTextBox(string NameAndParam, out string FormulaName)
        {
            cbSecondYAxis.Checked = NameAndParam.EndsWith("!");
            FormulaBase fb = FormulaBase.GetFormulaByName(NameAndParam.TrimEnd('!'));

            FormulaName = fb.FormulaName;
            SelectFormula.AddParamToGroupBox(gbParam, ilFormula, fb, new EventHandler(tbP4_Leave));
        }
Exemplo n.º 3
0
 private void lbOverlayList_SelectedValueChanged(object sender, EventArgs e)
 {
     if (!this.DisableChangeEvent)
     {
         string str;
         SelectFormula.ParamToTextBox((string)this.lbOverlayList.SelectedItem, new TextBox[] { this.tbP1, this.tbP2, this.tbP3, this.tbP4 }, out str);
     }
 }
Exemplo n.º 4
0
 public static string Select(string Default)
 {
     try
     {
         SelectFormula formula = new SelectFormula();
         formula.SetFormula(Default);
         if (formula.ShowDialog() == DialogResult.OK)
         {
             return(formula.GetFormula());
         }
     }
     catch
     {
     }
     return("");
 }
Exemplo n.º 5
0
        private void tbP4_Leave(object sender, EventArgs e)
        {
            string str = SelectFormula.TextBoxToParam((string)this.lbOverlayList.SelectedItem, new TextBox[] { this.tbP1, this.tbP2, this.tbP3, this.tbP4 });

            if (str != "")
            {
                this.DisableChangeEvent = true;
                try
                {
                    this.lbOverlayList.Items[this.lbOverlayList.SelectedIndex] = str;
                }
                finally
                {
                    this.DisableChangeEvent = false;
                }
            }
        }