diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-09-06 18:24:51 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-09-06 18:24:51 +0300 |
| commit | c74115f58d2437125826a5fcc38a243156ed2e65 (patch) | |
| tree | 5a24f006a6234a30fca4456d6cb21444914ba086 /Software/Visual_Studio/Tango.Touch | |
| parent | 00407d74fff2b4ca5357eeca7feffd3fda65aaf4 (diff) | |
| download | Tango-c74115f58d2437125826a5fcc38a243156ed2e65.tar.gz Tango-c74115f58d2437125826a5fcc38a243156ed2e65.zip | |
Fixed PPC jobs list rendering time.
Diffstat (limited to 'Software/Visual_Studio/Tango.Touch')
| -rw-r--r-- | Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.cs | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.cs b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.cs index bc17ec394..25d73c8fe 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.cs @@ -18,6 +18,7 @@ using System.Windows.Media.Animation; using Tango.Core.Commands; using Tango.Core.EventArguments; using Tango.Core.ExtensionMethods; +using Tango.Core.Threading; using Tango.DragAndDrop; using Tango.SharedUI.Helpers; using Tango.Touch.Components; @@ -31,6 +32,8 @@ namespace Tango.Touch.Controls private bool _isLoaded; private List<LightTouchDataGridRow> _awaitingSelectionRows; private LightTouchDataGridRow _firstMultiSelectionRow; + private ActionTimer _layoutRowsTimer; + private ActionTimer _updateLayoutTimer; #region Events @@ -219,6 +222,8 @@ namespace Tango.Touch.Controls /// </summary> public LightTouchDataGrid() { + _layoutRowsTimer = new ActionTimer(TimeSpan.FromMilliseconds(200)); + _updateLayoutTimer = new ActionTimer(TimeSpan.FromMilliseconds(200)); Columns = new ObservableCollection<LightTouchDataGridColumn>(); _awaitingSelectionRows = new List<LightTouchDataGridRow>(); SortCommand = new RelayCommand<LightTouchDataGridColumn>(HandleSortCommand); @@ -459,14 +464,20 @@ namespace Tango.Touch.Controls { if (_items_control_rows.ItemContainerGenerator.Status == GeneratorStatus.ContainersGenerated) { - _items_control_rows.UpdateLayout(); - LayoutRows(); + _updateLayoutTimer.ResetReplace(() => + { + Dispatcher.BeginInvoke(new Action(() => + { + _items_control_rows.UpdateLayout(); + LayoutRows(); + })); + }); } } private void CollectionFilter_FilterChanged(object sender, EventArgs e) { - LayoutRows(false); + LayoutRows(); FilterChanged?.Invoke(this, new EventArgs()); } @@ -526,6 +537,17 @@ namespace Tango.Touch.Controls /// </summary> public void LayoutRows(bool allowAnimation = false) { + _layoutRowsTimer.ResetReplace(() => + { + Dispatcher.BeginInvoke(new Action(() => + { + LayoutRowsInternal(allowAnimation); + })); + }); + } + + private void LayoutRowsInternal(bool allowAnimation) + { if (_items_control_rows == null || !_isLoaded || !IsLoaded) return; var rows = _items_control_rows.ItemContainerGenerator.Items.Select(x => _items_control_rows.ItemContainerGenerator.ContainerFromItem(x) as ContentPresenter).ToList(); |
