private void Button_Number_Operation(object sender, EventArgs e) { TProc <TFrac> .Oper parsed_frac_oper; TProc <TPNumber> .Oper parsed_pNumber_oper; TProc <TComplex> .Oper parsed_complex_oper; Button button = (Button)sender; string tag = button.Tag.ToString(); string part_tag = tag.Substring(0, tag.IndexOf('_')) + "_"; switch (part_tag) { case TAG_PNUMBER: Enum.TryParse(tag.Replace(TAG_PNUMBER, string.Empty), out parsed_pNumber_oper); tB_PNumber.Text = pNumber_ctrl.ExecOperation(parsed_pNumber_oper); break; case TAG_FRAC: Enum.TryParse(tag.Replace(TAG_FRAC, string.Empty), out parsed_frac_oper); tB_Frac.Text = Number_to_state(TAG_FRAC, frac_ctrl.ExecOperation(parsed_frac_oper)); break; case TAG_COMPLEX: Enum.TryParse(tag.Replace(TAG_COMPLEX, string.Empty), out parsed_complex_oper); tB_Complex.Text = Number_to_state(TAG_COMPLEX, complex_ctrl.ExecOperation(parsed_complex_oper)); break; } }
private void Button_Number_Operation(object sender, EventArgs e) { Button button = (Button)sender; string FullTag = button.Tag.ToString(); if (FullTag.StartsWith(TAG_FRAC)) { string Command = FullTag.Replace(TAG_FRAC, string.Empty); Enum.TryParse(Command, out TProc <TFrac> .Oper ParsedEnum); tB_Frac.Text = NumberBeatifier(TAG_FRAC, fracController.ExecOperation(ParsedEnum)); } else if (FullTag.StartsWith(TAG_COMPLEX)) { string Command = FullTag.Replace(TAG_COMPLEX, string.Empty); Enum.TryParse(Command, out TProc <TComplex> .Oper ParsedEnum); tB_Complex.Text = NumberBeatifier(TAG_COMPLEX, complexController.ExecOperation(ParsedEnum)); } else if (FullTag.StartsWith(TAG_PNUMBER)) { string Command = FullTag.Replace(TAG_PNUMBER, string.Empty); Enum.TryParse(Command, out TProc <TPNumber> .Oper ParsedEnum); tB_PNumber.Text = pNumberController.ExecOperation(ParsedEnum); } }