Example #1
0
        void ReleaseDesignerOutlets()
        {
            if (CustomExerciseName != null)
            {
                CustomExerciseName.Dispose();
                CustomExerciseName = null;
            }

            if (CustomTextHeightConstraint != null)
            {
                CustomTextHeightConstraint.Dispose();
                CustomTextHeightConstraint = null;
            }

            if (ExerciseType != null)
            {
                ExerciseType.Dispose();
                ExerciseType = null;
            }

            if (NumberOfRepetitions != null)
            {
                NumberOfRepetitions.Dispose();
                NumberOfRepetitions = null;
            }
        }
        private void ShowHideCustomName()
        {
            const int expandedCustomTextConstraint = 30;
            var       customStatusChanged          =
                new Func <bool, bool>(
                    isCustom => (CustomTextHeightConstraint.Constant == expandedCustomTextConstraint && !isCustom) ||
                    (CustomTextHeightConstraint.Constant != expandedCustomTextConstraint && isCustom));

            var exerciseIsCustom = _exerciseTypePicker.SelectedRowInComponent(0) == (int)PreBuiltExersises.Custom;

            if (customStatusChanged(exerciseIsCustom))
            {
                CustomTextHeightConstraint.Constant = exerciseIsCustom ? expandedCustomTextConstraint : 0;
                CustomExerciseName.Hidden           = !exerciseIsCustom;
                if (!exerciseIsCustom)
                {
                    CustomExerciseName.Text = string.Empty;
                }
                else
                {
                    CustomExerciseName.BecomeFirstResponder();
                }
            }
        }