示例#1
0
        public static void SaveRoutinePlannerFileFormat(LessonPlanRoutine lessonPlan)
        {
            string       fileName   = lessonPlanOptions.routineName + GlobalVar.ProgramExtension;
            StreamWriter stream     = new StreamWriter(fileName);
            const int    categories = 5;

            List <CourseExercise>[] exerciseLists = new List <CourseExercise> [categories];
            exerciseLists[0] = lessonPlan.Warmup;
            exerciseLists[1] = lessonPlan.Round1;
            exerciseLists[2] = lessonPlan.Round2;
            exerciseLists[3] = lessonPlan.Round3;
            exerciseLists[4] = lessonPlan.CoolDown;
            for (int i = 0; i < categories; i++)
            {
                int count;
                if (exerciseLists[i] != null)
                {
                    count = exerciseLists[i].Count;
                }
                else
                {
                    count = 0;
                }

                for (int j = 0; j < count; j++)
                {
                    CourseExercise ce = exerciseLists[i][j];
                    string         ID = $"{(int)ce.trainingInfo.splitKind},{(int)ce.trainingInfo.category},{ce.name},{(int)ce.trainingInfo.sets},{(int)ce.trainingInfo.reps}";
                    stream.WriteLine(ID);
                }
            }
            stream.Close();
        }
示例#2
0
 //public static void SaveLessonPlan(LessonPlanRoutine lessonPlan, string routineName, bool openBrowser, bool createPDF)
 public static void SaveLessonPlan(LessonPlanRoutine lessonPlan)
 {
     SaveHTMLFile(lessonPlan);
     SavePDF();
     StoreIntoMyRoutinesList();
     SaveRoutinePlannerFileFormat(lessonPlan);
 }
示例#3
0
        private static void SaveHTMLFile(LessonPlanRoutine lessonPlan)
        {
            //Save html file.
            string fileName = lessonPlanOptions.routineName + ".html";

            SetUpCurrentSaveDirectory(fileName);
            WriteHtmlBeginningSection(fileName, "splits");

            //Warm Up
            if (lessonPlan.Warmup != null && lessonPlan.Warmup.Count != 0)
            {
                WriteHtmlExerciseSection(fileName, "Warm Up");
                for (int i = 0; i < lessonPlan.Warmup.Count; i++)
                {
                    WriteHtmlExercise(fileName, lessonPlan.Warmup[i]);
                }
            }

            //Round 1
            if (lessonPlan.Round1 != null && lessonPlan.Round1.Count != 0)
            {
                WriteHtmlExerciseSection(fileName, "Round 1");
                for (int i = 0; i < lessonPlan.Round1.Count; i++)
                {
                    WriteHtmlExercise(fileName, lessonPlan.Round1[i]);
                }
            }

            //Round 2
            if (lessonPlan.Round2 != null && lessonPlan.Round2.Count != 0)
            {
                WriteHtmlExerciseSection(fileName, "Round 2");
                for (int i = 0; i < lessonPlan.Round2.Count; i++)
                {
                    WriteHtmlExercise(fileName, lessonPlan.Round2[i]);
                }
            }

            //Round 3
            if (lessonPlan.Round3 != null && lessonPlan.Round3.Count != 0)
            {
                WriteHtmlExerciseSection(fileName, "Round 3");
                for (int i = 0; i < lessonPlan.Round3.Count; i++)
                {
                    WriteHtmlExercise(fileName, lessonPlan.Round3[i]);
                }
            }

            //Cool Down
            if (lessonPlan.CoolDown != null && lessonPlan.CoolDown.Count != 0)
            {
                WriteHtmlExerciseSection(fileName, "Cool Down");
                for (int i = 0; i < lessonPlan.CoolDown.Count; i++)
                {
                    WriteHtmlExercise(fileName, lessonPlan.CoolDown[i]);
                }
            }

            //Footer
            WriteHtmlEnd(fileName);

            //Execute file to display on default browser.
            if (lessonPlanOptions.openBrowser)
            {
                Process.Start(fileName);
            }
        }