예제 #1
0
        private void CompleteTodoItem(TodoItem item, bool completed)
        {
            if (_isRefreshingItems)
            {
                return;
            }

            _isRefreshingItems = true;
            ((MainViewController)this.MainViewController).BlockUI();

            _cts0 = new CancellationTokenSource();
            AppController.CompleteTodoItem(_cts0,
                                           item.TodoItemId,
                                           completed,
                                           (todoItem) =>
            {
                _source.SetAsCompleted(todoItem.TodoItemId, todoItem.IsComplete, todoItem.CompletionDate);
                this.TaskList.ReloadData();
            },
                                           (error) =>
            {
                UIToast.MakeText(error, UIToastLength.Long).Show();
            },
                                           () =>
            {
                _isRefreshingItems = false;
                ((MainViewController)this.MainViewController).UnblockUI();
            });
        }
예제 #2
0
        private void RefreshGimmicks()
        {
            if (_isRefreshingGimmicks)
            {
                return;
            }

            this.GimmickList.Hidden = true;

            _isRefreshingGimmicks = true;
            ((MainViewController)this.MainViewController).BlockUI();

            Gimmick[] gimmicks = null;

            _cts0 = new CancellationTokenSource();
            AppController.RefreshGimmicks(_cts0,
                                          (newGimmicks) =>
            {
                gimmicks = newGimmicks;
            },
                                          (error) =>
            {
                UIToast.MakeText(error, UIToastLength.Long).Show();
            },
                                          () =>
            {
                if (gimmicks != null)
                {
                    LoadGimmicks(gimmicks);

                    if (_source?.Count > 0)
                    {
                        this.GimmickList.Hidden = false;
                    }

                    _isRefreshingGimmicks = false;
                    ((MainViewController)this.MainViewController).UnblockUI();
                }
                else
                {
                    AppController.Utility.ExecuteOnAsyncTask(_cts0.Token,
                                                             () =>
                    {
                        gimmicks = AppController.GetGimmicks();
                    },
                                                             () =>
                    {
                        LoadGimmicks(gimmicks);

                        if (_source?.Count > 0)
                        {
                            this.GimmickList.Hidden = false;
                        }

                        _isRefreshingGimmicks = false;
                        ((MainViewController)this.MainViewController).UnblockUI();
                    });
                }
            });
        }
예제 #3
0
        private void Application_PushNotificationReceived(object sender, PushEventArgs e)
        {
            AppController.Utility.ExecuteOnMainThread(
                () =>
            {
                switch (e.Action)
                {
                case 1:

                    _lastMessageId = Int32.Parse(e.Payload);
                    RefreshMessages();

                    break;

                case 2:

                    if (e.Payload != _email.Split('@')[0])
                    {
                        PlaySound();

                        UIToast
                        .MakeText(String.Format("Say welocome to '{0}'", e.Payload), UIToastLength.Long)
                        .Show();
                    }

                    break;
                }
            });
        }
예제 #4
0
        private void DeleteTodoItem(TodoItem item)
        {
            if (_isRefreshingItems)
            {
                return;
            }

            _isRefreshingItems = true;
            ((MainViewController)this.MainViewController).BlockUI();

            _cts0 = new CancellationTokenSource();
            AppController.DeleteTodoItem(_cts0,
                                         item.TodoItemId,
                                         () =>
            {
                _source.RemoveItem(item);
                this.TaskList.ReloadData();

                UIToast.MakeText("An item has been removed!", UIToastLength.Long).Show();
            },
                                         (error) =>
            {
                UIToast.MakeText(error, UIToastLength.Long).Show();
            },
                                         () =>
            {
                _isRefreshingItems = false;
                ((MainViewController)this.MainViewController).UnblockUI();
            });
        }
