Переглянути джерело

Fixed Delivery List "Add Delivery" button performance

Frank van den Bos 1 рік тому
батько
коміт
338ef8e63e

+ 0 - 1
prs.mobile.new/PRS.Mobile.Droid/Resources/Resource.designer.cs

@@ -2,7 +2,6 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
-//     Runtime Version:4.0.30319.42000
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.

+ 2 - 2
prs.mobile.new/PRS.Mobile/Components/DigitalForms/ExistingForms/ExistingForms.xaml

@@ -44,9 +44,9 @@
                 Grid.Row="1"
                 Grid.Column="0"
                 Grid.ColumnSpan="2"
-                PullToRefresh="True"
+                PullToRefresh="{Binding PullToRefresh}"
                 RefreshRequested="_digitalforms_OnRefresh"
-                ShowRecordCount="True">
+                ShowRecordCount="{Binding PullToRefresh}">
                 
                 <mobile:MobileCollectionView.ItemTemplate>
                 

+ 6 - 0
prs.mobile.new/PRS.Mobile/Components/DigitalForms/ExistingForms/ExistingForms.xaml.cs

@@ -135,6 +135,12 @@ namespace PRS.Mobile
             get => _model.SeparateHistory;
             set => _model.SeparateHistory = value;
         }
+        
+        public bool PullToRefresh
+        {
+            get => _model.PullToRefresh;
+            set => _model.PullToRefresh = value;
+        }
 
         public event ExistingFormRefreshEvent RefreshRequested;
         public event ExistingFormSearchEvent Search;

+ 4 - 1
prs.mobile.new/PRS.Mobile/Components/DigitalForms/ExistingForms/ExistingFormsViewModel.cs

@@ -33,7 +33,8 @@ namespace PRS.Mobile
             SelectedColor = XF.Material.Forms.Material.Color.Surface;
             SelectedTextColor = XF.Material.Forms.Material.Color.OnSurface;
             UnselectedColor = XF.Material.Forms.Material.Color.Primary;            
-            UnselectedTextColor = XF.Material.Forms.Material.Color.OnPrimary;  
+            UnselectedTextColor = XF.Material.Forms.Material.Color.OnPrimary;
+            PullToRefresh = true;
         }
 
         private ICoreRepository _dataModel;
@@ -93,5 +94,7 @@ namespace PRS.Mobile
         
         public bool SeparateHistory { get; set; }
         
+        public bool PullToRefresh { get; set; }
+        
     }
 }

+ 10 - 6
prs.mobile.new/PRS.Mobile/Modules/Deliveries/Edit/DeliveryEditViewModel.cs

@@ -1,3 +1,4 @@
+using System;
 using System.Threading.Tasks;
 using Comal.Classes;
 using InABox.Core;
@@ -18,13 +19,13 @@ namespace PRS.Mobile
         public DeliveryEditViewModel()
         {
             Documents = new DeliveryDocumentModel(App.Data,
-                () => new Filter<DeliveryDocument>(x => x.EntityLink.ID).IsEqualTo(Item?.ID ?? CoreUtils.FullGuid));
+                () => new Filter<DeliveryDocument>(x => x.EntityLink.ID).IsEqualTo(Item?.ID ?? Guid.Empty));
             
             Items = new DeliveryItemModel(App.Data, 
-                () => new Filter<DeliveryItem>(x => x.Delivery.ID).IsEqualTo(Item?.ID ?? CoreUtils.FullGuid));
+                () => new Filter<DeliveryItem>(x => x.Delivery.ID).IsEqualTo(Item?.ID ?? Guid.Empty));
             
             Forms = new DeliveryFormModel(App.Data, 
-                () => new Filter<DeliveryForm>(x => x.Parent.ID).IsEqualTo(Item?.ID ?? CoreUtils.FullGuid));
+                () => new Filter<DeliveryForm>(x => x.Parent.ID).IsEqualTo(Item?.ID ?? Guid.Empty));
         }
 
         protected override void DoLoad()
@@ -33,17 +34,20 @@ namespace PRS.Mobile
             {
                 Task.Run(() =>
                 {
-                    Items.Refresh(true);
+                    if (Item != null && Item.ID != Guid.Empty)
+                        Items.Refresh(true);
                 }),
                 
                 Task.Run(() =>
                 {
-                    Documents.Refresh(true);
+                    if (Item != null && Item.ID != Guid.Empty)
+                        Documents.Refresh(true);
                 }),
                 
                 Task.Run(() =>
                 {
-                    return Forms.Refresh(true);
+                    if (Item != null && Item.ID != Guid.Empty)
+                        Forms.Refresh(true);
                 })
             };
             Task.WaitAll(tasks);

+ 1 - 0
prs.mobile.new/PRS.Mobile/Modules/Deliveries/Edit/Views/DeliveryEditFormsView.xaml

@@ -12,6 +12,7 @@
                 Grid.Row="0"
                 AppliesTo="Delivery"  
                 SeparateHistory="False"
+                PullToRefresh="False"
                 FormTapped="_forms_OnFormTapped"/>
 
     </mobile:DeliveryEditView.Content>