private void btnUpgrade_Click(object sender, EventArgs e) { V2.ActiveDays flags = V2.ActiveDays.None; byte startTime = 0; byte endTime = 0; if (chkMonday.Checked) { flags |= V2.ActiveDays.Monday; } if (chkTuesday.Checked) { flags |= V2.ActiveDays.Tuesday; } if (chkWednesday.Checked) { flags |= V2.ActiveDays.Wednesday; } if (chkThursday.Checked) { flags |= V2.ActiveDays.Thursday; } if (chkFriday.Checked) { flags |= V2.ActiveDays.Friday; } if (chkSaturday.Checked) { flags |= V2.ActiveDays.Saturday; } if (chkSunday.Checked) { flags |= V2.ActiveDays.Sunday; } startTime = (byte)nudFrom.Value; endTime = (byte)nudTo.Value; var m = new V3.ActiveMatrix(); m.Set(flags, startTime, endTime); activeMatrix2.LoadMatrix(m); }
public V3.ActiveMatrix GetMatrix() { var matrix = new V3.ActiveMatrix(); matrix.Reset(false); for (int day = 0; day < 7; day++) { for (int hour = 0; hour < 24; hour++) { var checkBox = (CheckBox)tableLayoutPanel1.GetControlFromPosition(hour + 1, day + 1); if (checkBox != null && checkBox.Checked) { var dateTime = new DateTime(2016, 10, 24).AddDays(day).AddHours(hour); matrix.SetRange(dateTime, new TimeSpan(1, 0, 0), true); } } } return(matrix); }
public void LoadMatrix(V3.ActiveMatrix matrix) { Reset(true); if (matrix == null) { return; } for (int day = 0; day < 7; day++) { for (int hour = 0; hour < 24; hour++) { var dateTime = new DateTime(2016, 10, 24).AddDays(day).AddHours(hour); var checkBox = (CheckBox)tableLayoutPanel1.GetControlFromPosition(hour + 1, day + 1); var active = matrix.Get(dateTime); if (checkBox != null) { checkBox.Checked = active; } } } }