예제 #5
0
        private void LoginUser()
        {
            if (ValidateInput())
            {
                if (_isLogginUser)
                {
                    return;
                }

                _isLogginUser = true;

                _email    = this.EmailText.Text;
                _password = this.PasswordText.Text;

                // Prevent user form tapping views while logging
                ((MainViewController)this.MainViewController).BlockUI();

                // Create a new cancellation token for this request
                _cts1 = new CancellationTokenSource();
                AppController.LoginUser(_cts1, _email, _password,
                                        // Service call success
                                        (data) =>
                {
                    AppController.Settings.LastLoginUsernameUsed = _email;
                    AppController.Settings.AuthAccessToken       = data.AuthAccessToken;
                    AppController.Settings.AuthExpirationDate    = data.AuthExpirationDate.GetValueOrDefault().ToLocalTime();

                    ((AppDelegate)UIApplication.SharedApplication.Delegate).RegisterToNotificationsHub();

                    var c       = new ChatViewController();
                    c.Arguments = new UIBundle();
                    c.Arguments.PutString("Email", _email);
                    this.NavigationController.PushViewController(c, true);
                },
                                        // Service call error
                                        (error) =>
                {
                    if (error.Contains("confirm"))
                    {
                        this.VerifyButton.Hidden = false;
                    }

                    UIToast.MakeText(error, UIToastLength.Long).Show();
                },
                                        // Service call finished
                                        () =>
                {
                    _isLogginUser = false;

                    // Allow user to tap views
                    ((MainViewController)this.MainViewController).UnblockUI();
                });
            }
        }
예제 #6
0
        public void RegisterUser()
        {
            if (ValidateInput())
            {
                DismissKeyboard();

                AppController.Utility.ExecuteDelayedAction(300, default(System.Threading.CancellationToken),
                                                           () =>
                {
                    if (_isRegisteringUser)
                    {
                        return;
                    }

                    _isRegisteringUser = true;

                    _password = this.PasswordText.Text;

                    // Prevent user form tapping views while logging
                    ((MainViewController)this.MainViewController).BlockUI();

                    // Create a new cancellation token for this request
                    _cts = new CancellationTokenSource();
                    AppController.RegisterUser(_cts,
                                               _email,
                                               _password,
                                               // Service call success
                                               (data) =>
                    {
                        var c = new RegistrationDoneViewController();
                        this.NavigationController.PopToViewController(this.NavigationController.ViewControllers.Single(x => x is LoginViewController), false);
                        this.NavigationController.PushViewController(c, true);
                    },
                                               // Service call error
                                               (error) =>
                    {
                        this.PasswordText.RequestUserInput();

                        UIToast.MakeText(error, UIToastLength.Long).Show();
                    },
                                               // Service call finished
                                               () =>
                    {
                        _isRegisteringUser = false;

                        // Allow user to tap views
                        ((MainViewController)this.MainViewController).UnblockUI();
                    });
                });
            }
        }
예제 #7
0
        private void SendMessage()
        {
            string content = this.MessageText.Text;

            if (!String.IsNullOrWhiteSpace(content))
            {
                if (_isSendingMessage)
                {
                    return;
                }

                _isSendingMessage = true;

                // Add message to the message list
                Message message = new Message {
                    Sender = null, Content = content, SendDate = DateTime.MinValue
                };
                _source.AddItem(message);
                this.MessageList.ReloadData();
                this.MessageList.ScrollToRow(
                    NSIndexPath.FromItemSection((nint)(_source.Count - 1), 0),
                    UITableViewScrollPosition.Bottom,
                    false);

                _cts1 = new CancellationTokenSource();
                AppController.SendMessage(_cts1,
                                          _email,
                                          content,
                                          (data) =>
                {
                    message.MessageId = data.MessageId;
                    message.SendDate  = data.SendDate.GetValueOrDefault();
                    this.MessageList.ReloadData();
                },
                                          (error) =>
                {
                    message.SendDate = DateTime.MaxValue;
                    this.MessageList.ReloadData();

                    UIToast.MakeText(error, UIToastLength.Long).Show();
                },
                                          () =>
                {
                    _isSendingMessage = false;
                });

                // Ready to send new message
                this.MessageText.Text = String.Empty;
                AdjustMessageTextHeight();
            }
        }
예제 #8
0
        public bool ValidateInput()
        {
            var validator = new WidgetValidator()
                            .AddValidator(() => this.PasswordText.Text, WidgetValidator.IsNotNullOrEmpty, "Please insert a password.")
                            .AddValidator(() => this.PasswordText.Text, WidgetValidator.IsPasswordMin8, "Your password is not valid!");

            string errorMessage;

            if (!validator.Validate(out errorMessage))
            {
                UIToast.MakeText(errorMessage, UIToastLength.Long).Show();
                return(false);
            }

            return(true);
        }
예제 #9
0
        private bool ValidateInput()
        {
            var validator = new WidgetValidator()
                            .AddValidator(() => this.EmailText.Text, WidgetValidator.IsNotNullOrEmpty, "Please insert a valid email")
                            .AddValidator(() => this.EmailText.Text, WidgetValidator.IsEmail, "Your email is not valid!");

            string errorMessage;

            if (!validator.Validate(out errorMessage))
            {
                UIToast.MakeText(errorMessage, UIToastLength.Long).Show();
                return(false);
            }

            return(true);
        }
