private void button4_Click(object sender, EventArgs e) { if (Program.current_settings.option.HasFlag(Program.set_opt_enum.ChangeSettings) || current_change) { Program.set_opt_enum opt = new Program.set_opt_enum(); if (checkBox1.Checked) { opt |= Program.set_opt_enum.Animation; } if (checkBox2.Checked) { opt |= Program.set_opt_enum.ShowFirstWindow; } if (checkBox3.Checked) { opt |= Program.set_opt_enum.ShowSecondWindow; } if (checkBox4.Checked) { opt |= Program.set_opt_enum.ShowWaitInFitst; } if (checkBox5.Checked) { opt |= Program.set_opt_enum.ShowWaitInSecond; } if (checkBox6.Checked) { opt |= Program.set_opt_enum.AnswerMouse; } if (checkBox7.Checked) { opt |= Program.set_opt_enum.AnswerKeyboard; } if (current_change) { if (change_settings) { opt |= Program.set_opt_enum.ChangeSettings; } } else { opt |= Program.set_opt_enum.ChangeSettings; } Program.current_settings = new Program.set_entry((byte)varH.Value, (byte)varM.Value, (ushort)varL.Value, opt); rt_del(true); } }
bool Option_compare(Program.set_opt_enum a, Program.set_opt_enum b) { a |= Program.set_opt_enum.ChangeSettings; b |= Program.set_opt_enum.ChangeSettings; return(a == b); }
private void button2_Click(object sender, EventArgs e) { if (Program.current_settings.option.HasFlag(Program.set_opt_enum.ChangeSettings) || current_change) { if (MessageBox.Show("Вы уверены, что хотите выполнить это действие?", "Сообщение", MessageBoxButtons.YesNo) == DialogResult.No) { return; } Program.set_opt_enum opt = new Program.set_opt_enum(); for (byte i = 0; i < Program.settings.Count; i++) { if (Program.settings[i].hour == varH.Value && Program.settings[i].minute == varM.Value) { Program.settings[i].len = (ushort)varL.Value; if (checkBox1.Checked) { opt |= Program.set_opt_enum.Animation; } if (checkBox2.Checked) { opt |= Program.set_opt_enum.ShowFirstWindow; } if (checkBox3.Checked) { opt |= Program.set_opt_enum.ShowSecondWindow; } if (checkBox4.Checked) { opt |= Program.set_opt_enum.ShowWaitInFitst; } if (checkBox5.Checked) { opt |= Program.set_opt_enum.ShowWaitInSecond; } if (checkBox6.Checked) { opt |= Program.set_opt_enum.AnswerMouse; } if (checkBox7.Checked) { opt |= Program.set_opt_enum.AnswerKeyboard; } if (current_change) { if (change_settings) { opt |= Program.set_opt_enum.ChangeSettings; } } else if (Program.settings[i].option.HasFlag(Program.set_opt_enum.ChangeSettings) != change_settings) { if (Program.settings[i].option.HasFlag(Program.set_opt_enum.ChangeSettings)) { opt |= Program.set_opt_enum.ChangeSettings; } } Program.settings[i].option = opt; listBox1.SelectedIndex = Get_LB_by_List_index(i); rt_del(false); Write_reg(); return; } } if (Program.settings.Count == 255) { MessageBox.Show("Невозможно добавить ещё одну запись!", "Ошибка", MessageBoxButtons.OK); return; } ; if (checkBox1.Checked) { opt |= Program.set_opt_enum.Animation; } if (checkBox2.Checked) { opt |= Program.set_opt_enum.ShowFirstWindow; } if (checkBox3.Checked) { opt |= Program.set_opt_enum.ShowSecondWindow; } if (checkBox4.Checked) { opt |= Program.set_opt_enum.ShowWaitInFitst; } if (checkBox5.Checked) { opt |= Program.set_opt_enum.ShowWaitInSecond; } if (checkBox6.Checked) { opt |= Program.set_opt_enum.AnswerMouse; } if (checkBox7.Checked) { opt |= Program.set_opt_enum.AnswerKeyboard; } if (current_change) { if (change_settings) { opt |= Program.set_opt_enum.ChangeSettings; } } else { opt |= Program.set_opt_enum.ChangeSettings; } Program.settings.Add(new Program.set_entry((byte)varH.Value, (byte)varM.Value, (ushort)varL.Value, opt)); rt_del(false); Write_reg(); Renov_listbox(); listBox1.SelectedIndex = Get_LB_by_List_index((byte)(Program.settings.Count - 1)); } }