private static void DoubleBorderTextBoxScreen(ScreenCollection screens) { var screen = new Screen("Double Border Text Boxes"); var control1 = new TextBox(); control1.Left = 10; control1.Top = 0; control1.MaxLength = 6; control1.Width = control1.MaxLength + 2; control1.BorderStyle = BorderStyle.Double; var control2 = new TextBox(); control2.Left = 0; control2.Top = control1.Top + control1.Height; control2.Width = screen.Width; control2.BorderStyle = BorderStyle.Double; var control3 = new TextBox(); control3.Left = 0; control3.Top = control2.Top + control2.Height; control3.MaxLength = 20; control3.Width = control3.MaxLength; control3.BorderStyle = BorderStyle.Double; screen.Controls.Add(control1); screen.Controls.Add(control2); screen.Controls.Add(control3); screen.Footer.Text = screen.Name + ". Press escape."; screens.Add(screen); }
internal static void SetupMenu(ScreenCollection screens) { var screen = new Screen("Menus"); MenuBar menuBar = SetupMenuBar(screen); screen.Controls.Add(menuBar); screens.Add(screen); }
internal static void SetupMenu(ScreenCollection screens) { var screen = new Screen("Menus"); MenuBar menuBar = SetupMenuBar(screen); screen.Controls.Add(menuBar); screens.Add(screen); }
private static void ListBoxPopup(ScreenCollection screens) { var screen = new ConsoleUI.LoginScreen(); screen.Username = "******"; screen.Footer.Text = "Try admin admin."; screens.Add(screen); screen.Login += Screen_Login; }
private static void DoubleBorderListBoxScreen(ScreenCollection screens) { var screen = new Screen("Double Border List Boxes"); var control1 = new ListBox(); control1.Left = 0; control1.Top = 0; control1.Width = 20; control1.Height = 10; control1.BorderStyle = BorderStyle.Double; control1.HasShadow = true; for (int i = 0; i < 20; i++) { control1.Items.Add(string.Format("Item {0}", i + 1)); } var control2 = new ListBox(); control2.Left = 30; control2.Top = 0; control2.Width = 30; control2.Height = 15; control2.BorderStyle = BorderStyle.Double; control2.HasShadow = true; for (int i = 0; i < 40; i++) { control2.Items.Add(string.Format("Item {0}", i + 1)); } var control3 = new ListBox(); control3.Left = 0; control3.Top = 11; control3.Width = 25; control3.Height = 10; control3.BorderStyle = BorderStyle.Double; control3.HasShadow = true; for (int i = 0; i < 5; i++) { control3.Items.Add(string.Format("Item {0}", i + 1)); } screen.Controls.Add(control1); screen.Controls.Add(control2); screen.Controls.Add(control3); screen.Footer.Text = screen.Name + ". Press enter or escape."; screens.Add(screen); }
public bool RegisterScreen(Screen screen) { if (ScreenCollection.Count(ent => ent.ID == screen.ID) > 0) { return(false); } else { ScreenCollection.Add(screen); return(true); } }
private static void ListBoxPopup(ScreenCollection screens) { var screen = new ConsoleUI.LoginScreen(); screen.Username = "******"; screen.Footer.Text = "Try admin admin."; screens.Add(screen); screen.Login += Screen_Login; }
private static void BasicListBoxScreen(ScreenCollection screens) { var screen = new Screen("Basic List Boxes"); var control1 = new ListBox(); control1.Left = 0; control1.Top = 0; control1.Width = 20; control1.Height = 10; for (int i = 0; i < 20; i++) { control1.Items.Add(string.Format("Item {0}", i + 1)); } var control2 = new ListBox(); control2.Left = 30; control2.Top = 0; control2.Width = 30; control2.Height = 15; for (int i = 0; i < 40; i++) { control2.Items.Add(string.Format("Item {0}", i + 1)); } var control3 = new ListBox(); control3.Left = 0; control3.Top = 11; control3.Width = 25; control3.Height = 10; for (int i = 0; i < 5; i++) { control3.Items.Add(string.Format("Item {0}", i + 1)); } screen.Controls.Add(control1); screen.Controls.Add(control2); screen.Controls.Add(control3); screen.Footer.Text = screen.Name + ". Press enter or escape."; screens.Add(screen); }
private static void MultilineBasicTextBoxScreen(ScreenCollection screens) { var screen = new Screen("Multiline Basic Text Boxes"); var control1 = new TextBox(); control1.Left = 35; control1.Top = 0; control1.Width = control1.MaxLength; control1.TreatEnterKeyAsTab = false; control1.Height = 15; control1.Width = 50; control1.TextBoxType = TextBoxType.Multiline; control1.Text = "So if on advanced addition absolute received replying throwing he." + Environment.NewLine + Environment.NewLine + "Delighted consisted newspaper of unfeeling as neglected so." + Environment.NewLine + "Tell size come hard mrs and four fond are. Of in commanded earnestly resources it. At quitting in strictly up wandered of relation answered felicity. Side need at in what dear ever upon if. Same down want joy neat ask pain help she. Alone three stuff use law walls fat asked. Near do that he help."; control1.BorderStyle = BorderStyle.Double; var control2 = new TextBox(); control2.Left = 0; control2.Top = control1.Top + control1.Height + 1; control2.Width = screen.Width; control2.TextAlign = TextAlign.Center; control2.Height = 5; control2.Width = 20; control2.TextBoxType = TextBoxType.Multiline; control2.MaxLength = 150; var control3 = new TextBox(); control3.Left = 35; control3.Top = control2.Top; control3.Height = 20; control3.Width = 50; control3.TextBoxType = TextBoxType.Multiline; control3.Text = Properties.Resources.LongText; control3.BorderStyle = BorderStyle.Double; screen.Controls.Add(control1); screen.Controls.Add(control2); screen.Controls.Add(control3); screen.Footer.Text = screen.Name + ". Press escape."; screens.Add(screen); }
private static void ShadowDoubleBorderLabelScreen(ScreenCollection screens) { var screen = new Screen("Double Border Labels"); var control1 = new Label("This is a left aligned label (shadow, double border)."); control1.Left = 0; control1.Top = 0; control1.Width = screen.Width - 2; control1.BorderStyle = BorderStyle.Double; var control2 = new Label("This is a centered label (shadow, double border)."); control2.Left = 0; control2.Top = control1.Top + control1.Height + 2; control2.Width = screen.Width - 1; control2.TextAlign = TextAlign.Center; control2.BorderStyle = BorderStyle.Double; var control3 = new Label("This is a right aligned label (shadow, full width, double border)."); control3.Left = 0; control3.Top = control2.Top + control2.Height + 2; control3.Width = screen.Width; control3.TextAlign = TextAlign.Right; control3.BorderStyle = BorderStyle.Double; control1.HasShadow = true; control2.HasShadow = true; control3.HasShadow = true; screen.Controls.Add(control1); screen.Controls.Add(control2); screen.Controls.Add(control3); screen.Footer.Text = screen.Name + ". Press any key."; screens.Add(screen); screen.AfterPaint += (s, e) => { Console.ReadKey(true); }; }
private static void BasicTextBoxScreen(ScreenCollection screens) { var screen = new Screen("Basic Text Boxes"); var control1 = new TextBox(); control1.Left = 10; control1.Top = 0; control1.MaxLength = 5; control1.Width = control1.MaxLength; control1.TreatEnterKeyAsTab = false; var control2 = new TextBox(); control2.Left = 0; control2.Top = control1.Top + control1.Height; control2.Width = screen.Width; control2.TextAlign = TextAlign.Center; var control3 = new TextBox(); control3.Left = 0; control3.Top = control2.Top + control2.Height; control3.MaxLength = 20; control3.Width = control3.MaxLength; control3.TextBoxType = TextBoxType.Password; var control4 = new TextBox(); control4.Left = 0; control4.Top = control3.Top + control3.Height; control4.MaxLength = 20; control4.TextAlign = TextAlign.Right; screen.Controls.Add(control1); screen.Controls.Add(control2); screen.Controls.Add(control3); screen.Controls.Add(control4); screen.Footer.Text = screen.Name + ". Press escape."; screens.Add(screen); }
private static void BasicTextBoxScreen(ScreenCollection screens) { var screen = new Screen("Basic Text Boxes"); var control1 = new TextBox(); control1.Left = 10; control1.Top = 0; control1.MaxLength = 5; control1.Width = control1.MaxLength; control1.TreatEnterKeyAsTab = false; var control2 = new TextBox(); control2.Left = 0; control2.Top = control1.Top + control1.Height; control2.Width = screen.Width; control2.TextAlign = TextAlign.Center; var control3 = new TextBox(); control3.Left = 0; control3.Top = control2.Top + control2.Height; control3.MaxLength = 20; control3.Width = control3.MaxLength; control3.TextBoxType = TextBoxType.Password; var control4 = new TextBox(); control4.Left = 0; control4.Top = control3.Top + control3.Height; control4.MaxLength = 20; control4.TextAlign = TextAlign.Right; screen.Controls.Add(control1); screen.Controls.Add(control2); screen.Controls.Add(control3); screen.Controls.Add(control4); screen.Footer.Text = screen.Name + ". Press escape."; screens.Add(screen); }
private static void DoubleBorderLabelScreen(ScreenCollection screens) { var screen = new Screen("Double Border Labels"); var control1 = new Label("This is a left aligned label (full width, double border)."); control1.Left = 0; control1.Top = 0; control1.Width = screen.Width; control1.BorderStyle = BorderStyle.Double; var control2 = new Label("This is a centered label (full width, double border)."); control2.Left = 0; control2.Top = control1.Top + control1.Height; control2.Width = screen.Width; control2.TextAlign = TextAlign.Center; control2.BorderStyle = BorderStyle.Double; var control3 = new Label("This is a right aligned label (full width, double border)."); control3.Left = 0; control3.Top = control2.Top + control2.Height; control3.Width = screen.Width; control3.TextAlign = TextAlign.Right; control3.BorderStyle = BorderStyle.Double; screen.Controls.Add(control1); screen.Controls.Add(control2); screen.Controls.Add(control3); screen.Footer.Text = screen.Name + ". Press any key."; screens.Add(screen); screen.AfterPaint += (s, e) => { Console.ReadKey(true); }; }
internal static void SetupLoadingScreen(ScreenCollection screens) { // initialise a new instance of the helper loading screen var screen = new ConsoleUI.LoadingScreen("Loading Screen"); // set the message text screen.Message = "Doing some work, please wait"; // each screen has a footer that can display text screen.Footer.Text = "Working..."; // add the screen to the screens collection screens.Add(screen); // there are no controls in the screen that can have the focus so // sleep for a bit before exiting. screen.Shown += (s, e) => { System.Threading.Thread.Sleep(3000); (s as Screen).Exit(); }; }
internal static void SetupLoadingScreen(ScreenCollection screens) { // initialise a new instance of the helper loading screen var screen = new ConsoleUI.LoadingScreen("Loading Screen"); // set the message text screen.Message = "Doing some work, please wait"; // each screen has a footer that can display text screen.Footer.Text = "Working..."; // add the screen to the screens collection screens.Add(screen); // there are no controls in the screen that can have the focus so // sleep for a bit before exiting. screen.Shown += (s, e) => { System.Threading.Thread.Sleep(3000); (s as Screen).Exit(); }; }
private static void LabelScreen(ScreenCollection screens) { var screen = new Screen("Basic Labels"); var control1 = new Label("This is a left aligned label (full width, no border)."); control1.Left = 0; control1.Top = 0; control1.Width = screen.Width; var control2 = new Label("This is a centered label (full width, no border)."); control2.Left = 0; control2.Top = control1.Top + control1.Height; control2.Width = screen.Width; control2.TextAlign = TextAlign.Center; var control3 = new Label("This is a right aligned label (full width, no border)."); control3.Left = 0; control3.Top = control2.Top + control2.Height; control3.Width = screen.Width; control3.TextAlign = TextAlign.Right; screen.Controls.Add(control1); screen.Controls.Add(control2); screen.Controls.Add(control3); screen.Footer.Text = screen.Name + ". Press any key."; screens.Add(screen); screen.AfterPaint += (s, e) => { Console.ReadKey(true); }; }
private static void MultilineBasicTextBoxScreen(ScreenCollection screens) { var screen = new Screen("Multiline Basic Text Boxes"); var control1 = new TextBox(); control1.Left = 35; control1.Top = 0; control1.Width = control1.MaxLength; control1.TreatEnterKeyAsTab = false; control1.Height = 15; control1.Width = 50; control1.TextBoxType = TextBoxType.Multiline; control1.Text = "So if on advanced addition absolute received replying throwing he." + Environment.NewLine + Environment.NewLine + "Delighted consisted newspaper of unfeeling as neglected so." + Environment.NewLine + "Tell size come hard mrs and four fond are. Of in commanded earnestly resources it. At quitting in strictly up wandered of relation answered felicity. Side need at in what dear ever upon if. Same down want joy neat ask pain help she. Alone three stuff use law walls fat asked. Near do that he help."; control1.BorderStyle = BorderStyle.Double; var control2 = new TextBox(); control2.Left = 0; control2.Top = control1.Top + control1.Height + 1; control2.Width = screen.Width; control2.TextAlign = TextAlign.Center; control2.Height = 5; control2.Width = 20; control2.TextBoxType = TextBoxType.Multiline; control2.MaxLength = 150; var control3 = new TextBox(); control3.Left = 35; control3.Top = control2.Top ; control3.Height = 20; control3.Width = 50; control3.TextBoxType = TextBoxType.Multiline; control3.Text = Properties.Resources.LongText; control3.BorderStyle = BorderStyle.Double; screen.Controls.Add(control1); screen.Controls.Add(control2); screen.Controls.Add(control3); screen.Footer.Text = screen.Name + ". Press escape."; screens.Add(screen); }
private static void ShadowLabelScreen(ScreenCollection screens) { var screen = new Screen("Basic Labels"); var control1 = new Label("This is a left aligned label (shadow, no border)."); control1.Left = 0; control1.Top = 0; control1.Width = screen.Width - 2; var control2 = new Label("This is a centered label (shadow, no border)."); control2.Left = 0; control2.Top = control1.Top + control1.Height + 2; control2.Width = screen.Width - 1; control2.TextAlign = TextAlign.Center; var control3 = new Label("This is a right aligned label (shadow, full width, no border)."); control3.Left = 0; control3.Top = control2.Top + control2.Height + 2; control3.Width = screen.Width; control3.TextAlign = TextAlign.Right; control1.HasShadow = true; control2.HasShadow = true; control3.HasShadow = true; screen.Controls.Add(control1); screen.Controls.Add(control2); screen.Controls.Add(control3); screen.Footer.Text = screen.Name + ". Press any key."; screens.Add(screen); screen.AfterPaint += (s, e) => { Console.ReadKey(true); }; }
private static void TestProgressBars(ScreenCollection screens) { var screen = new Screen("Progress Bars - No Border"); var control1 = new ProgressBar(); control1.Left = 0; control1.Top = 0; control1.Width = 20; control1.BlockColor = ConsoleColor.Yellow; screen.Controls.Add(control1); var control2 = new ProgressBar(); control2.Left = 20; control2.Top = 10; control2.Width = 5; control2.BorderStyle = BorderStyle.Single; screen.Controls.Add(control2); var control3 = new ProgressBar(); control3.Left = 35; control3.Top = 20; control3.Width = 30; control3.BorderStyle = BorderStyle.Double; control3.BlockColor = ConsoleColor.Red; control3.HasShadow = true; screen.Controls.Add(control3); var control4 = new ProgressBar(); control4.Left = 0; control4.Top = 15; control4.Width = 30; control4.BorderStyle = BorderStyle.Double; control4.BlockColor = ConsoleColor.Green; control4.HasShadow = true; control4.ProgressBarStyle = ProgressBarStyle.Marquee; screen.Controls.Add(control4); screen.Footer.Text = screen.Name + ". Press any key."; screens.Add(screen); screen.Shown += (s, e) => { while (control1.Value < control1.Maximum) { Console.ReadKey(true); control1.Increment(10); control2.Increment(10); control3.Increment(10); screen.Footer.Text = string.Format("Value: {0}", control1.Value); } }; }
private static void ListBoxPopup(ScreenCollection screens) { var screen = new Screen("List Box Pop Up"); MenuBar menuBar = Menus.SetupMenuBar(screen); var control1 = new ListBox(); control1.Left = 0; control1.Top = 1; control1.Width = screen.Width; control1.Height = screen.Height - 2; control1.BorderStyle = BorderStyle.Double; for (int i = 0; i < 150; i++) { control1.Items.Add(string.Format("Item {0} - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua", i + 1)); } screen.Controls.Add(control1); var textBox = new TextBox(); textBox.BorderStyle = BorderStyle.Double; textBox.Width = 8; textBox.Left = (screen.Width / 2) - (textBox.Width / 2); textBox.Top = (screen.Height / 2) - (textBox.Height / 2); textBox.MaxLength = 6; textBox.BackgroundColor = System.ConsoleColor.DarkGreen; textBox.FocusBackgroundColor = System.ConsoleColor.DarkGreen; textBox.Visible = false; textBox.TreatEnterKeyAsTab = false; textBox.HasShadow = true; screen.Controls.Add(textBox); screen.Footer.Text = screen.Name + ". Press C to popup a text box, enter or escape."; screen.Controls.Add(menuBar); screens.Add(screen); control1.KeyPressed += (s, e) => { if (e.Info.Key == System.ConsoleKey.C) { textBox.Visible = true; textBox.Focus(); e.Handled = true; } }; control1.Selected += (s, e) => { screen.Footer.Text = control1.SelectedItem; }; textBox.TextChanged += (s, e) => { screen.Footer.Text = string.Format("{0} => {1}", e.OrignalText ?? string.Empty, e.NewText); }; textBox.Leave += (s, e) => { //textBox.Visible = false; }; control1.Enter += (s, e) => { textBox.Visible = false; }; }
public void adding_a_screen_adds_a_storyteller_tab_item_with_that_screen() { screens.Add(screen1); tabs.Items[0].Screen().ShouldBeTheSameAs(screen1); }
private static void ListBoxPopup(ScreenCollection screens) { var screen = new Screen("List Box Pop Up"); MenuBar menuBar = Menus.SetupMenuBar(screen); var control1 = new ListBox(); control1.Left = 0; control1.Top = 1; control1.Width = screen.Width; control1.Height = screen.Height - 2; control1.BorderStyle = BorderStyle.Double; for (int i = 0; i < 150; i++) { control1.Items.Add(string.Format("Item {0} - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua", i + 1)); } screen.Controls.Add(control1); var textBox = new TextBox(); textBox.BorderStyle = BorderStyle.Double; textBox.Width = 8; textBox.Left = (screen.Width / 2) - (textBox.Width / 2); textBox.Top = (screen.Height / 2) - (textBox.Height / 2); textBox.MaxLength = 6; textBox.BackgroundColor = System.ConsoleColor.DarkGreen; textBox.FocusBackgroundColor = System.ConsoleColor.DarkGreen; textBox.Visible = false; textBox.TreatEnterKeyAsTab = false; textBox.HasShadow = true; screen.Controls.Add(textBox); screen.Footer.Text = screen.Name + ". Press C to popup a text box, enter or escape."; screen.Controls.Add(menuBar); screens.Add(screen); control1.KeyPressed += (s, e) => { if (e.Info.Key == System.ConsoleKey.C) { textBox.Visible = true; textBox.Focus(); e.Handled = true; } }; control1.Selected += (s, e) => { screen.Footer.Text = control1.SelectedItem; }; textBox.TextChanged += (s, e) => { screen.Footer.Text = string.Format("{0} => {1}", e.OrignalText ?? string.Empty, e.NewText); }; textBox.Leave += (s, e) => { //textBox.Visible = false; }; control1.Enter += (s, e) => { textBox.Visible = false; }; }
private static void DoubleBorderTextBoxScreen(ScreenCollection screens) { var screen = new Screen("Double Border Text Boxes"); var control1 = new TextBox(); control1.Left = 10; control1.Top = 0; control1.MaxLength = 6; control1.Width = control1.MaxLength + 2; control1.BorderStyle = BorderStyle.Double; var control2 = new TextBox(); control2.Left = 0; control2.Top = control1.Top + control1.Height; control2.Width = screen.Width; control2.BorderStyle = BorderStyle.Double; var control3 = new TextBox(); control3.Left = 0; control3.Top = control2.Top + control2.Height; control3.MaxLength = 20; control3.Width = control3.MaxLength; control3.BorderStyle = BorderStyle.Double; screen.Controls.Add(control1); screen.Controls.Add(control2); screen.Controls.Add(control3); screen.Footer.Text = screen.Name + ". Press escape."; screens.Add(screen); }
private static void TestProgressBars(ScreenCollection screens) { var screen = new Screen("Progress Bars - No Border"); var control1 = new ProgressBar(); control1.Left = 0; control1.Top = 0; control1.Width = 20; control1.BlockColor = ConsoleColor.Yellow; screen.Controls.Add(control1); var control2 = new ProgressBar(); control2.Left = 20; control2.Top = 10; control2.Width = 5; control2.BorderStyle = BorderStyle.Single; screen.Controls.Add(control2); var control3 = new ProgressBar(); control3.Left = 35; control3.Top = 20; control3.Width = 30; control3.BorderStyle = BorderStyle.Double; control3.BlockColor = ConsoleColor.Red; control3.HasShadow = true; screen.Controls.Add(control3); var control4 = new ProgressBar(); control4.Left = 0; control4.Top = 15; control4.Width = 30; control4.BorderStyle = BorderStyle.Double; control4.BlockColor = ConsoleColor.Green; control4.HasShadow = true; control4.ProgressBarStyle = ProgressBarStyle.Marquee; screen.Controls.Add(control4); screen.Footer.Text = screen.Name + ". Press any key."; screens.Add(screen); screen.Shown += (s, e) => { while (control1.Value < control1.Maximum) { Console.ReadKey(true); control1.Increment(10); control2.Increment(10); control3.Increment(10); screen.Footer.Text = string.Format("Value: {0}", control1.Value); } }; }