private void ChangeFocus(FocusedPanel newFocusedPanel) { focusedPanel = newFocusedPanel; switch (focusedPanel) { case FocusedPanel.Exercise: exercisePanel.Visibility = System.Windows.Visibility.Visible; trainPanel.Visibility = System.Windows.Visibility.Hidden; testPanel.Visibility = System.Windows.Visibility.Hidden; break; case FocusedPanel.Train: exercisePanel.Visibility = System.Windows.Visibility.Hidden; trainPanel.Visibility = System.Windows.Visibility.Visible; testPanel.Visibility = System.Windows.Visibility.Hidden; break; case FocusedPanel.Test: exercisePanel.Visibility = System.Windows.Visibility.Hidden; trainPanel.Visibility = System.Windows.Visibility.Hidden; testPanel.Visibility = System.Windows.Visibility.Visible; break; case FocusedPanel.Main: break; } }
public void Update(ConsoleKeyInfo key) { switch (key.Key) { case ConsoleKey.UpArrow: case ConsoleKey.DownArrow: if (Modal == null) { FocusedPanel.Update(key); } else { Modal.ListView.Update(key); Modal.ListView.Render(); } break; case ConsoleKey.Enter: if (Modal == null) { goto default; } else { FileSystemInfo fileSystemInfo = Modal.ListView.SelectedItem.Item; if (fileSystemInfo is FileInfo file) { Process.Start(file.FullName); FocusedPanel.Current = new DirectoryInfo(Path.GetPathRoot(fileSystemInfo.FullName)); } else { FocusedPanel.Current = new DirectoryInfo(fileSystemInfo.FullName); } Modal = null; RefreshScreen(); } break; case ConsoleKey.Escape: if (Modal != null) { Modal = null; RefreshScreen(); } break; default: ActionPerformerArgs args = new ActionPerformerArgs(key, this); ActionPerformer = ActionPerformer.GetActionPerformer(args); ActionPerformer.Do(args); break; } }