private void FormTag_Load(object sender, EventArgs e) { textBoxName.Focus(); HelpMessage("This is where to configure a macro tag; special text that is replaced by an appropriate value (such as %time% is replaced with the current time)"); comboBoxType.Items.Clear(); comboBoxType.Items.Add("Screen Name"); comboBoxType.Items.Add("Screen Number"); comboBoxType.Items.Add("Image Format"); comboBoxType.Items.Add("Screen Capture Cycle Count"); comboBoxType.Items.Add("Active Window Title"); comboBoxType.Items.Add("Date/Time Format"); comboBoxType.Items.Add("User"); comboBoxType.Items.Add("Machine"); comboBoxType.Items.Add("Time of Day"); comboBoxType.Items.Add("Date/Time Format Expression"); if (TagObject != null) { Text = "Change Tag"; textBoxName.Text = TagObject.Name; textBoxDescription.Text = TagObject.Description; comboBoxType.SelectedIndex = (int)TagObject.Type; textBoxDateTimeFormatValue.Text = TagObject.DateTimeFormatValue; dateTimePickerMorningStart.Value = TagObject.TimeOfDayMorningStart; dateTimePickerMorningEnd.Value = TagObject.TimeOfDayMorningEnd; dateTimePickerAfternoonStart.Value = TagObject.TimeOfDayAfternoonStart; dateTimePickerAfternoonEnd.Value = TagObject.TimeOfDayAfternoonEnd; dateTimePickerEveningStart.Value = TagObject.TimeOfDayEveningStart; dateTimePickerEveningEnd.Value = TagObject.TimeOfDayEveningEnd; textBoxMorningValue.Text = TagObject.TimeOfDayMorningValue; textBoxAfternoonValue.Text = TagObject.TimeOfDayAfternoonValue; textBoxEveningValue.Text = TagObject.TimeOfDayEveningValue; checkBoxEveningExtendsToNextMorning.Checked = TagObject.EveningExtendsToNextMorning; checkBoxActive.Checked = TagObject.Active; textBoxNotes.Text = TagObject.Notes; } else { Text = "Add New Tag"; Tag tag = new Tag(); textBoxName.Text = "%tag" + (TagCollection.Count + 1) + "%"; textBoxDescription.Text = "Please provide a brief summary for the purpose of this macro tag"; comboBoxType.SelectedIndex = 0; textBoxDateTimeFormatValue.Text = tag.DateTimeFormatValue; dateTimePickerMorningStart.Value = tag.TimeOfDayMorningStart; dateTimePickerMorningEnd.Value = tag.TimeOfDayMorningEnd; dateTimePickerAfternoonStart.Value = tag.TimeOfDayAfternoonStart; dateTimePickerAfternoonEnd.Value = tag.TimeOfDayAfternoonEnd; dateTimePickerEveningStart.Value = tag.TimeOfDayEveningStart; dateTimePickerEveningEnd.Value = tag.TimeOfDayEveningEnd; textBoxMorningValue.Text = tag.TimeOfDayMorningValue; textBoxAfternoonValue.Text = tag.TimeOfDayAfternoonValue; textBoxEveningValue.Text = tag.TimeOfDayEveningValue; checkBoxEveningExtendsToNextMorning.Checked = tag.EveningExtendsToNextMorning; checkBoxActive.Checked = true; textBoxNotes.Text = string.Empty; } }
private void enabledStatus_Click(object sender, EventArgs e) { Label label = (Label)sender; if (label.Tag.GetType() == typeof(Region)) { Region region = (Region)label.Tag; if (region.Active) { region.Active = false; label.BackColor = Color.PaleVioletRed; } else { region.Active = true; label.BackColor = Color.PaleGreen; } formRegion.RegionCollection.SaveToXmlFile(); } if (label.Tag.GetType() == typeof(Schedule)) { Schedule schedule = (Schedule)label.Tag; if (schedule.Active) { schedule.Active = false; label.BackColor = Color.PaleVioletRed; } else { schedule.Active = true; label.BackColor = Color.PaleGreen; } formSchedule.ScheduleCollection.SaveToXmlFile(); } if (label.Tag.GetType() == typeof(Screen)) { Screen screen = (Screen)label.Tag; if (screen.Active) { screen.Active = false; label.BackColor = Color.PaleVioletRed; } else { screen.Active = true; label.BackColor = Color.PaleGreen; } formScreen.ScreenCollection.SaveToXmlFile(); } if (label.Tag.GetType() == typeof(Tag)) { Tag tag = (Tag)label.Tag; if (tag.Active) { tag.Active = false; label.BackColor = Color.PaleVioletRed; } else { tag.Active = true; label.BackColor = Color.PaleGreen; } formTag.TagCollection.SaveToXmlFile(); } if (label.Tag.GetType() == typeof(Trigger)) { Trigger trigger = (Trigger)label.Tag; if (trigger.Active) { trigger.Active = false; label.BackColor = Color.PaleVioletRed; } else { trigger.Active = true; label.BackColor = Color.PaleGreen; } formTrigger.TriggerCollection.SaveToXmlFile(); } }