-
Notifications
You must be signed in to change notification settings - Fork 17
/
Program.cs
62 lines (51 loc) · 1.15 KB
/
Program.cs
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
using rpi_ws281x;
using System;
using System.Collections.Generic;
using System.Drawing;
namespace TestApp
{
class Program
{
static void Main(string[] args)
{
var abort = new AbortRequest();
Console.CancelKeyPress += (s, e) =>
{
e.Cancel = true;
abort.IsAbortRequested = true;
};
var input = 0;
do
{
Console.Clear();
Console.WriteLine("What do you want to test:");
Console.WriteLine("Press CTRL + C to abort to current test.");
Console.WriteLine("0 - Exit");
Console.WriteLine("1 - Color wipe animation");
Console.WriteLine("2 - Rainbow color animation");
Console.Write("What is your choice: ");
input = Int32.Parse(Console.ReadLine());
var animation = GetAnimation(input);
if(animation != null)
{
abort.IsAbortRequested = false;
animation.Execute(abort);
}
} while (input != 0);
}
private static IAnimation GetAnimation(int code)
{
IAnimation result = null;
switch(code)
{
case 1:
result = new ColorWipe();
break;
case 2:
result = new RainbowColorAnimation();
break;
}
return result;
}
}
}