|
@@ -2,6 +2,7 @@
|
|
|
using System.Collections.Generic;
|
|
|
using System.ComponentModel;
|
|
|
using System.Linq;
|
|
|
+using System.Threading.Tasks;
|
|
|
using System.Windows;
|
|
|
using System.Windows.Controls;
|
|
|
using System.Windows.Media.Imaging;
|
|
@@ -13,16 +14,27 @@ using InABox.Wpf;
|
|
|
|
|
|
namespace PRSDesktop;
|
|
|
|
|
|
+public class StockMovementGlobalSettings : BaseObject, IGlobalConfigurationSettings
|
|
|
+{
|
|
|
+ public int PageSize { get; set; } = 5000;
|
|
|
+}
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// Interaction logic for StockMovementPanel.xaml
|
|
|
/// </summary>
|
|
|
public partial class StockMovementPanel : UserControl, IPanel<StockMovement>
|
|
|
{
|
|
|
- public StockMovementSettings _settings;
|
|
|
-
|
|
|
+ private StockMovementSettings _settings = new();
|
|
|
+ private StockMovementGlobalSettings _globalSettings = new();
|
|
|
public StockMovementPanel()
|
|
|
{
|
|
|
+ Task[] setup = new Task[]
|
|
|
+ {
|
|
|
+ Task.Run(() => _settings = new UserConfiguration<StockMovementSettings>().Load()),
|
|
|
+ Task.Run(() => _globalSettings = new GlobalConfiguration<StockMovementGlobalSettings>().Load())
|
|
|
+ };
|
|
|
InitializeComponent();
|
|
|
+ Task.WaitAll(setup);
|
|
|
}
|
|
|
|
|
|
public bool IsReady { get; set; }
|
|
@@ -32,6 +44,21 @@ public partial class StockMovementPanel : UserControl, IPanel<StockMovement>
|
|
|
public void CreateToolbarButtons(IPanelHost host)
|
|
|
{
|
|
|
ProductSetupActions.Standard(host);
|
|
|
+
|
|
|
+ host.CreateSetupAction(new PanelAction() { Caption = "Stock Movements Settings", Image = PRSDesktop.Resources.product, OnExecute =
|
|
|
+ (obj) =>
|
|
|
+ {
|
|
|
+ var grid = new DynamicItemsListGrid<StockMovementGlobalSettings>();
|
|
|
+ if (grid.EditItems(new StockMovementGlobalSettings[] { _globalSettings }))
|
|
|
+ {
|
|
|
+ new GlobalConfiguration<StockMovementGlobalSettings>().Save(_globalSettings);
|
|
|
+ Movements.Options.PageSize = _globalSettings.PageSize;
|
|
|
+ Refresh();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
PostUtils.CreateToolbarButtons(host,
|
|
|
() => (DataModel(Selection.Selected) as IDataModel<StockMovement>)!,
|
|
|
() => Movements.Refresh(false, true),
|
|
@@ -73,6 +100,7 @@ public partial class StockMovementPanel : UserControl, IPanel<StockMovement>
|
|
|
{
|
|
|
LoadSettings();
|
|
|
Batches.Refresh(true, false);
|
|
|
+ Movements.Options.PageSize = _globalSettings.PageSize;
|
|
|
Movements.Refresh(true, false);
|
|
|
Batches.OnSelectItem += Batches_OnSelectItem;
|
|
|
}
|
|
@@ -83,7 +111,7 @@ public partial class StockMovementPanel : UserControl, IPanel<StockMovement>
|
|
|
|
|
|
private void LoadSettings()
|
|
|
{
|
|
|
- _settings = new UserConfiguration<StockMovementSettings>().Load();
|
|
|
+
|
|
|
StartPicker.SelectedDate = _settings.StartDate;
|
|
|
EndPicker.SelectedDate = _settings.EndDate;
|
|
|
View.SelectedIndex = _settings.View;
|