Пример #1
0
        private void selectedExerciseChanged()
        {
            if (SelectedExercise != null)
            {
                usrExerciseEditor.Fill(SelectedExercise, ExercisesReposidory.Instance.Items.Values);

                bool showComments = !SelectedExercise.IsNew;
                tpComments.SetVisible(showComments);
                if (showComments && SelectedExercise != null)
                {
                    if (xtraTabControl.SelectedItem == tpComments)
                    {
                        usrWorkoutCommentsList1.CannotVote = SelectedExercise.IsMine();
                        usrWorkoutCommentsList1.Fill(SelectedExercise);
                    }
                    else if (xtraTabControl.SelectedItem == tpRecords)
                    {
                        usrExerciseRecords.Fill(SelectedExercise);
                    }
                }
            }
            else
            {
                usrExerciseEditor.ClearContent();
                usrWorkoutCommentsList1.ClearContent();
                usrExerciseRecords.ClearContent();
            }


            updateButtons(false);
        }
Пример #2
0
 void updateButtons(bool startOperation)
 {
     //exercisesTree1.Enabled = !startOperation;
     CanDelete              = false;
     CanEdit                = !startOperation && this.SelectedExercise != null && SelectedExercise.IsMine() && !SelectedExercise.IsNew;
     CanNew                 = !startOperation && (SelectedExercise != null || SelectedExerciseType.HasValue);
     CanAddToFavorites      = !startOperation && SelectedExercise.CanAddToFavorites();
     CanRemoveFromFavorites = !startOperation && SelectedExercise.CanRemoveFromFavorites();
 }