예제 #10
0
        public void DataRequestHandler(GraphRequestConnection connection, NSObject result, NSError err)
        {
            try
            {
                string fbId    = result.ValueForKey(new NSString("id")).ToString();
                string fbToken = AccessToken.CurrentAccessToken.TokenString;
                string fbEmail = result.ValueForKey(new NSString("email")).ToString();

                _email = fbEmail;

                // Create a new cancellation token for this request
                _cts0 = new CancellationTokenSource();
                AppController.LoginUser(_cts0, fbId, fbEmail, fbToken,
                                        // Service call success
                                        (data) =>
                {
                    AppController.Settings.LastLoginUsernameUsed = _email;
                    AppController.Settings.AuthAccessToken       = data.AuthAccessToken;
                    AppController.Settings.AuthExpirationDate    = data.AuthExpirationDate.GetValueOrDefault().ToLocalTime();

                    ((AppDelegate)UIApplication.SharedApplication.Delegate).RegisterToNotificationsHub();

                    var c       = new ChatViewController();
                    c.Arguments = new UIBundle();
                    c.Arguments.PutString("Email", _email);
                    this.NavigationController.PushViewController(c, true);
                },
                                        // Service call error
                                        (error) =>
                {
                    UIToast.MakeText(error, UIToastLength.Long).Show();
                },
                                        // Service call finished
                                        () =>
                {
                    // Allow user to tap views
                    ((MainViewController)this.MainViewController).UnblockUI();
                });
            }
            catch (Exception ex)
            {
                ((MainViewController)this.MainViewController).UnblockUI();

                UIToast.MakeText("Error", UIToastLength.Long).Show();
            }
        }
예제 #11
0
        private bool ValidateInput()
        {
            var validator = new WidgetValidator()
                            .AddValidator(() => this.TitleText.Text, WidgetValidator.IsNotNullOrEmpty, "Please insert a title!")
                            .AddValidator(() => this.DescriptionText.Text, WidgetValidator.IsNotNullOrEmpty, "Please insert a description!");

            string errorMessage;

            if (!validator.Validate(out errorMessage))
            {
                UIToast.MakeText(errorMessage, UIToastLength.Long).Show();

                return(false);
            }

            return(true);
        }
예제 #12
0
        private bool ValidateInput()
        {
            var validator = new WidgetValidator()
                            .AddValidator(() => this.TitleText.Text, WidgetValidator.IsNotNullOrEmpty, "Please insert a title!")
                            .AddValidator(() => this.DescriptionText.Text, WidgetValidator.IsNotNullOrEmpty, "Please insert a description!")
                            .AddValidator(() => this.TagsText.Text, (string s) => String.IsNullOrWhiteSpace(s) || !s.Contains(" "), "Tags must be comma separated list, no blanks!");

            string errorMessage;

            if (!validator.Validate(out errorMessage))
            {
                UIToast.MakeText(errorMessage, UIToastLength.Long).Show();

                return(false);
            }

            return(true);
        }
예제 #13
0
        private void VerifyUser()
        {
            if (ValidateInput())
            {
                if (_isConfirmingUser)
                {
                    return;
                }

                _isConfirmingUser = true;

                _email    = this.EmailText.Text;
                _password = this.PasswordText.Text;

                // Prevent user form tapping views while logging
                ((MainViewController)this.MainViewController).BlockUI();

                this.VerifyButton.Hidden = true;

                // Create a new cancellation token for this request
                _cts1 = new CancellationTokenSource();
                AppController.VerifyUser(_cts1, _email, _password,
                                         // Service call success
                                         () =>
                {
                    UIToast.MakeText("You should receive a new mail!", UIToastLength.Long).Show();
                },
                                         // Service call error
                                         (error) =>
                {
                    UIToast.MakeText(error, UIToastLength.Long).Show();
                },
                                         // Service call finished
                                         () =>
                {
                    _isConfirmingUser = false;

                    // Allow user to tap views
                    ((MainViewController)this.MainViewController).UnblockUI();
                });
            }
        }
