aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResult.cs
blob: f9887ea3815c2c4018abe6d1a7c9fab77bcf2761 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Integration.Upgrade;

namespace Tango.PPC.Common.MachineSetup
{
    /// <summary>
    /// Represents an <see cref="IMachineSetupManager"/> result.
    /// </summary>
    public class MachineSetupResult
    {
        /// <summary>
        /// Gets or sets the temporary update package path from which to get the last downloaded software version.
        /// </summary>
        public String UpdatePackagePath { get; set; }
    }
}
lass="k">public static ObservableCollection<T> ToObservableCollectionAsyncIdle<T>(this ObservableCollection<T> source) { var copy = source.ToList(); ObservableCollection<T> result = new ObservableCollection<T>(); foreach (var item in copy) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { result.Add(item); }), DispatcherPriority.ContextIdle); } return result; } public static void ReloadAsyncIdle<T>(this ObservableCollection<T> source, Action<int, int> onProgress, Action onComplete = null) { var copy = source.ToList(); source.Clear(); int count = copy.Count; int completed = 0; foreach (var item in copy) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { source.Add(item); completed++; onProgress?.Invoke(completed, count); if (completed == count) { onComplete?.Invoke(); } }), DispatcherPriority.ContextIdle); } } }