AlertSelection.razor.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using CronAlarm.Config;
  2. using Microsoft.AspNetCore.Components;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Threading.Tasks;
  7. namespace CronAlarm.Pages
  8. {
  9. public partial class AlertSelection : IComponent
  10. {
  11. [Inject]
  12. private AlertConfig Config { get; set; }
  13. private IDictionary<string, int> SelectedOptions { get; set; } = new Dictionary<string, int>();
  14. public AlertSelection()
  15. {
  16. SelectedOptions["Weekdays"] = 1;
  17. }
  18. private void ToggleOption(string group, int index)
  19. {
  20. if (SelectedOptions.ContainsKey(group) && SelectedOptions[group] == index)
  21. {
  22. // set to "unselected"
  23. index = -1;
  24. }
  25. SelectedOptions[group] = index;
  26. }
  27. private string ActiveClass(string group, int index)
  28. {
  29. return SelectedOptions.ContainsKey(group) && SelectedOptions[group] == index ? "active" : string.Empty;
  30. }
  31. private void Save()
  32. {
  33. //this.
  34. }
  35. private void Reset()
  36. {
  37. }
  38. }
  39. }