예제 #14
0
        private void PostMessage()
        {
            if (_isSendingMessage)
            {
                return;
            }

            string content = this.MessageText.Text;

            if (String.IsNullOrWhiteSpace(content))
            {
                return;
            }

            _isSendingMessage = true;
            ((MainViewController)this.MainViewController).BlockUI();

            _cts0 = new CancellationTokenSource();
            AppController.PostMessage(_cts0,
                                      _issue.IssueId,
                                      _userId,
                                      content,
                                      (message) =>
            {
                if (_source != null)
                {
                    _source.Insert(message);
                    this.MessageList.ReloadData();
                    this.MessageList.Hidden = false;
                    this.MessageText.Text   = String.Empty;
                }
            },
                                      (error) =>
            {
                UIToast.MakeText(error, UIToastLength.Long).Show();
            },
                                      () =>
            {
                _isSendingMessage = false;
                ((MainViewController)this.MainViewController).UnblockUI();
            });
        }
예제 #15
0
        public void DidSignIn(SignIn signIn, GoogleUser user, NSError error)
        {
            try
            {
                string gClientId = AppController.Globals.GoogleClientId_iOS;
                string gEmail    = user.Profile.Email;
                string gToken    = user.Authentication.IdToken;

                _cts0 = new CancellationTokenSource();
                AppController.LoginUser(_cts0, gClientId, gEmail, gToken,
                                        (d) =>
                {
                    AppController.Settings.LastLoginUserIdUsed   = d.UserId;
                    AppController.Settings.LastLoginUsernameUsed = _email;
                    AppController.Settings.AuthAccessToken       = d.AuthAccessToken;
                    AppController.Settings.AuthExpirationDate    = d.AuthExpirationDate.GetValueOrDefault().ToLocalTime();
                    AppController.Settings.GoogleSignedIn        = true;

                    var c = new GimmicksViewController();
                    this.NavigationController.PushViewController(c, true);
                },
                                        (err) =>
                {
                    UIToast.MakeText(err, UIToastLength.Long).Show();
                },
                                        () =>
                {
                    ((MainViewController)this.MainViewController).UnblockUI();
                });
            }
            catch (Exception ex)
            {
                ((MainViewController)this.MainViewController).UnblockUI();

                UIToast.MakeText("Error logging with Google!", UIToastLength.Long).Show();
            }
            finally
            {
                // Do nothing...
            }
        }
예제 #16
0
        private void UpdateTodoItem()
        {
            if (_isSendingTodoItem)
            {
                return;
            }

            if (!ValidateInput())
            {
                return;
            }

            string title       = this.TitleText.Text;
            string description = this.DescriptionText.Text;
            string tags        = this.TagsText.Text;

            _isSendingTodoItem = true;
            ((MainViewController)this.MainViewController).BlockUI();

            _cts0 = new CancellationTokenSource();
            AppController.UpdateTodoItem(_cts0,
                                         _item.TodoItemId,
                                         title,
                                         description,
                                         _willDoIn,
                                         tags,
                                         (todoItem) =>
            {
                this.NavigationController.PopViewController(true);
            },
                                         (error) =>
            {
                UIToast.MakeText(error, UIToastLength.Long).Show();
            },
                                         () =>
            {
                _isSendingTodoItem = false;
                ((MainViewController)this.MainViewController).UnblockUI();
            });
        }
예제 #17
0
        private bool RestoreUser()
        {
            if (!AppController.IsUserRestorable)
            {
                return(false);
            }

            if (_isLogginUser)
            {
                return(true);
            }

            _isLogginUser = true;

            // Create a new cancellation token for this request
            _cts = new CancellationTokenSource();
            AppController.RestoreUser(_cts, AppController.Settings.AuthAccessToken,
                                      // Service call success
                                      (data) =>
            {
                UIBundle b = new UIBundle();
                b.PutBoolean("UserRestored", true);
                b.PutString("Email", data.Email);
                MakeRoot(typeof(MainViewController), b);
            },
                                      // Service call error
                                      (error) =>
            {
                MakeRoot(typeof(MainViewController));

                UIToast.MakeText(error, UIToastLength.Long).Show();
            },
                                      // Service call finished
                                      () =>
            {
                _isLogginUser = false;
            });

            return(true);
        }
