private void chkAWD_CheckedChanged(object sender, EventArgs e) { CheckBox chkboxAWD = sender as CheckBox; const DrivetrainBits awd = DrivetrainBits.AWD; if (chkboxAWD.IsChecked.Value) { CurrentEvent.Regulations.DrivetrainNeeded |= awd; } else { CurrentEvent.Regulations.DrivetrainNeeded &= ~awd; } }
private void chkRR_CheckedChanged(object sender, EventArgs e) { CheckBox chkboxRR = sender as CheckBox; const DrivetrainBits rr = DrivetrainBits.RR; if (chkboxRR.IsChecked.Value) { CurrentEvent.Regulations.DrivetrainNeeded |= rr; } else { CurrentEvent.Regulations.DrivetrainNeeded &= ~rr; } }
private void chkFF_CheckedChanged(object sender, EventArgs e) { CheckBox chkboxFF = sender as CheckBox; const DrivetrainBits ff = DrivetrainBits.FF; if (chkboxFF.IsChecked.Value) { CurrentEvent.Regulations.DrivetrainNeeded |= ff; } else { CurrentEvent.Regulations.DrivetrainNeeded &= ~ff; } }
public void PopulateDrivetrains() { DrivetrainBits mask = CurrentEvent.Regulations.DrivetrainNeeded; if (mask == DrivetrainBits.None) { chkFF.IsChecked = false; chkFR.IsChecked = false; chkMR.IsChecked = false; chkAWD.IsChecked = false; chkRR.IsChecked = false; } else { chkFF.IsChecked = mask.HasFlag(DrivetrainBits.FF); chkFR.IsChecked = mask.HasFlag(DrivetrainBits.FR); chkMR.IsChecked = mask.HasFlag(DrivetrainBits.MR); chkAWD.IsChecked = mask.HasFlag(DrivetrainBits.AWD); chkRR.IsChecked = mask.HasFlag(DrivetrainBits.RR); } }