Example #1
0
        public void OnChanged(Java.Lang.Object workInfo)
        {
            if (workInfo is AndroidX.Work.WorkInfo result)
            {
                WorkInfo.State state = result.GetState();

                if (state == WorkInfo.State.Running)
                {
                    MessagingCenter.Send <IUploadStateMessenger, string>(this, "Running", result.Id.ToString());
                }
                else if (state == WorkInfo.State.Blocked)
                {
                    MessagingCenter.Send <IUploadStateMessenger, string>(this, "Blocked", result.Id.ToString());
                }
                else if (state == WorkInfo.State.Enqueued)
                {
                    MessagingCenter.Send <IUploadStateMessenger, string>(this, "Enqueued", result.Id.ToString());
                }
                else if (state == WorkInfo.State.Cancelled)
                {
                    MessagingCenter.Send <IUploadStateMessenger, string>(this, "Cancelled", result.Id.ToString());
                }
                else if (state == WorkInfo.State.Failed)
                {
                    MessagingCenter.Send <IUploadStateMessenger, string>(this, "Failed", result.Id.ToString());
                }
                else if (state == WorkInfo.State.Succeeded)
                {
                    MessagingCenter.Send <IUploadStateMessenger, string>(this, "Succeeded", result.Id.ToString());
                }
            }
        }
Example #2
0
 public new Builder SetInitialState(WorkInfo.State state)
 => base.SetInitialState(state).JavaCast <Builder>();