-
Notifications
You must be signed in to change notification settings - Fork 0
/
Menu.cs
81 lines (74 loc) · 2.26 KB
/
Menu.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
using System;
using System.Threading;
namespace Cleaning
{
public class Menu
{
private const string ENG = "N-EN-";
private const string FCM = "N-FC-";
private const string RCM = "N-RC-";
private const string FEM = "N-FE-";
private const string CPM = "N-CP-";
private const string FAX = "N-FA-";
public static void InfoForUser()
{
Console.Clear();
Console.WriteLine("\n Choice one of possibilities");
Console.WriteLine("\n 1 2 3 4 5 6");
Console.WriteLine("ENG FCM RCM FEM CPM FAX");
Console.WriteLine("\n");
Console.Write("Your choice: ");
ProcessUser(Console.ReadLine());
}
private static void ProcessUser(string arg)
{
try
{
int numVal = Int32.Parse(arg);
if (numVal == 1)
{
Search.Expression = ENG;
}
else if (numVal == 2)
{
Search.Expression = FCM;
}
else if (numVal == 3)
{
Search.Expression = RCM;
}
else if (numVal == 4)
{
Search.Expression = FEM;
}
else if (numVal == 5)
{
Search.Expression = CPM;
}
else if (numVal == 6)
{
Search.Expression = FAX;
}
else if (numVal <= 0 | numVal >= 8)
{
Catch(arg);
}
}
catch (FormatException)
{
Catch(arg);
}
catch (OverflowException)
{
Catch(arg);
}
}
private static void Catch(string arg)
{
Console.WriteLine("\n Bad Format !!! ");
Console.Write(value: "\n TRY AGAIN");
Thread.Sleep(millisecondsTimeout: 1500);
InfoForUser();
}
}
}