예제 #18
0
        private void AddIssue()
        {
            if (_isSendingIssue)
            {
                return;
            }

            if (!ValidateInput())
            {
                return;
            }

            string title       = this.TitleText.Text;
            string description = this.DescriptionText.Text;

            _isSendingIssue = true;
            ((MainViewController)this.MainViewController).BlockUI();

            _cts0 = new CancellationTokenSource();
            AppController.AddIssue(_cts0,
                                   _gimmickId,
                                   _userId,
                                   title,
                                   description,
                                   _currentIssueType,
                                   (todoItem) =>
            {
                this.NavigationController.PopViewController(true);
            },
                                   (error) =>
            {
                UIToast.MakeText(error, UIToastLength.Long).Show();
            },
                                   () =>
            {
                _isSendingIssue = false;
                ((MainViewController)this.MainViewController).UnblockUI();
            });
        }
예제 #19
0
        private void WaitConnection()
        {
            ((MainViewController)this.MainViewController).BlockUI();
            _cts0 = new CancellationTokenSource();
            AppController.Utility.ExecuteOnAsyncTask(_cts0.Token,
                                                     () =>
            {
                int awaited = 0;
                while (!_cts0.IsCancellationRequested)
                {
                    System.Threading.Tasks.Task.Delay(100, _cts0.Token).Wait();
                    awaited += 100;

                    if (((AppDelegate)UIApplication.SharedApplication.Delegate).IsNotificationHubConnected)
                    {
                        break;
                    }

                    if (awaited > 10000)
                    {
                        break;
                    }
                }
            },
                                                     () =>
            {
                ((MainViewController)this.MainViewController).UnblockUI();

                if (!((AppDelegate)UIApplication.SharedApplication.Delegate).IsNotificationHubConnected)
                {
                    this.MessageText.Editable = false;
                    this.SendButton.Enabled   = false;

                    UIToast.MakeText("Unable to connect to the message hub!", UIToastLength.Long).Show();
                }
            });
        }
예제 #20
0
        private void RefreshTodoItems()
        {
            if (_isRefreshingItems)
            {
                return;
            }

            this.TaskList.Hidden = true;

            _isRefreshingItems = true;
            ((MainViewController)this.MainViewController).BlockUI();

            _cts0 = new CancellationTokenSource();
            AppController.RefreshTodoItems(_cts0,
                                           _userId,
                                           (items) =>
            {
                items = items
                        .OrderBy(x => (x.CreationDate.GetValueOrDefault().Date.AddDays(x.WillDoIn).Date - DateTime.Now.Date).Days)
                        .ToArray();

                _source.Refresh(items);
                this.TaskList.ReloadData();
            },
                                           (error) =>
            {
                UIToast.MakeText(error, UIToastLength.Long).Show();
            },
                                           () =>
            {
                this.TaskList.Hidden = false;

                _isRefreshingItems = false;
                ((MainViewController)this.MainViewController).UnblockUI();
            });
        }
예제 #21
0
        private void RefreshStats()
        {
            if (_gimmick == null)
            {
                return;
            }

            if (_isRefreshingStats)
            {
                return;
            }

            this.NameLabel.Text  = _gimmick.Name;
            this.OwnerLabel.Text = _gimmick.Owner;

            _isRefreshingStats = true;
            ((MainViewController)this.MainViewController).BlockUI();

            this.ViewOpenedButton.Enabled  = false;
            this.ViewWorkingButton.Enabled = false;
            this.ViewClosedButton.Enabled  = false;

            Dictionary <string, int> stats = null;

            _cts0 = new CancellationTokenSource();
            AppController.RefreshStats(_cts0,
                                       _gimmick.GimmickId,
                                       (newStats) =>
            {
                stats = newStats;
            },
                                       (error) =>
            {
                UIToast.MakeText(error, UIToastLength.Long).Show();
            },
                                       () =>
            {
                if (stats != null)
                {
                    LoadStatistics(stats);

                    _isRefreshingStats = false;
                    ((MainViewController)this.MainViewController).UnblockUI();
                }
                else
                {
                    AppController.Utility.ExecuteOnAsyncTask(_cts0.Token,
                                                             () =>
                    {
                        stats = AppController.GetStats(_gimmick.GimmickId);
                    },
                                                             () =>
                    {
                        LoadStatistics(stats);

                        _isRefreshingStats = false;
                        ((MainViewController)this.MainViewController).UnblockUI();
                    });
                }
            });
        }
