-
Notifications
You must be signed in to change notification settings - Fork 45
/
MinuteDemo.cs
96 lines (83 loc) · 3.55 KB
/
MinuteDemo.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// -- FILE ------------------------------------------------------------------
// name : MinuteDemo.cs
// project : Itenso Time Period
// created : Jani Giannoudis - 2011.02.18
// language : C# 4.0
// environment: .NET 2.0
// copyright : (c) 2011-2012 by Itenso GmbH, Switzerland
// --------------------------------------------------------------------------
using Itenso.TimePeriod;
namespace Itenso.TimePeriodDemo
{
// ------------------------------------------------------------------------
public class MinuteDemo : TimePeriodDemo
{
// ----------------------------------------------------------------------
public static void ShowAll( int periodCount, int year, YearMonth month, int day, int hour, int minuteValue )
{
WriteLine( "Input: count={0}, year={1}, month={2}, day={3}, hour={4}, minute={5}", periodCount, year, month, day, hour, minuteValue );
WriteLine();
if ( periodCount == 1 )
{
Minute minute = new Minute( year, (int)month, day, hour, minuteValue );
Minute previousMinute = minute.GetPreviousMinute();
Minute nextMinute = minute.GetNextMinute();
ShowMinute( minute );
ShowCompactMinute( previousMinute, "Previous Minute" );
ShowCompactMinute( nextMinute, "Next Minute" );
WriteLine();
}
else
{
Minutes minutes = new Minutes( year, (int)month, day, hour, minuteValue, periodCount );
ShowMinutes( minutes );
WriteLine();
foreach ( Minute minute in minutes.GetMinutes() )
{
ShowCompactMinute( minute );
}
WriteLine();
}
} // ShowAll
// ----------------------------------------------------------------------
public static void ShowCompactMinute( Minute minute, string caption = "Minute" )
{
WriteLine( "{0}: {1}", caption, minute );
} // ShowCompactMinute
// ----------------------------------------------------------------------
public static void ShowMinute( Minute minute, string caption = "Minute" )
{
WriteLine( "{0}: {1}", caption, minute );
WriteIndentLine( "Year: {0}", minute.Year );
WriteIndentLine( "Month: {0}", minute.Month );
WriteIndentLine( "Day: {0}", minute.Day );
WriteIndentLine( "Hour: {0}", minute.Hour );
WriteIndentLine( "MinuteValue: {0}", minute.MinuteValue );
WriteLine();
} // ShowMinute
// ----------------------------------------------------------------------
public static void ShowCompactMinutes( Minutes minutes, string caption = "Minutes" )
{
WriteLine( "{0}: {1}", caption, minutes );
} // ShowCompactMinutes
// ----------------------------------------------------------------------
public static void ShowMinutes( Minutes minutes, string caption = "Minutes" )
{
WriteLine( "{0}: {1}", caption, minutes );
WriteIndentLine( "StartYear: {0}", minutes.StartYear );
WriteIndentLine( "StartMonth: {0}", minutes.StartMonth );
WriteIndentLine( "StartDay: {0}", minutes.StartDay );
WriteIndentLine( "StartHour: {0}", minutes.StartHour );
WriteIndentLine( "StartMinute: {0}", minutes.StartMinute );
WriteIndentLine( "EndYear: {0}", minutes.EndYear );
WriteIndentLine( "EndMonth: {0}", minutes.EndMonth );
WriteIndentLine( "EndDay: {0}", minutes.EndDay );
WriteIndentLine( "EndHour: {0}", minutes.EndHour );
WriteIndentLine( "EndMinute: {0}", minutes.EndMinute );
WriteIndentLine( "FirstMinuteStart: {0}", minutes.FirstMinuteStart );
WriteIndentLine( "LastMinuteStart: {0}", minutes.LastMinuteStart );
WriteLine();
} // ShowMinutes
} // class MinuteDemo
} // namespace Itenso.TimePeriodDemo
// -- EOF -------------------------------------------------------------------