12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using System;
- using System.Linq;
- using System.Threading.Tasks;
- using Comal.Classes;
- using InABox.Core;
- using Xamarin.Forms;
- using Xamarin.Forms.Xaml;
- using XF.Material.Forms.UI.Dialogs;
- namespace comal.timesheets
- {
- [XamlCompilation(XamlCompilationOptions.Compile)]
- public partial class EquipmentModule
- {
- public EquipmentModule ()
- {
- InitializeComponent ();
- }
- protected override void UpdateTransportStatus()
- {
- base.UpdateTransportStatus();
- LiveMaps.IsEnabled = App.Data.IsConnected();
- }
-
- private async void EquipmentScanner_Tapped(ModuleMenuItem sender, ModuleMenuItemTappedArgs args)
- {
- var scannerPage = new ScannerPage();
- scannerPage.ItemScanned = async (e) =>
- {
- if (!Guid.TryParse(e.Text, out Guid equipmentid))
- {
- await MaterialDialog.Instance.AlertAsync("Invalid Code", "Error");
- return;
- }
- var model = new EquipmentDetailModel(App.Data,
- () => new Filter<Equipment>(x => x.ID).IsEqualTo(equipmentid));
- using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Checking Code"))
- model.Load();
- if (model.Item != null)
- Device.BeginInvokeOnMainThread(() => Navigation.PushAsync(new EquipmentDetailsPage(model)));
- else
- await MaterialDialog.Instance.AlertAsync("Code Not Found", "Error");
- };
- Navigation.PushAsync(scannerPage);
- }
- private void EquipmentList_Tapped(ModuleMenuItem sender, ModuleMenuItemTappedArgs args)
- {
- Navigation.PushAsync(new EquipmentList());
- }
- private void LiveMaps_Tapped(ModuleMenuItem sender, ModuleMenuItemTappedArgs args)
- {
- Navigation.PushAsync(new LiveMapsTwo());
- }
- }
- }
|