private void Button_Memory(object sender, EventArgs e) { TMemory <TPNumber> .Commands parsed_pNumber_command; TMemory <TFrac> .Commands parsed_frac_command; TMemory <TComplex> .Commands parsed_complex_command; dynamic exec; 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_command); exec = pNumber_ctrl.ExecCommandMemory(parsed_pNumber_command, tB_PNumber.Text); if (TMemory <TPNumber> .Commands.Copy == parsed_pNumber_command) { tB_PNumber.Text = exec.Item1.ToString(); } label_PNumber_Memory.Text = exec.Item2 == TMemory <TPNumber> .NumStates.ON ? "M" : string.Empty; break; case TAG_FRAC: Enum.TryParse(tag.Replace(TAG_FRAC, string.Empty), out parsed_frac_command); exec = frac_ctrl.ExecCommandMemory(parsed_frac_command, tB_Frac.Text); if (TMemory <TFrac> .Commands.Copy == parsed_frac_command) { tB_Frac.Text = exec.Item1.ToString(); } label_Frac_Memory.Text = exec.Item2 == TMemory <TFrac> .NumStates.ON ? "M" : string.Empty; break; case TAG_COMPLEX: Enum.TryParse(tag.Replace(TAG_COMPLEX, string.Empty), out parsed_complex_command); exec = complex_ctrl.ExecCommandMemory(parsed_complex_command, tB_Complex.Text); if (TMemory <TComplex> .Commands.Copy == parsed_complex_command) { tB_Complex.Text = exec.Item1.ToString(); } label_Complex_Memory.Text = exec.Item2 == TMemory <TComplex> .NumStates.ON ? "M" : string.Empty; break; } }
private void Button_Memory(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 TMemory <TFrac> .Commands ParsedEnum); dynamic exec = fracController.ExecCommandMemory(ParsedEnum, tB_Frac.Text); if (ParsedEnum == TMemory <TFrac> .Commands.Copy) { tB_Frac.Text = exec.Item1.ToString(); } label_Frac_Memory.Text = exec.Item2 == TMemory <TFrac> .NumStates.ON ? "M" : string.Empty; } else if (FullTag.StartsWith(TAG_COMPLEX)) { string Command = FullTag.Replace(TAG_COMPLEX, string.Empty); Enum.TryParse(Command, out TMemory <TComplex> .Commands ParsedEnum); dynamic exec = complexController.ExecCommandMemory(ParsedEnum, tB_Complex.Text); if (ParsedEnum == TMemory <TComplex> .Commands.Copy) { tB_Complex.Text = exec.Item1.ToString(); } label_Complex_Memory.Text = exec.Item2 == TMemory <TComplex> .NumStates.ON ? "M" : string.Empty; } else if (FullTag.StartsWith(TAG_PNUMBER)) { string Command = FullTag.Replace(TAG_PNUMBER, string.Empty); Enum.TryParse(Command, out TMemory <TPNumber> .Commands ParsedEnum); dynamic exec = pNumberController.ExecCommandMemory(ParsedEnum, tB_PNumber.Text); if (ParsedEnum == TMemory <TPNumber> .Commands.Copy) { tB_PNumber.Text = exec.Item1.ToString(); } label_PNumber_Memory.Text = exec.Item2 == TMemory <TPNumber> .NumStates.ON ? "M" : string.Empty; } }