12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using Xamarin.Forms;
- using Xamarin.Forms.Xaml;
- using XF.Material.Forms.UI;
- namespace InABox.Mobile
- {
-
-
-
- [XamlCompilation(XamlCompilationOptions.Compile)]
- public partial class MobileModuleList
- {
- public IList<IModuleMenuItem> Items { get; }
-
- public event EventHandler BeforeTap;
- public event EventHandler AfterTap;
-
- public MobileModuleList()
- {
- Items = new ObservableCollection<IModuleMenuItem>();
- InitializeComponent();
- Modules.ItemsSource = Items;
- }
- private bool debounce = false;
- private async void Module_Clicked(object sender, EventArgs e)
- {
-
- if (debounce)
- return;
- debounce = true;
- BeforeTap?.Invoke(this,EventArgs.Empty);
- try
- {
- if (((sender as MobileCard)?.BindingContext is IModuleMenuItem module) && module.IsEnabled)
- module.Tap();
-
- }
- catch (Exception err)
- {
- MobileLogging.Log(err,"MobileToolGrid");
- }
- AfterTap?.Invoke(this, EventArgs.Empty);
- debounce = false;
- }
-
-
- }
- }
|