Beispiel #1
0
        public void ContinueProgress(ProgressNotificationId notificationId, Double progress, String message)
        {
            lock (ProgressNotificationSync)
            {
                if (Updates.Count == 0)
                {
                    return;
                }

                var isActive = Updates[Updates.Count - 1].Id == notificationId;
                var update   = isActive ? Updates[Updates.Count - 1].Clone() : Updates.Find(a => a.Id == notificationId);
                if (update == null)
                {
                    return;
                }

                update.Message = message;
                update.Value   = progress;

                if (isActive)
                {
                    Updates[Updates.Count - 1] = update;
                    OnProgressNotificationUpdated(update);
                }
            }
        }
Beispiel #2
0
            internal static ProgressNotificationId Create()
            {
                var id = new ProgressNotificationId();

                lock (Sync) { Prev32 += 1; id.Value = Prev32; }
                return(id);
            }
Beispiel #3
0
        public void EndProgress(ProgressNotificationId notificationId)
        {
            if (notificationId == null)
            {
                return;
            }

            lock (ProgressNotificationSync)
            {
                Updates.RemoveAll(a => a.Id == notificationId);
                if (Updates.Count == 0)
                {
                    OnProgressNotificationUpdated(null);
                }
                else if ((ProgressNotification != Updates[Updates.Count - 1]))
                {
                    OnProgressNotificationUpdated(ProgressNotification);
                }
            }
        }
Beispiel #4
0
 internal ProgressNotificationUpdate()
 {
     Id = ProgressNotificationId.Create();
 }
Beispiel #5
0
 public async void HideProgress(ProgressNotificationId notificationId, String message)
 {
     HideProgress(notificationId);
     await ShowProgressMessageAsync(message);
 }