Esempio n. 1
0
        public async Task Run()
        {
            try
            {
                runWatch = new System.Diagnostics.Stopwatch();
                runWatch.Start();
                if (string.IsNullOrEmpty(InstanceId))
                {
                    wfApp.Run();
                    InstanceId = wfApp.Id.ToString();
                    state      = "running";
                    await Save();
                }
                else
                {
                    foreach (var b in Bookmarks)
                    {
                        if (b.Value != null && !string.IsNullOrEmpty(b.Value.ToString()))
                        {
                            wfApp.ResumeBookmark(b.Key, b.Value);
                        }
                    }
                    if (Bookmarks.Count() == 0)
                    {
                        wfApp.Run();
                    }
                    state = "running";
                    await Save();
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex, "");
                hasError    = true;
                isCompleted = true;
                //isUnloaded = true;
                state        = "failed";
                Exception    = ex;
                errormessage = ex.Message;
                await Save();

                if (runWatch != null)
                {
                    runWatch.Stop();
                }
                OnIdleOrComplete?.Invoke(this, EventArgs.Empty);
            }
        }
 public override bool SaveBookmarks(out NSError error)
 {
     InvokeOnMainThread(() => {
         var alert = new UIAlertView("Bookmark Subclass Message", string.Format("Intercepted bookmark saving; current bookmarks are: {0}", Bookmarks.Count()), null, "Ok", null);
         alert.Show();
     });
     return(base.SaveBookmarks(out error));
 }