Guest User

Untitled

a guest
Jan 16th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. Bit 0 - 1: Contrast (0=Low / 1 = Medium / 2=high)
  2.  
  3. Bit 2 - 3: Speech volume (0=Low / 1 = Medium / 2 = High)
  4.  
  5. Bit 4 – 5: Buzzer volume (0=Low / 1 = Medium / 2 = High)
  6.  
  7. Bit 6: Entry/exit indication
  8.  
  9. [Flags]
  10. public enum RKP
  11. {
  12. Contrast0 = 1, // bit 0
  13. Contrast1 = 2, // bit 1
  14. SpeechVolume2 = 4, // bit 2
  15. SpeechVolume3 = 8, // bit 3
  16. BuzzerVolume4 = 16, // bit 4
  17. BuzzerVolume5 = 32, // bit 5
  18. EntryExitIndication = 64, // bit 6
  19. }
  20.  
  21. [Flags]
  22. public enum RKP
  23. {
  24. LowContrast = 0,
  25. MediumContrast = 1, // bit 0
  26. HighContrast = 2, // bit 1
  27.  
  28. LowSpeechVolume = 0,
  29. MediumSpeechVolume = 4, // bit 2
  30. HighSpeechVolume = 8, // bit 3
  31.  
  32. LowBuzzerVolume = 0,
  33. MediumBuzzerVolume = 16, // bit 4
  34. HighBuzzerVolume = 32, // bit 5
  35.  
  36. ExitIndication = 0,
  37. EntryIndication = 64, // bit 6
  38. }
  39.  
  40. contrastComboBox.ItemsSource = new[] { RKP.LowContrast, RKP.MediumContrast, RKP.HighContrast };
  41. contrastComboBox.SelectedItem = currentValue & (RKP.MediumContrast | RKP.HighContrast);
  42. //and so on for each combo box...
  43.  
  44. //and when you want the result:
  45. RKP combinedFlag = (RKP)contrastComboBox.SelectedItem | //other combo box items
Add Comment
Please, Sign In to add comment