static void Main() { Console.CursorVisible = false; ListViewGenerator listViewGenerator = new ListViewGenerator(); FocusManager focusManager = new FocusManager(); List <ListView> listViews = listViewGenerator.GenerateListViews(DrivesList.GetDrivesPathes()); Console.WriteLine(Utils.CommandsInformation); foreach (ListView listView in listViews) { listView.Render(); } while (true) { try { var listViewtoUpdate = listViews.Find(i => i.Focused == true); while (listViewtoUpdate.Focused == true) { ConsoleKeyInfo key = Console.ReadKey(); if (key.Key == ConsoleKey.LeftArrow || key.Key == ConsoleKey.RightArrow) { listViews = focusManager.ChangeFocus(listViews, key); listViewtoUpdate.Update(key); } else { listViewtoUpdate.Update(key); } if (listViewtoUpdate.IsDrives != true) { listViewtoUpdate.Render(); } } } catch { ModalWindow modal = new ModalWindow(); modal.ShowModalWindow("THE EXCEPTION IS HERE"); Console.Clear(); Console.WriteLine(Utils.CommandsInformation); listViews = listViewGenerator.GenerateListViews(DrivesList.GetDrivesPathes()); foreach (ListView listView in listViews) { listView.Render(); } } } }
private void View_Drives(object sender, EventArgs eventArgs) { _listViews.Find(i => i.Focused == true).Focused = false; DrivesList drivers = new DrivesList(); ListView lv = new ListView(35, 10, drivers.GetDriversList()); lv.SetColumnsWidth(new List <int> { 35, 10, 10 }); lv.Select += View_Selected; lv.Focused = true; _listViews.Add(lv); foreach (ListView list in _listViews) { list.Render(); } }