Ejemplo n.º 1
0
 internal void ShowPreDayOptions(AbstractDay curDay)
 {
     /*
      * if (curDay.canSkip)
      * {
      *  if (IsConsoleAnswerPostive(">>> Do you want to skip this day?"))
      *  {
      *      curDay.hasSkip = true;
      *      p.OnDayFinished(curDay);
      *  }
      * }
      * if (curDay.canFreemode)
      * {
      *  if (curDay.tasks.Count > 0)
      *  {
      *      if (IsConsoleAnswerPostive(">>> Do you want to enable any AbstractTask order?"))
      *      {
      *          curDay.hasFreemode = true;
      *      }
      *  }
      *  else
      *  {
      *      Console.WriteLine("Didn't propose the freemode because this Day doesn't have AbstractTasks");
      *  }
      * }
      */
 }
Ejemplo n.º 2
0
        public override bool AskToTypeAbandonConfirmText(AbstractDay d)
        {
            if (!handlerSet)
            {
                PlanningAbandonned += (s, e) =>
                {
                    Console.WriteLine("\n\n>> You abandonned the planning");
                    Environment.Exit(0);
                };
                handlerSet = true;
            }
            string hellText = "#[`FSD73Q5Q/¨op£*¤èé'(è_fdsfxghaq.+!²&";

            // For debugging, we use a very simple abandon text
            hellText = "a";
            if (AskConfirmation("///// Are you sure you want to abandon the planning ? ////"))
            {
                Console.WriteLine("Type the following text to abandon the planning, this is not undoable : ");
                Console.WriteLine("\t\t" + hellText);
                if (Console.ReadLine().Equals(hellText))
                {
                    return(true);
                }
                else
                {
                    Console.WriteLine("The text is not matching, restarting");
                    return(AskToTypeAbandonConfirmText(d));
                }
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
 protected override void _Use(ref AbstractDay d, AbstractTask t, out bool cancelUse)
 {
     Console.WriteLine("Starting next Task (quick advance)...");
     preMenu.planning.StartNextTaskTimer(ref d, t, true);
     // We use a reference here to directly edit the day inside the planning with a strong reference
     cancelUse = false;
 }
Ejemplo n.º 4
0
 public override void ShowPreTaskOptions(AbstractDay curDay)
 {
     if (curDay.hasFreemode)
     {
         Console.WriteLine("Choose the AbstractTask you want to use");
     }
 }
Ejemplo n.º 5
0
        public override AbstractTask AskTaskToDo(AbstractDay day, AbstractTask plannedTask)
        {
            int curTaskIndex = 0;
            var tasksToDo    = day.tasks.FindAll(x => !x.IsFinished);

            foreach (var t in tasksToDo)
            {
                Console.Write($"\n{curTaskIndex + 1} | Task Name : {t.Infos.name}");
                if (plannedTask != null && plannedTask == t)
                {
                    Console.Write($" [Selected]");
                }
                Console.Write("\n");
                Console.WriteLine($"\t| Difficulty\t:\t {t.Infos.difficultyLvl}/5");
                Console.WriteLine($"\t| Duration\t:\t {t.GetDuration()} minutes");
                curTaskIndex++;
            }
            var cancelChoice = curTaskIndex;

            Console.WriteLine($"{cancelChoice}) Cancel");
            var chosenTaskIndex = SecureIntInput(1, cancelChoice, "Choose the next task that you want to do");

            if (chosenTaskIndex != cancelChoice)
            {
                Console.WriteLine("Using choice ...");
                return(tasksToDo[chosenTaskIndex - 1]);
            }
            else
            {
                // The user cancelled so we give nothing
                return(null);
            }
        }
Ejemplo n.º 6
0
 protected override void _Use(ref AbstractDay d, AbstractTask t, out bool cancelUse)
 {
     d.tasks.ForEach(delegate(AbstractTask t)
     {
         t.IsFinished = true;
     });
     cancelUse = false;
 }
Ejemplo n.º 7
0
 protected override void _Use(ref AbstractDay d, AbstractTask t, out bool cancelUse)
 {
     preMenu.planning.DecalDay(d);
     Console.WriteLine("Day is postponed to tomorrow");
     // We use a reference here to directly edit the day inside the planning with a strong reference
     //
     d         = preMenu.planning.GetCurrentDay();
     cancelUse = false;
 }
        protected override void _Use(ref AbstractDay d, AbstractTask t, out bool cancelUse)
        {
            // TODO : Add persistence for reading results
            Form f = Form.builder.AddQuestion("The question", "Well done for doing the exercices, how do you feel now ?")
                     .SetTitle("Feedback about your work")
                     .Build();

            preMenu.planning.AskForm(f);
            preMenu.planning.Save();
            cancelUse = false;
        }
Ejemplo n.º 9
0
 protected override void _Use(ref AbstractDay d, AbstractTask t, out bool cancelUse)
 {
     Console.WriteLine(" {0,-50} | {1}", "Option", "Description\n");
     preMenu.availableChoices.ForEach(delegate(PreMenuChoice c)
     {
         string s     = $"{ c.GetName() }";
         int tabCount = s.Length / 4;
         Console.WriteLine(" {0,-50} | {1}", c.GetName(), c.GetDescription());
     });
     Console.WriteLine("///////////////////////////////////////////");
     cancelUse = false;
 }
Ejemplo n.º 10
0
 protected override void _Use(ref AbstractDay d, AbstractTask t, out bool cancel)
 {
     if (preMenu.planning.AskToTypeAbandonConfirmText(d))
     {
         preMenu.planning.Abandon();
     }
     else
     {
         cancel = true;
     }
     cancel = false;
 }
Ejemplo n.º 11
0
        protected override void _Use(ref AbstractDay d, AbstractTask t, out bool cancelUse)
        {
            // TODO : Add persistence for reading results
            Form f = Form.builder.AddQuestion("Let's talk about your objectives", "Why do you want to have good results with this planning ?")
                     .AddQuestion("...and your capabilities", "Tell me why are you able to do this planning?")
                     .SetTitle("Motivation Boost Feedback")
                     .Build();

            preMenu.planning.AskForm(f);
            preMenu.planning.Save();
            cancelUse = false;
        }
Ejemplo n.º 12
0
        public override AbstractPreMenu AskPreDayMenu(ref AbstractDay day)
        {
            var choices = preMenu.availableChoices.FindAll(x => x.count > 0 && x.ShowBeforeDay());

            if (choices.Count == 0)
            {
                Console.WriteLine("Skipping Pre Day menu because no options available");
                return(preMenu);
            }

            int selectedChoice = -1;

            Console.WriteLine("\n////////////Pre day menu////////////////");
            Console.WriteLine("This menu allows you to choose some options before starting the planning");
            var            taskCount = (day.tasks != null) ? day.tasks.Count : 0;
            ConsoleRoadmap r         = new ConsoleRoadmap(this);

            r.ShowRoadmap();
            int curIndex = 1;

            foreach (var choice in choices)
            {
                if (choice.IsSelectable(out string msg))
                {
                    Console.WriteLine(curIndex + ")\t" + choice.GetName() + $" {choice.count}/{choice.maxCount}");
                }
                else
                {
                    Console.WriteLine("[Locked]\t" + choice.GetName());
                    Console.WriteLine("\t\t|\t" + msg);
                }
                curIndex++;
            }
            int quitChoice = curIndex;

            Console.WriteLine(quitChoice + ")\tClose the menu and continue");
            selectedChoice = SecureIntInput(1, curIndex, "Choose your option before starting the day");
            if (selectedChoice != quitChoice)
            {
                Console.WriteLine("Using choice ...");
                if (choices[selectedChoice - 1].IsSelectable(out string errorMsg))
                {
                    choices[selectedChoice - 1].Use(ref day, null);
                    AskPreDayMenu(ref day);
                }
                else
                {
                    Console.WriteLine("This feature cannot be used at the moment, try something else :\n" + errorMsg);
                    AskPreDayMenu(ref day);
                }
            }
            return(preMenu);
        }
Ejemplo n.º 13
0
 protected override void _Use(ref AbstractDay d, AbstractTask t, out bool cancelUse)
 {
     if (t != null)
     {
         t.IsFinished = true;
         cancelUse    = false;
     }
     else
     {
         Console.WriteLine("Error while using option: AbstractTask is null");
         cancelUse = true;
     }
 }
Ejemplo n.º 14
0
        public override AbstractPreMenu AskWaitTaskMenu(ref AbstractDay d, AbstractTask t)
        {
            var choices = preMenu.availableChoices.FindAll(x => x.count > 0 && x.ShowWhenWaiting());

            if (choices.Count == 0)
            {
                Console.WriteLine("Skipping Wait task menu because no options available");
                return(preMenu);
            }

            int selectedChoice = -1;

            Console.WriteLine("\n//////////////Wait menu////////////////");
            Console.WriteLine("This menu allows you to choose some options while waiting for the task to start");
            int curIndex = 1;

            foreach (var choice in choices)
            {
                if (choice.IsSelectable(out string msg))
                {
                    Console.WriteLine(curIndex + ")\t" + choice.GetName() + $" {choice.count}/{choice.maxCount}");
                }
                else
                {
                    Console.WriteLine("[Locked]\t" + choice.GetName());
                    Console.WriteLine("\t|\t" + msg);
                }
                curIndex++;
            }
            int quitChoice = curIndex;

            Console.WriteLine(quitChoice + ")\tClose the menu and wait/continue ");
            selectedChoice = SecureIntInput(1, curIndex, "Choose your option while waiting for the task : " + t.Infos.name);
            if (selectedChoice != quitChoice)
            {
                Console.WriteLine("Using choice ...");
                var choice = choices[selectedChoice - 1];
                if (!choice.autoCloseMenuAfterUse)
                {
                    AskWaitTaskMenu(ref d, t);
                }
                else
                {
                    Console.WriteLine("Using choice & auto closing wait menu...");
                }
                choice.Use(ref d, t);
            }
            return(preMenu);
        }
Ejemplo n.º 15
0
        protected override void _Use(ref AbstractDay d, AbstractTask t, out bool cancelUse)
        {
            var dayNumber = preMenu.planning.GetNextNonEmptyDayIndex(d) + 1;

            if (preMenu.planning.AskConfirmation($"Do you want to jump to day number {dayNumber}, current number is {preMenu.planning.currentDayIndex} ? This is not reversible"))
            {
                cancelUse = false;
                preMenu.planning.SkipDaysUntilTask(d);
                d = preMenu.planning.GetCurrentDay();
            }
            else
            {
                cancelUse = true;
            }
        }
Ejemplo n.º 16
0
 protected override void _Use(ref AbstractDay d, AbstractTask t, out bool cancel)
 {
     // Ask to select a AbstractTask in the planning implementation
     t = preMenu.planning.AskTaskToDo(d, t);
     if (t == null)
     {
         cancel = true;
     }
     else
     {
         cancel = false;
         Console.WriteLine("Selected");
         preMenu.planning.OnRequestSelectNewTask(t);
         SelectedByUser?.Invoke(this, new FreemodeArg {
             selectedTask = t
         });
     }
 }
Ejemplo n.º 17
0
        public override AbstractPreMenu AskPreTaskMenu(ref AbstractDay d, AbstractTask t)
        {
            var choices = preMenu.availableChoices.FindAll(x => x.count > 0 && x.ShowBeforeTask());

            if (choices.Count == 0)
            {
                Console.WriteLine("Skipping Pre Day menu because no options available");
                return(preMenu);
            }

            int selectedChoice = -1;

            Console.WriteLine("\n//////////////Pre Task menu////////////////");
            Console.WriteLine("This menu allows you to choose some options before starting the planning");
            int            curIndex = 1;
            ConsoleRoadmap r        = new ConsoleRoadmap(this);

            r.ShowRoadmapDay(d);
            foreach (var choice in choices)
            {
                if (choice.IsSelectable(out string msg))
                {
                    Console.WriteLine(curIndex + ")\t" + choice.GetName() + $" {choice.count}/{choice.maxCount}");
                }
                else
                {
                    Console.WriteLine("[Locked]\t" + choice.GetName());
                    Console.WriteLine("\t|\t" + msg);
                }
                curIndex++;
            }
            int quitChoice = curIndex;

            Console.WriteLine(quitChoice + ")\tClose the menu and start task");
            selectedChoice = SecureIntInput(1, curIndex, "Choose your option before starting the task : " + t.Infos.name);
            if (selectedChoice != quitChoice)
            {
                Console.WriteLine("Using choice ...");
                choices[selectedChoice - 1].Use(ref d, t);
                AskPreTaskMenu(ref d, t);
            }
            return(preMenu);
        }
Ejemplo n.º 18
0
 public override void ShowRoadmapDay(AbstractDay d)
 {
     Console.WriteLine("======== Day Roadmap ===========");
     Console.WriteLine($"| Day\t\t: {planning.currentDayIndex+1}/{planning.GetDays().Count}");
     Console.WriteLine($"| Description\t: {d.description ?? "Empty"}");
     Console.WriteLine($"| Difficulty\t: {d.GetEstimatedDifficulty()}");
     Console.WriteLine($"| Duration\t: {d.GetTotalDuration().TotalMinutes} minutes");
     if (d.tasks != null)
     {
         Console.WriteLine($"| Progress\t: {d.GetFinishedTaskCount()}/{d.tasks.Count} ({d.GetProgressPercent()}%)");
         Console.WriteLine($"| ---------------------");
         Console.WriteLine($"| Tasks");
         for (int i = 0; i < d.tasks.Count; i++)
         {
             var t = d.tasks[i];
             Console.Write($"| \t{i+1}) {t.Infos.name}");
             if (t.IsFinished)
             {
                 Console.Write(" [Finished]");
             }
             Console.Write("\n");
             Console.WriteLine($"| \t|\tDescription\t: {t.Infos.shortDescription}");
             Console.WriteLine($"| \t|\tDifficulty\t: {t.Infos.difficultyLvl}/5");
             Console.WriteLine($"| \t|\tDuration\t: {t.Infos.durationLvl} ({d.GetTotalDuration().TotalMilliseconds} min)");
             if (t.ScheduledTime.HasValue)
             {
                 Console.WriteLine($"| \t|\tStarts at\t: {t.ScheduledTime}");
             }
             else
             {
                 Console.WriteLine($"| \t|\tNo scheduled\t");
             }
         }
     }
     else
     {
         Console.WriteLine("| Empty Day");
     }
     Console.WriteLine("=====================================");
 }
Ejemplo n.º 19
0
 public override AbstractPreMenu AskWaitTaskMenu(ref AbstractDay d, AbstractTask t)
 {
     Console.WriteLine("[IA] Selecting the wait options for the task...");
     return(preMenu);
 }
Ejemplo n.º 20
0
 public override bool AskToTypeAbandonConfirmText(AbstractDay d)
 {
     Console.WriteLine("[IA] typing confirmation text for giving up...");
     return(true);
 }
Ejemplo n.º 21
0
 protected override void _Use(ref AbstractDay d, AbstractTask t, out bool cancelUse)
 {
     preMenu.planning.DecalWeek(d);
     d         = preMenu.planning.GetCurrentDay();
     cancelUse = false;
 }
Ejemplo n.º 22
0
 public override AbstractPreMenu AskPreTaskMenu(ref AbstractDay d, AbstractTask taskToDo)
 {
     Console.WriteLine("[IA] Selecting the options for the task..." + (d.tasks.FindAll(t => t.IsFinished).Count + 1) + "/" + d.tasks.Count);
     return(preMenu);
 }
Ejemplo n.º 23
0
 public override AbstractPreMenu AskPostDayMenu(ref AbstractDay day)
 {
     Console.WriteLine("[IA] Selecting the menu options when we finished the day...");
     return(preMenu);
 }
Ejemplo n.º 24
0
 protected override void _Use(ref AbstractDay d, AbstractTask t, out bool cancel)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 25
0
 public override AbstractTask AskTaskToDo(AbstractDay day, AbstractTask t)
 {
     Console.WriteLine("[IA] Choosing the next task to do...");
     return(day.GetNextTaskToDo());
 }