-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExampleWindow.cs
More file actions
67 lines (58 loc) · 2.15 KB
/
ExampleWindow.cs
File metadata and controls
67 lines (58 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Created by Ron 'Maxwolf' McDowell ([email protected])
// Timestamp 01/07/2016@7:31 PM
using System;
using System.Text;
using WolfCurses.Example.CustomInput;
using WolfCurses.Example.Prompt;
using WolfCurses.Example.Question;
using WolfCurses.Window;
namespace WolfCurses.Example
{
/// <summary>
/// Example window implementation that is attached to wolf curses list of active windows during runtime.
/// </summary>
public sealed class ExampleWindow : Window<ExampleCommands, ExampleWindowInfo>
{
/// <summary>
/// Initializes a new instance of the <see cref="Window{TCommands,TData}" /> class.
/// </summary>
/// <param name="simUnit">Core simulation which is controlling the form factory.</param>
// ReSharper disable once UnusedMember.Global
public ExampleWindow(SimulationApp simUnit) : base(simUnit)
{
}
/// <summary>
/// Called after the Windows has been added to list of modes and made active.
/// </summary>
public override void OnWindowPostCreate()
{
base.OnWindowPostCreate();
var headerText = new StringBuilder();
headerText.Append(
$"{Environment.NewLine}Example Console Application{Environment.NewLine}{Environment.NewLine}");
headerText.AppendLine("Example UserData: " + UserData.ExampleUserData);
headerText.Append("You may:");
MenuHeader = headerText.ToString();
AddCommand(TextPrompt, ExampleCommands.TextPrompt);
AddCommand(YesNoPrompt, ExampleCommands.YesNoPrompt);
AddCommand(CustomPrompt, ExampleCommands.CustomPrompt);
AddCommand(CloseSimulation, ExampleCommands.CloseSimulation);
}
private void CloseSimulation()
{
Program.Destroy();
}
private void CustomPrompt()
{
SetForm(typeof (DialogCustomInput));
}
private void YesNoPrompt()
{
SetForm(typeof (QuestionDialog));
}
private void TextPrompt()
{
SetForm(typeof (DialogPrompt));
}
}
}