2 using System.Collections.Generic;
3 using System.ComponentModel;
8 using System.Threading.Tasks;
41 int num = (int)Math.Ceiling(end.Subtract(start).TotalHours);
42 checkbox =
new List<CheckBox>();
44 if (loc_mac is
MachineCB) { m = (MachineCB) loc_mac; }
45 if (loc_mac is
LocationCB) { l = (LocationCB) loc_mac; }
46 label1.Text = loc_mac.Text;
48 for (
int i = 0; i < 24; i++)
51 tableLayoutPanel1.Controls.Add(
new Label { Text = i +
":00 - " + (i+1) +
":00" }, 0, i+1);
55 int row = start.Hour+1;
56 for (
int i = 0; i<num; i++)
58 CheckBox c =
new CheckBox() { Text =
"" };
59 if (loc_mac is MachineCB)
61 if (m.
stateOfTimeslot(checkbox.Count)) { c.CheckState = CheckState.Checked; }
62 else { c.CheckState = CheckState.Unchecked; }
67 if (loc_mac is LocationCB)
69 if (l.
stateOfTimeslot(checkbox.Count)) { c.CheckState = CheckState.Checked; }
70 else { c.CheckState = CheckState.Unchecked; }
75 tableLayoutPanel1.Controls.Add(checkbox[i], column, row);
88 DayOfWeek day = start.DayOfWeek;
89 for (
int i = 0; i < column; i++)
92 var culture =
new System.Globalization.CultureInfo(
"de-DE");
93 tableLayoutPanel1.Controls.Add(
new Label { Text = culture.DateTimeFormat.GetDayName(day) }, i + 1, 0);
95 if (day.Equals(DayOfWeek.Saturday))
97 day = DayOfWeek.Sunday;
130 CheckBox c = (CheckBox)sender;
144 CheckBox c = (CheckBox)sender;
bool stateOfTimeslot(int t)
Get the availability of this machine at timeslot t.
TimeslotDialog(CheckBox loc_mac, DateTime start, DateTime end)
The Constructor.
MachineCB m
Machine for which the timeslots appears.
LocationCB l
Location for which the timeslots appears.
void locationCheckboxClicked(object sender, EventArgs e)
Eventhandler that is called when the state of a location CheckBox has changed.
Dialog that lets users choose which timeslots are available.
A wrapper class for locations.
void button1_Click(object sender, EventArgs e)
Eventhandler that is called when the "Close" button is clicked.
void machineCheckboxClicked(object sender, EventArgs e)
Eventhandler that is called when the state of a machine CheckBox has changed.
void changeStateOfTimeslot(int t)
Change the availability of this machine at timeslot t.
void changeStateOfTimeslot(int t)
Change the availability of this location at timeslot t.
A wrapper class for machines.
bool stateOfTimeslot(int t)
Get the availability of this location at timeslot t.
List< CheckBox > checkbox
List of checkboxes that represent the timeslots.
void InitializeComponent()
Required method for Designer support - do not modify the contents of this method with the code editor...