Forráskód Böngészése

Project Grid now saves selected filter

Kenric Nugteren 1 éve
szülő
commit
d2c5b1ce94

+ 19 - 0
prs.desktop/Panels/Jobs/JobGrid.cs

@@ -3,17 +3,29 @@ using System.Collections.Generic;
 using System.Linq;
 using Comal.Classes;
 using InABox.Clients;
+using InABox.Configuration;
 using InABox.Core;
 using InABox.DynamicGrid;
 
 namespace PRSDesktop
 {
+
+    public class JobGridSettings : IUserConfigurationSettings
+    {
+        public CoreFilterDefinition? CurrentFilter { get; set; }
+    }
+
     public class JobGrid : DynamicDataGrid<Job>
     {
         private Guid _statusid = Guid.Empty;
 
+        private JobGridSettings _settings;
+
         public JobGrid()
         {
+            _settings = new UserConfiguration<JobGridSettings>().Load();
+            SelectFilter(_settings.CurrentFilter, false);
+
             HiddenColumns.Add(x => x.ID);
             HiddenColumns.Add(x => x.JobNumber);
             HiddenColumns.Add(x => x.Name);
@@ -99,5 +111,12 @@ namespace PRSDesktop
 
             return result;
         }
+
+        protected override void FilterSelected(CoreFilterDefinition filter)
+        {
+            base.FilterSelected(filter);
+            _settings.CurrentFilter = filter;
+            new UserConfiguration<JobGridSettings>().Save(_settings);
+        }
     }
 }

+ 1 - 2
prs.desktop/Panels/Suppliers/PurchaseOrders/SupplierPurchaseOrders.cs

@@ -20,7 +20,7 @@ namespace PRSDesktop
     
     public class SupplierPurchaseOrdersSettings : IUserConfigurationSettings
     {
-        public CoreFilterDefinition CurrentFilter { get; set; }
+        public CoreFilterDefinition? CurrentFilter { get; set; }
     }
     
     public class SupplierPurchaseOrders : DynamicDataGrid<PurchaseOrder>
@@ -35,7 +35,6 @@ namespace PRSDesktop
 
         public SupplierPurchaseOrders()
         {
-            
             _settings = new UserConfiguration<SupplierPurchaseOrdersSettings>().Load();
             SelectFilter(_settings.CurrentFilter, false);