private void TextBox_Clicked(object sender, RoutedEventArgs e) { var textbox = sender as System.Windows.Controls.TextBox; if (!Helpers.IsTextAllowed(textbox.Text)) { textbox.Text = "0"; textbox.MaxLength = 1; MessageBox.Show(Window.GetWindow(this), "Please Enter a valid number."); } if (textbox.Tag == null) { return; } String _tag = textbox.Tag.ToString(); ChoiceSelection window = new ChoiceSelection(_tag); window.ShowDialog(); switch (_tag) { case "neck_position": this.rebaObject.Score_neck.SetScore(Helpers.Convert(textbox.Text)); break; case "trunk_position": this.rebaObject.Score_trunk.SetScore(Helpers.Convert(textbox.Text)); break; case "legs_position": this.rebaObject.Score_legs.SetScore(Helpers.Convert(textbox.Text)); break; case "neck_trunk_legs_load": this.rebaObject.Score_neck_trunk_legs_load.SetScore(Helpers.Convert(textbox.Text)); break; case "upper_arm": this.rebaObject.Score_upper_arm.SetScore(Helpers.Convert(textbox.Text)); break; case "lower_arm": this.rebaObject.Score_lower_arm.SetScore(Helpers.Convert(textbox.Text)); break; case "wrist_position": this.rebaObject.Score_wrist_position.SetScore(Helpers.Convert(textbox.Text)); break; case "coupling": this.rebaObject.Score_coupling.SetScore(Helpers.Convert(textbox.Text)); break; case "activity": this.rebaObject.Score_activity.SetScore(Helpers.Convert(textbox.Text)); break; } }
private void TextBox_Clicked(object sender, RoutedEventArgs e) { var textbox = sender as System.Windows.Controls.TextBox; if (!Helpers.IsTextAllowed(textbox.Text)) { textbox.Text = "0"; textbox.MaxLength = 1; MessageBox.Show(Window.GetWindow(this), "Please Enter a valid number."); } if (textbox.Tag == null) return; String _tag = textbox.Tag.ToString(); ChoiceSelection window = new ChoiceSelection(_tag); window.ShowDialog(); switch (_tag) { case "neck_position": this.rebaObject.Score_neck.SetScore(Helpers.Convert(textbox.Text)); break; case "trunk_position": this.rebaObject.Score_trunk.SetScore(Helpers.Convert(textbox.Text)); break; case "legs_position": this.rebaObject.Score_legs.SetScore(Helpers.Convert(textbox.Text)); break; case "neck_trunk_legs_load": this.rebaObject.Score_neck_trunk_legs_load.SetScore(Helpers.Convert(textbox.Text)); break; case "upper_arm": this.rebaObject.Score_upper_arm.SetScore(Helpers.Convert(textbox.Text)); break; case "lower_arm": this.rebaObject.Score_lower_arm.SetScore(Helpers.Convert(textbox.Text)); break; case "wrist_position": this.rebaObject.Score_wrist_position.SetScore(Helpers.Convert(textbox.Text)); break; case "coupling": this.rebaObject.Score_coupling.SetScore(Helpers.Convert(textbox.Text)); break; case "activity": this.rebaObject.Score_activity.SetScore(Helpers.Convert(textbox.Text)); break; } }