Exemplo n.º 1
0
        //public static void LoadContent(this TrainingPlanInfo plan, bool force = false)
        //{
        //    if(plan.Tag==null || force)
        //    {
        //        var newPlan = ServiceManager.GetTrainingPlan(plan.GlobalId);
        //        plan.Author = newPlan.Author;
        //        //plan.DaysCount = newPlan.DaysCount;
        //        plan.Difficult = newPlan.Difficult;
        //        plan.Language = newPlan.Language;
        //        plan.PublishDate = newPlan.PublishDate;
        //        plan.Status = newPlan.Status;
        //        plan.Rating = newPlan.Rating;
        //        plan.UserRating = newPlan.UserRating;
        //        plan.UserShortComment = newPlan.UserShortComment;
        //        plan.Purpose = newPlan.Purpose;
        //        plan.Tag = newPlan;
        //        plan.TrainingType = newPlan.TrainingType;
        //        plan.Version = newPlan.Version;
        //    }
        //}

        public static string GetDisplayText(this TrainingPlanSerie serie, bool isCardio)
        {
            string dropSetString = "";
            string repType       = "";
            string superSlow     = "";
            string restPause     = "";

            if (isCardio)
            {
                decimal seconds = serie.RepetitionNumberMin.HasValue ? serie.RepetitionNumberMin.Value : 0;
                var     time    = TimeSpan.FromSeconds((double)seconds);
                return(time.ToString());
            }
            if (serie.DropSet != DropSetType.None)
            {
                dropSetString = "^" + (int)serie.DropSet;
            }
            if (serie.RepetitionsType != SetType.Normalna)
            {
                var localier = new EnumLocalizer(StrengthTrainingEntryStrings.ResourceManager);
                repType = localier.Translate(serie.RepetitionsType);
            }
            if (serie.IsSuperSlow)
            {
                superSlow = " SS";
            }
            if (serie.IsRestPause)
            {
                restPause = " RP";
            }
            string format = serie.ToStringRepetitionsRange();

            return(string.Format("{0} {1}{2}{3}{4}", format, repType, dropSetString, superSlow, restPause).Trim());
        }
Exemplo n.º 2
0
        public static string GetDisplayText(this TrainingPlanSerie serie)
        {
            string dropSetString = "";
            string repType       = "";
            string superSlow     = "";
            string restPause     = "";

            if (serie.IsSuperSlow)
            {
                superSlow = " SS";
            }
            if (serie.IsRestPause)
            {
                restPause = " RP";
            }
            if (serie.DropSet != DropSetType.None)
            {
                dropSetString = "^" + (int)serie.DropSet;
            }
            if (serie.RepetitionsType != SetType.Normalna)
            {
                repType = EnumLocalizer.Default.Translate(serie.RepetitionsType);
            }
            string format = serie.ToStringRepetitionsRange();

            return(string.Format("{0} {1}{2}{3}{4}", format, repType, dropSetString, superSlow, restPause));
        }
        private string[] getNameAndType(TrainingPlanBase planBase)
        {
            TrainingPlan      plan  = planBase as TrainingPlan;
            TrainingPlanEntry entry = planBase as TrainingPlanEntry;
            TrainingPlanDay   day   = planBase as TrainingPlanDay;
            TrainingPlanSerie set   = planBase as TrainingPlanSerie;

            if (plan != null)
            {
                return(new string[] { plan.Name, LocalizedPropertyGridStrings.TrainingPlan_Object });
            }
            else if (entry != null)
            {
                return(new string[] { ObjectsReposidory.GetExercise(entry.ExerciseId).GetLocalizedName(), LocalizedPropertyGridStrings.TrainingPlanDayEntry_Object });
            }
            if (day != null)
            {
                return(new string[] { day.Name, LocalizedPropertyGridStrings.TrainingPlanDay_Object });
            }
            if (set != null)
            {
                return(new string[] { set.ToString(), LocalizedPropertyGridStrings.TrainingPlanSerie_Object });
            }
            return(null);
        }
 public TrainingPlanSetViewModel(TrainingPlanEntryViewModel parentEntry, TrainingPlanSerie set)
 {
     this.parentEntry = parentEntry;
     this.set         = set;
     Image            = "pack://application:,,,/BodyArchitect.Client.Module.StrengthTraining;component/Images/Set.png";
     Update();
 }
