DeliveryEditFormsView.xaml.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Comal.Classes;
  7. using InABox.Core;
  8. using Xamarin.Forms;
  9. using Xamarin.Forms.Xaml;
  10. using XF.Material.Forms.UI.Dialogs;
  11. namespace PRS.Mobile
  12. {
  13. [XamlCompilation(XamlCompilationOptions.Compile)]
  14. public partial class DeliveryEditFormsView
  15. {
  16. public DeliveryEditFormsView()
  17. {
  18. InitializeComponent();
  19. }
  20. public override void Refresh()
  21. {
  22. _forms.DataModel = ViewModel?.Forms;
  23. _forms.AppliesTo = "Assignment";
  24. _forms.Property = model => ViewModel?.Forms.Items.OfType<IDigitalFormInstanceShell>().ToArray();
  25. _forms.RefreshData(false,true);
  26. }
  27. public void CreateForm()
  28. {
  29. _forms.CreateNewForm(
  30. "Delivery",
  31. () => ViewModel.Forms.AddItem(),
  32. ViewModel.Item.ID,
  33. () =>
  34. {
  35. ViewModel.Forms.Search(null);
  36. Refresh();
  37. }
  38. );
  39. }
  40. private async void _forms_OnFormTapped(object sender, ExistingFormTappedEventArgs args)
  41. {
  42. _forms.EditFormAsync<Delivery,DeliveryLink,DeliveryForm>(
  43. args.Shell,
  44. ViewModel.Item.Entity
  45. );
  46. }
  47. }
  48. }