예제 #22
0
        private void RefreshMessages()
        {
            if (_isRefreshingMessage)
            {
                return;
            }

            this.MessageList.Hidden = true;

            _isRefreshingMessage = true;
            ((MainViewController)this.MainViewController).BlockUI();

            Model.Message[] messages = null;

            _cts1 = new CancellationTokenSource();
            AppController.RefreshMessages(_cts1,
                                          _issue.IssueId,
                                          (newMessages) =>
            {
                messages = newMessages;
            },
                                          (error) =>
            {
                UIToast.MakeText(error, UIToastLength.Long).Show();
            },
                                          () =>
            {
                if (messages != null)
                {
                    LoadMessages(messages);

                    if (_source?.Count > 0)
                    {
                        this.MessageList.Hidden = false;
                    }

                    _isRefreshingMessage = false;
                    ((MainViewController)this.MainViewController).UnblockUI();
                }
                else
                {
                    AppController.Utility.ExecuteOnAsyncTask(_cts1.Token,
                                                             () =>
                    {
                        messages = AppController.GetMessages(_issue.IssueId);
                    },
                                                             () =>
                    {
                        LoadMessages(messages);

                        if (_source?.Count > 0)
                        {
                            this.MessageList.Hidden = false;
                        }

                        _isRefreshingMessage = false;
                        ((MainViewController)this.MainViewController).UnblockUI();
                    });
                }
            });
        }
예제 #23
0
        public void RegisterToNotificationsHub(NSData deviceToken = null)
        {
            this.IsNotificationHubConnected = false;

            // Refresh current device token
            if (deviceToken != null)
            {
                _notificationDeviceToken = deviceToken;
            }

            // Do we have a current device token;
            if (_notificationDeviceToken == null)
            {
                return;
            }

            if (!AppController.IsUserRestorable)
            {
                return;
            }

            // We have already registered our notification hub
            if (_hub == null)
            {
                _hub = new SBNotificationHub(
                    AppController.Globals.AzureNHubConnectionString,
                    AppController.Globals.AzureNHubName);
            }

            _hub.UnregisterAllAsync(_notificationDeviceToken,
                                    (error) =>
            {
                if (error != null)
                {
                    AppController.Utility.DebugOutput("Chatty", "Azure HUB, UnregisterAll Error: " + error.Description);
                    return;
                }

                NSSet tags = new NSSet(new[]
                {
                    AppController.Settings.LastLoginUsernameUsed
                });

                _hub.RegisterNativeAsync(_notificationDeviceToken, tags,
                                         (err) =>
                {
                    if (err == null)
                    {
                        this.IsNotificationHubConnected = true;

                        PushNotificationRegistered?.Invoke(this, EventArgs.Empty);

                        AppController.Utility.ExecuteOnMainThread(() => UIToast.MakeText("You are connected!", UIToastLength.Long).Show());
                    }
                    else
                    {
                        PushNotificationRegistrationFailed?.Invoke(this, new PushEventArgs(new InvalidOperationException(err.Description)));
                        AppController.Utility.DebugOutput("Chatty", "Azure HUB, Register Error: " + err.Description);

                        AppController.Utility.ExecuteOnMainThread(() => UIToast.MakeText(err.Description, UIToastLength.Long).Show());
                    }
                });
            });
        }
예제 #24
0
        private void RefreshIssues(int filter)
        {
            if (_isRefreshingIssues)
            {
                return;
            }

            _filter = filter;

            HilightFilterButton(filter);

            this.IssueList.Hidden = true;

            _isRefreshingIssues = true;
            ((MainViewController)this.MainViewController).BlockUI();

            Issue[] issues = null;

            _cts0 = new CancellationTokenSource();
            AppController.RefreshIssues(_cts0,
                                        _gimmickId,
                                        (newIssues) =>
            {
                issues = newIssues;
            },
                                        (error) =>
            {
                UIToast.MakeText(error, UIToastLength.Long).Show();
            },
                                        () =>
            {
                if (issues != null)
                {
                    LoadIssues(issues, filter);

                    if (_source?.Count > 0)
                    {
                        this.IssueList.Hidden = false;
                    }

                    _isRefreshingIssues = false;
                    ((MainViewController)this.MainViewController).UnblockUI();
                }
                else
                {
                    AppController.Utility.ExecuteOnAsyncTask(_cts0.Token,
                                                             () =>
                    {
                        issues = AppController.GetIssues(_gimmickId);
                    },
                                                             () =>
                    {
                        LoadIssues(issues, filter);

                        if (_source?.Count > 0)
                        {
                            this.IssueList.Hidden = false;
                        }

                        _isRefreshingIssues = false;
                        ((MainViewController)this.MainViewController).UnblockUI();
                    });
                }
            });
        }