MobileModuleList.xaml.cs 817 B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using Xamarin.Forms.Xaml;
  5. using XF.Material.Forms.UI;
  6. namespace InABox.Mobile
  7. {
  8. [XamlCompilation(XamlCompilationOptions.Compile)]
  9. public partial class MobileModuleList
  10. {
  11. public IList<IModuleMenuItem> Items { get; }
  12. public MobileModuleList()
  13. {
  14. Items = new ObservableCollection<IModuleMenuItem>();
  15. InitializeComponent();
  16. Modules.ItemsSource = Items;
  17. }
  18. private void Module_Clicked(object sender, EventArgs e)
  19. {
  20. if (sender is MobileCard card)
  21. {
  22. if ((card.BindingContext is IModuleMenuItem module) && module.IsEnabled)
  23. module.Tap();
  24. }
  25. }
  26. }
  27. }