private void SetBackground() { Console.Clear(); Header.Show(); List <string> colorSelection = new List <string>(); Console.WriteLine("All the background colors"); foreach (var color in colors) { if (color == currentForeground) { colorSelection.Add($" The background color is {color}"); continue; } Console.BackgroundColor = color; colorSelection.Add($" The background color is {color}"); Console.WriteLine(" The background color is {0}.", color); } Console.WriteLine(); Console.WriteLine("Enter - choose color"); Console.Read(); MenuRender mr = new MenuRender(new Menu(colorSelection)); int pos = mr.SelectMenu(); if (pos != -1) { AcceptBackground(pos); } Console.Read(); }
public void Start() { Menu menu = new Menu(new List <string> { "Set foreground color", "Set background color" }); MenuRender mr = new MenuRender(menu); int pos = 0; do { Header.Show(); pos = mr.SelectMenu(); switch (pos) { case 0: SetForeground(); break; case 1: SetBackground(); break; } if (pos == -1) { break; } } while (pos != -1); Console.WriteLine("exit"); }
public void Start() { var itemMenu = Deserializator.DeserialMenu(); Deserializator.DeserialColors(); MenuRender mr = new MenuRender(new Menu()); int numRow = 0; do { numRow = mr.SelectMenu(typeMenu.ICON); if (numRow == -1) { break; } try { var instance = Factory.CreateInstance(itemMenu[numRow].AssemblyName, itemMenu[numRow].TypeName); Type type = instance.GetType(); MethodInfo method = type.GetMethod(itemMenu[numRow].MethodToCall); method.Invoke(instance, null); } catch (Exception ex) { Console.WriteLine(ex.Message); } #region not_finished if (numRow != -1) { Console.WriteLine(itemMenu[numRow].MethodToCall); } if (numRow == 8) { Header.Show(); Settings settings = new Settings(); settings.Start(); } Thread.Sleep(200); Console.Read(); #endregion } while (numRow != -1); Serializator.SerializSettings(SaveColor()); }