Exemplo n.º 5
0
        private void fillNameAndType(BAGlobalObject planBase, OutputItem checkItem)
        {
            TrainingPlan      plan  = planBase as TrainingPlan;
            TrainingPlanEntry entry = planBase as TrainingPlanEntry;
            TrainingPlanDay   day   = planBase as TrainingPlanDay;
            TrainingPlanSerie set   = planBase as TrainingPlanSerie;

            checkItem.Item = planBase;

            if (plan != null)
            {
                checkItem.Object = plan.Name;
                checkItem.Type   = StrengthTrainingEntryStrings.TrainingPlan_Object;
            }
            else if (entry != null)
            {
                checkItem.Object = entry.Exercise != null?entry.Exercise.GetLocalizedName() : "";

                checkItem.Type = StrengthTrainingEntryStrings.TrainingPlanDayEntry_Object;
            }
            if (day != null)
            {
                checkItem.Object = day.Name;
                checkItem.Type   = StrengthTrainingEntryStrings.TrainingPlanDay_Object;
            }
            if (set != null)
            {
                checkItem.Object = set.ToString();
                checkItem.Type   = StrengthTrainingEntryStrings.TrainingPlanSerie_Object;
            }
        }
        private TreeNode addSet(TreeNode entryNode, TrainingPlanSerie set)
        {
            TreeNode setNode = new TreeNode(set.GetDisplayText());

            setNode.Tag      = set;
            setNode.ImageKey = setNode.SelectedImageKey = "Set";
            entryNode.Nodes.Add(setNode);
            return(setNode);
        }
        public void AddSet(TrainingPlanEntryViewModel entry)
        {
            TrainingPlanSerie set = new TrainingPlanSerie(10);
            var viewModel         = new TrainingPlanSetViewModel(entry, set);

            entry.Entry.Sets.Add(set);
            entry.Sets.Add(viewModel);
            entry.IsExpanded     = true;
            viewModel.IsSelected = true;
            SetModifiedFlag();
        }
        private void tbNewSet_Click(object sender, EventArgs e)
        {
            var entry = getSelected <TrainingPlanEntry>();

            if (entry == null)
            {
                return;
            }
            TrainingPlanSerie set = new TrainingPlanSerie(10);

            entry.Sets.Add(set);
            tvDetails.SelectedNode = addSet(tvDetails.SelectedNode, set);
        }
        void buildSet(StringBuilder builder, TrainingPlanSerie set, bool isCardio)
        {
            string setTable = set != null?set.GetDisplayText(isCardio) : "&nbsp;";

            if (PrintSetsPlaceholders)
            {
                setTable = string.Format("<table border='0'><tr><td>{0}</td></tr><tr><td>__x__</td></tr></table>", setTable);
            }
            if (PrintSetsComment)
            {
                setTable = string.Format("<table border='0' width='200'><tr><td>{0}</td></tr><tr><td>{1}</td></tr></table>", setTable, set != null?set.Comment:"&nbsp;");
            }

            builder.AppendFormat("<td>{0}</td>", setTable);
        }
Exemplo n.º 10
0
        public void Fill(TrainingPlanSerie set)
        {
            this.set = set;
            if (set != null)
            {
                cmbRepetitionsType.SelectedIndex = (int)set.RepetitionsType;
                cmbDropSet.SelectedIndex         = (int)set.DropSet;
                txtRepetitionsRange.EditValue    = set.ToStringRepetitionsRange();

                if (set.Comment != null)
                {
                    set.Comment = set.Comment.Replace("\n", "\r\n");
                }
                txtComment.Text = set.Comment;
            }
        }
        public static string GetDisplayText(this TrainingPlanSerie serie)
        {
            string dropSetString = "";
            string repType       = "";

            if (serie.DropSet != DropSetType.None)
            {
                dropSetString = "^" + (int)serie.DropSet;
            }
            if (serie.RepetitionsType != TrainingPlanSerieRepetitions.Normalna)
            {
                var localier = new EnumLocalizer(LocalizedPropertyGridStrings.ResourceManager);
                repType = localier.Translate(serie.RepetitionsType);
            }
            string format = serie.ToStringRepetitionsRange();

            return(string.Format("{0} {1}{2}", format, repType, dropSetString));
        }
Exemplo n.º 12
0
 public TrainingPlanSetViewModel(TrainingPlanSerie set, TrainingPlanEntry entry)
 {
     this.set   = set;
     this.entry = entry;
 }