123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- using System.Windows;
- using System.Windows.Controls;
- using InABox.Configuration;
- using InABox.Core;
- using InABox.DynamicGrid;
- using InABox.WPF;
- namespace PRSDesktop
- {
- public partial class StockSummaryControl : UserControl
- {
- private enum Suppress
- {
- This
- }
-
- public StockSummaryControl()
- {
- using (new EventSuppressor(Suppress.This))
- InitializeComponent();
- }
-
- public void Setup()
- {
- using (new EventSuppressor(Suppress.This))
- {
- DoLoadSettings();
- SplitPanel.View = Properties.SplitPanelSettings.View;
- SplitPanel.AnchorWidth = Properties.SplitPanelSettings.AnchorWidth;
- SplitPanel.DetailHeight = Properties.SplitPanelSettings.DetailHeight;
-
- GroupSelector.Settings = Properties.GroupSettings;
- GroupSelector.Setup();
- GroupSelector.Selection = Properties.GroupSelection;
- SummaryGrid.GroupIDs = Properties.GroupSelection.Groups;
-
- JobSelector.Settings = Properties.JobSettings;
- JobSelector.Setup();
- JobSelector.Selection = Properties.JobSelection;
- SummaryGrid.JobIDs = Properties.JobSelection.Jobs;
- SummaryGrid.Refresh(true, false);
- }
- }
- public void Shutdown()
- {
-
- }
- public void Refresh()
- {
- SummaryGrid.Refresh(false,true);
- }
- public StockSummaryProperties Properties { get; set; }
-
- private void DoLoadSettings()
- {
- Properties = LoadSettings?.Invoke(this) ?? new StockSummaryProperties();
- }
-
- private void DoSaveSettings()
- {
- SaveSettings?.Invoke(this, Properties);
- }
-
- public event LoadSettings<StockSummaryProperties>? LoadSettings;
-
- public event SaveSettings<StockSummaryProperties>? SaveSettings;
- private void GroupSelector_OnSettingsChanged(object sender, ProductGroupSelectorSettingsChangedArgs args)
- {
- if (EventSuppressor.IsSet(Suppress.This))
- return;
-
- Properties.GroupSettings = args.Settings;
- DoSaveSettings();
- }
- private void GroupSelector_OnSelectionChanged(object sender, ProductGroupSelectorSelectionChangedArgs args)
- {
- if (EventSuppressor.IsSet(Suppress.This))
- return;
-
- Properties.GroupSelection = args.Selection;
- DoSaveSettings();
-
- SummaryGrid.GroupIDs = args.Selection.Groups;
- SummaryGrid.Refresh(false, true);
- }
- private void JobSelector_OnSettingsChanged(object sender, JobSelectorSettingsChangedArgs args)
- {
- if (EventSuppressor.IsSet(Suppress.This))
- return;
-
- Properties.JobSettings = args.Settings;
- DoSaveSettings();
-
- }
- private void JobSelector_OnSelectionChanged(object sender, JobSelectorSelectionChangedArgs args)
- {
- if (EventSuppressor.IsSet(Suppress.This))
- return;
-
- Properties.JobSelection = args.Selection;
- DoSaveSettings();
-
- SummaryGrid.JobIDs = args.Selection.Jobs;
- SummaryGrid.Refresh(false, true);
- }
-
- private void SplitPanel_OnOnChanged(object sender, DynamicSplitPanelSettings e)
- {
- if (EventSuppressor.IsSet(Suppress.This))
- return;
-
- Properties.SplitPanelSettings = e;
- DoSaveSettings();
- }
-
- private void SummaryGrid_OnBeforeRefresh(object sender, BeforeRefreshEventArgs args)
- {
- //Progress.Show("Loading");
- GroupSelector.IsEnabled = false;
- JobSelector.IsEnabled = false;
- }
- private void SummaryGrid_OnAfterRefresh(object sender, AfterRefreshEventArgs args)
- {
- //Progress.Close();
- GroupSelector.IsEnabled = true;
- JobSelector.IsEnabled = true;
- }
- }
- }
|