/// <summary> /// Initializes a new instance of the Mode class. /// </summary> /// <param name="title">The name of the Mode object.</param> /// <param name="abbreviation">The key for the Mode object (has to be unique among them).</param> /// <param name="uniqueChars">The keys that are already in use to prevent not calling the second mode with the same abbreviation.</param> /// <param name="lotto">The Lottery variable that should be used.</param> /// <exception cref="ArgumentNullException">If the title has no actual name or the unique char array is null.</exception> /// <exception cref="ArgumentException">If the abbreviation has already be used.</exception> public Mode(string title, char abbreviation, char[] uniqueChars, Lottery lotto) { if (uniqueChars == null) { throw new ArgumentNullException(nameof(uniqueChars)); } for (int i = 0; i < uniqueChars.Length; i++) { if (uniqueChars[i] == abbreviation) { throw new ArgumentException("The same abbreviation must not be used multiple times!", nameof(abbreviation)); } } if (string.IsNullOrWhiteSpace(title)) { throw new ArgumentNullException(nameof(title), $"The title of the mode with the character {abbreviation} must have a name."); } for (int i = 0; i < uniqueChars.Length; i++) { if (uniqueChars[i] == '\0') { uniqueChars[i] = abbreviation; break; } } this.Title = title; this.Abbreviation = abbreviation; this.Lotto = lotto; this.Render = new ExecuteableConsoleRenderer(); }
/// <summary> /// Initializes the Mode objects and puts them into an List of modes. /// </summary> /// <param name="lotto">The Lottery variable that should used.</param> /// <returns>The list of the initialized mode objects.</returns> private List <Mode> CreateModes(Lottery lotto) { List <Mode> modeOptions = new List <Mode>(); char[] uniqueChars = new char[modeOptions.Count]; modeOptions.Add(new ManualTip("Manual Tip", 'M', uniqueChars, lotto)); modeOptions.Add(new QuickTip("Quick Tip", 'Q', uniqueChars, lotto)); modeOptions.Add(new GraphicalTip("Graphical Tip", 'G', uniqueChars, lotto)); modeOptions.Add(new JackpotSimulation("Jackpot Simulation", 'S', uniqueChars, lotto)); modeOptions.Add(new FrequencyDetermination("Determine Frequencies", 'H', uniqueChars, lotto)); modeOptions.Add(new OptionsMenu("Options menu", 'O', uniqueChars, lotto)); modeOptions.Add(new ApplicationExit("Application Extermination", 'B', uniqueChars, lotto)); return(modeOptions); }
/// <summary> /// Initializes a new instance of the <see cref="CurrentSystemSetter"/> class. /// </summary> /// <param name="title">The title of the object.</param> /// <param name="abbreviation">The key to get the user to the objects execute method.</param> /// <param name="uniqueChars">The keys that are already used to prevent not being able to call the second mode with the same abbreviation.</param> /// <param name="lotto">The Lottery variable that should be used.</param> public CurrentSystemSetter(string title, char abbreviation, char[] uniqueChars, Lottery lotto) : base(title, abbreviation, uniqueChars, lotto) { this.Renderer = new OptionsConsoleRenderer(); }
/// <summary> /// Initializes a new instance of the <see cref="NumberSystemChanger"/> class. /// </summary> /// <param name="title">The title of the object.</param> /// <param name="abbreviation">The key to get the user to the objects execute method.</param> /// <param name="uniqueChars">The keys that are already used to prevent not being able to call the second mode with the same abbreviation.</param> /// <param name="lotto">The Lottery variable that should be used.</param> public NumberSystemChanger(string title, char abbreviation, char[] uniqueChars, Lottery lotto) : base(title, abbreviation, uniqueChars, lotto) // Constructor { this.Renderer = new OptionsConsoleRenderer(); }
/// <summary> /// Initializes a new instance of the <see cref="NumberSystemsMenu"/> class. /// </summary> /// <param name="title">The name/title of the Mode.</param> /// <param name="abbreviation">The specified key, the user has to press to get lead to this mode.</param> /// <param name="uniqueChars">The already used keys to prevent to not get to this mode.</param> /// <param name="lotto">The Lottery variable with all necessary classes this mode needs.</param>m> public NumberSystemsMenu(string title, char abbreviation, char[] uniqueChars, Lottery lotto) : base(title, abbreviation, uniqueChars, lotto) { this.Renderer = new DefaultConsoleRenderer(); }
/// <summary> /// Initializes a new instance of the <see cref="FrequencyDetermination"/> class. /// </summary> /// <param name="title">The name/title of the Mode.</param> /// <param name="abbreviation">The specified key, the user has to press to get lead to this mode.</param> /// <param name="uniqueChars">The already used keys to prevent to not get to this mode.</param> /// <param name="lotto">The Lottery variable with all necessary classes this mode needs.</param>m> public FrequencyDetermination(string title, char abbreviation, char[] uniqueChars, Lottery lotto) : base(title, abbreviation, uniqueChars, lotto) { }
/// <summary> /// Initializes a new instance of the <see cref="MainMenu"/> class. /// </summary> /// <param name="title">The title of the object.</param> /// <param name="abbreviation">The key to get the user to the objects execute method.</param> /// <param name="uniqueChars">The keys that are already used to prevent not being able to call the second mode with the same abbreviation.</param> /// <param name="lotto">The Lottery variable that should be used.</param> public MainMenu(string title, char abbreviation, char[] uniqueChars, Lottery lotto) : base(title, abbreviation, uniqueChars, lotto) // Constructor { }
/// <summary> /// Initializes a new instance of the <see cref="JackpotSimulation"/> class. /// </summary> /// <param name="title">The name/title of the Mode.</param> /// <param name="abbreviation">The specified key, the user has to press to get lead to this mode.</param> /// <param name="uniqueChars">The already used keys to prevent to not get to this mode.</param> /// <param name="lotto">The Lottery variable with all necessary classes this mode needs.</param>m> public JackpotSimulation(string title, char abbreviation, char[] uniqueChars, Lottery lotto) : base(title, abbreviation, uniqueChars, lotto) { }
/// <summary> /// Initializes a new instance of the <see cref="GraphicalTip"/> class. /// </summary> /// <param name="title">The name/title of the Mode.</param> /// <param name="abbreviation">The specified key, the user has to press to get lead to this mode.</param> /// <param name="uniqueChars">The already used keys to prevent to not get to this mode.</param> /// <param name="lotto">The Lottery variable with all necessary classes this mode needs.</param>m> public GraphicalTip(string title, char abbreviation, char[] uniqueChars, Lottery lotto) : base(title, abbreviation, uniqueChars, lotto) { }
/// <summary> /// Initializes a new instance of the <see cref="OptionsMenu"/> class. /// </summary> /// <param name="title">The title of the object.</param> /// <param name="abbreviation">The key to get the user to the objects execute method.</param> /// <param name="uniqueChars">The keys that are already used to prevent not being able to call the second mode with the same abbreviation.</param> /// <param name="lotto">The Lottery variable that should be used.</param> public OptionsMenu(string title, char abbreviation, char[] uniqueChars, Lottery lotto) : base(title, abbreviation, uniqueChars, lotto) // Constructor { this.Renderer = new DefaultConsoleRenderer(); }
/// <summary> /// Initializes a new instance of the <see cref="ErrorChecker"/> class. /// </summary> /// <param name="lotto">The used Lottery variable.</param> public ErrorChecker(Lottery lotto) { this.Lotto = lotto; }
/// <summary> /// Initializes a new instance of the <see cref="ApplicationExit"/> class. /// </summary> /// <param name="title">The name/title of the Mode.</param> /// <param name="abbreviation">The specified key, the user has to press to get lead to this mode.</param> /// <param name="uniqueChars">The already used keys to prevent to not get to this mode.</param> /// <param name="lotto">The Lottery variable with all necessary classes this mode needs.</param>m> public ApplicationExit(string title, char abbreviation, char[] uniqueChars, Lottery lotto) : base(title, abbreviation, uniqueChars, lotto) { }