async public Task<AlertMessageResult> ShowAsync(string text,
            string caption = "",
            AlertMessageButtons buttons = AlertMessageButtons.OK,
            AlertMessageIcon icon = AlertMessageIcon.None) {

            _buttonPressed = "";
            AlertMessageResult result = AlertMessageResult.None;

            if (text != null && text.Trim() != "") {
                text = text.Trim();
                if (caption == null) { caption = "Message"; } else { caption = caption.Trim(); }

                MessageDialog myMessage = new MessageDialog(text, caption);

                #region Figure out the buttons
                switch (buttons) {
                    case AlertMessageButtons.AbortRetryIgnore:
                        myMessage.Commands.Add(new UICommand("Abort", new UICommandInvokedHandler(this.CommandInvokedHandler)));
                        myMessage.Commands.Add(new UICommand("Retry", new UICommandInvokedHandler(this.CommandInvokedHandler)));
                        myMessage.Commands.Add(new UICommand("Ignore", new UICommandInvokedHandler(this.CommandInvokedHandler)));
                        myMessage.CancelCommandIndex = 0;
                        myMessage.DefaultCommandIndex = 1;
                        break;
                    case AlertMessageButtons.OK:
                        myMessage.Commands.Add(new UICommand("OK", new UICommandInvokedHandler(this.CommandInvokedHandler)));
                        myMessage.DefaultCommandIndex = 0;
                        break;
                    case AlertMessageButtons.OKCancel:
                        myMessage.Commands.Add(new UICommand("OK", new UICommandInvokedHandler(this.CommandInvokedHandler)));
                        myMessage.Commands.Add(new UICommand("Cancel", new UICommandInvokedHandler(this.CommandInvokedHandler)));
                        myMessage.DefaultCommandIndex = 0;
                        myMessage.CancelCommandIndex = 1;
                        break;
                    case AlertMessageButtons.RetryCancel:
                        myMessage.Commands.Add(new UICommand("Retry", new UICommandInvokedHandler(this.CommandInvokedHandler)));
                        myMessage.Commands.Add(new UICommand("Cancel", new UICommandInvokedHandler(this.CommandInvokedHandler)));
                        myMessage.DefaultCommandIndex = 0;
                        myMessage.CancelCommandIndex = 1;
                        break;
                    case AlertMessageButtons.YesNo:
                        myMessage.Commands.Add(new UICommand("Yes", new UICommandInvokedHandler(this.CommandInvokedHandler)));
                        myMessage.Commands.Add(new UICommand("No", new UICommandInvokedHandler(this.CommandInvokedHandler)));
                        myMessage.DefaultCommandIndex = 0;
                        myMessage.CancelCommandIndex = 1;
                        break;
                    case AlertMessageButtons.YesNoCancel:
                        myMessage.Commands.Add(new UICommand("Yes", new UICommandInvokedHandler(this.CommandInvokedHandler)));
                        myMessage.Commands.Add(new UICommand("No", new UICommandInvokedHandler(this.CommandInvokedHandler)));
                        myMessage.Commands.Add(new UICommand("Cancel", new UICommandInvokedHandler(this.CommandInvokedHandler)));
                        myMessage.DefaultCommandIndex = 0;
                        myMessage.CancelCommandIndex = 2;
                        break;
                    default:
                        throw new ArgumentException("The specified AlertMessage button set is not available in Windows Store projects.", "buttons");
                        break;
                }
                #endregion

                await myMessage.ShowAsync();

                #region Figure out the result
                switch (_buttonPressed) {
                    case "Abort":
                        result = AlertMessageResult.Abort;
                        break;
                    case "Cancel":
                        result = AlertMessageResult.Cancel;
                        break;
                    case "Ignore":
                        result = AlertMessageResult.Ignore;
                        break;
                    case "No":
                        result = AlertMessageResult.No;
                        break;
                    case "OK":
                        result = AlertMessageResult.OK;
                        break;
                    case "Retry":
                        result = AlertMessageResult.Retry;
                        break;
                    case "Yes":
                        result = AlertMessageResult.Yes;
                        break;
                    default:
                        result = AlertMessageResult.None;
                        break;
                }
                #endregion
            }

            return result;
        }
        async public Task<AlertMessageResult> ShowAsync(string text, 
            string caption = "", 
            AlertMessageButtons buttons = AlertMessageButtons.OK, 
            AlertMessageIcon icon = AlertMessageIcon.None) {

            AlertMessageResult result = AlertMessageResult.None;

            if (text != null && text.Trim() != "") {
                text = text.Trim();
                if (caption == null) { caption = "Message"; } else { caption = caption.Trim(); }

                MessageBoxButton myButton = MessageBoxButton.OK;
                #region Figure out the button
                switch (buttons) {
                    case AlertMessageButtons.AbortRetryIgnore:
                        throw new NotImplementedException("The AbortRetryIgnore AlertMessage button set is not implemented in WPF.");
                        break;
                    case AlertMessageButtons.OK:
                        myButton = MessageBoxButton.OK;
                        break;
                    case AlertMessageButtons.OKCancel:
                        myButton = MessageBoxButton.OKCancel;
                        break;
                    case AlertMessageButtons.RetryCancel:
                        throw new NotImplementedException("The RetryCancel AlertMessage button set is not implemented in WPF.");
                        break;
                    case AlertMessageButtons.YesNo:
                        myButton = MessageBoxButton.YesNo;
                        break;
                    case AlertMessageButtons.YesNoCancel:
                        myButton = MessageBoxButton.YesNoCancel;
                        break;
                    default:
                        throw new ArgumentException("The specified AlertMessage button set is not available in WPF projects.", "buttons");
                        break;
                }
                #endregion

                MessageBoxImage myIcon = MessageBoxImage.None;
                #region Figure out the icon
                switch (icon) {
                    case AlertMessageIcon.Asterisk:
                        myIcon = MessageBoxImage.Asterisk;
                        break;
                    case AlertMessageIcon.Error:
                        myIcon = MessageBoxImage.Error;
                        break;
                    case AlertMessageIcon.Exclamation:
                        myIcon = MessageBoxImage.Exclamation;
                        break;
                    case AlertMessageIcon.Hand:
                        myIcon = MessageBoxImage.Hand;
                        break;
                    case AlertMessageIcon.Information:
                        myIcon = MessageBoxImage.Information;
                        break;
                    case AlertMessageIcon.None:
                        myIcon = MessageBoxImage.None;
                        break;
                    case AlertMessageIcon.Question:
                        myIcon = MessageBoxImage.Question;
                        break;
                    case AlertMessageIcon.Stop:
                        myIcon = MessageBoxImage.Stop;
                        break;
                    case AlertMessageIcon.Warning:
                        myIcon = MessageBoxImage.Warning;
                        break;
                    default:
                        throw new ArgumentException("The specified AlertMessage icon set is not available in WPF projects.", "icon");
                        break;
                }
                #endregion

                MessageBoxResult myResult = MessageBox.Show(text, caption, myButton, myIcon);
                #region Figure out the result
                switch (myResult) {
                    case MessageBoxResult.Cancel:
                        result = AlertMessageResult.Cancel;
                        break;
                    case MessageBoxResult.No:
                        result = AlertMessageResult.No;
                        break;
                    case MessageBoxResult.OK:
                        result = AlertMessageResult.OK;
                        break;
                    case MessageBoxResult.Yes:
                        result = AlertMessageResult.Yes;
                        break;
                    case MessageBoxResult.None:
                        result = AlertMessageResult.None;
                        break;
                }
                #endregion
            }
            
            return result;
        }
        public Task<AlertMessageResult> ShowAsync(string text, 
            string caption = "", 
            AlertMessageButtons buttons = AlertMessageButtons.OK, 
            AlertMessageIcon icon = AlertMessageIcon.None)
        {
            _tcs = new TaskCompletionSource<AlertMessageResult>();
            var activity = Mvx.Resolve<IMvxAndroidCurrentTopActivity>().Activity;

            if (activity == null) {
                Console.WriteLine("Couldn't find top activity.");
            }

            if (activity != null && text != null && text.Trim() != "") {
                text = text.Trim();
                if (caption == null) { caption = "Message"; } else { caption = caption.Trim(); }

                var dialog = new AlertDialog.Builder(activity);
                //TODO: Figure out how set the custom title
                //if (caption != "") { builder.SetCustomTitle(need to create custom view from caption); }
                dialog.SetMessage(text);
                dialog.SetCancelable(false);

                #region Figure out the buttons
                switch (buttons) {
                    case AlertMessageButtons.AbortRetryIgnore:
                        dialog.SetPositiveButton("Retry", delegate { _tcs.SetResult(AlertMessageResult.Retry); });
                        dialog.SetNeutralButton("Ignore", delegate { _tcs.SetResult(AlertMessageResult.Ignore); });
                        dialog.SetNegativeButton("Abort", delegate { _tcs.SetResult(AlertMessageResult.Abort); });
                        break;
                    case AlertMessageButtons.OK:
                        dialog.SetPositiveButton("OK", delegate { _tcs.SetResult(AlertMessageResult.OK); });
                        break;
                    case AlertMessageButtons.OKCancel:
                        dialog.SetPositiveButton("OK", delegate { _tcs.SetResult(AlertMessageResult.OK); });
                        dialog.SetNegativeButton("Cancel", delegate { _tcs.SetResult(AlertMessageResult.Cancel); });
                        break;
                    case AlertMessageButtons.RetryCancel:
                        dialog.SetPositiveButton("Retry", delegate { _tcs.SetResult(AlertMessageResult.Retry); });
                        dialog.SetNegativeButton("Cancel", delegate { _tcs.SetResult(AlertMessageResult.Cancel); });
                        break;
                    case AlertMessageButtons.YesNo:
                        dialog.SetPositiveButton("Yes", delegate { _tcs.SetResult(AlertMessageResult.Yes); });
                        dialog.SetNegativeButton("No", delegate { _tcs.SetResult(AlertMessageResult.No); });
                        break;
                    case AlertMessageButtons.YesNoCancel:
                        dialog.SetPositiveButton("Yes", delegate { _tcs.SetResult(AlertMessageResult.Yes); });
                        dialog.SetNeutralButton("No", delegate { _tcs.SetResult(AlertMessageResult.No); });
                        dialog.SetNegativeButton("Cancel", delegate { _tcs.SetResult(AlertMessageResult.Cancel); });
                        break;
                    default:
                        throw new ArgumentException("The specified AlertMessage button set is not available in Android projects.", "buttons");
                        break;
                }
                #endregion

                dialog.Create().Show();
            }
            else {
                _tcs.SetResult(AlertMessageResult.None);
            }

            return _tcs.Task;
        }
        public Task<AlertMessageResult> ShowAsync(string text, 
            string caption = "", 
            AlertMessageButtons buttons = AlertMessageButtons.OK, 
            AlertMessageIcon icon = AlertMessageIcon.None)
        {
            _tcs = new TaskCompletionSource<AlertMessageResult>();

            if (text != null && text.Trim() != "") {
                text = text.Trim();
                if (caption == null) { caption = "Message"; } else { caption = caption.Trim(); }

                Console.WriteLine("Showing message: " + text);

                UIAlertView alert = new UIAlertView {
                    Title = caption,
                    Message = text
                };

                #region Figure out the buttons
                switch (buttons) {
                    case AlertMessageButtons.AbortRetryIgnore:
                        alert.AddButton("Abort");
                        alert.AddButton("Retry");
                        alert.AddButton("Ignore");
                        alert.Clicked += (s, e) => {
                            switch (e.ButtonIndex) {
                                case 0:
                                    _tcs.SetResult(AlertMessageResult.Abort);
                                    break;
                                case 1:
                                    _tcs.SetResult(AlertMessageResult.Retry);
                                    break;
                                case 2:
                                    _tcs.SetResult(AlertMessageResult.Ignore);
                                    break;
                                default:
                                    _tcs.SetResult(AlertMessageResult.None);
                                    break;
                            }
                        };
                        break;
                    case AlertMessageButtons.OK:
                        alert.AddButton("OK");
                        alert.Clicked += (s, e) => {
                            switch (e.ButtonIndex) {
                                case 0:
                                    _tcs.SetResult(AlertMessageResult.OK);
                                    break;
                                default:
                                    _tcs.SetResult(AlertMessageResult.None);
                                    break;
                            }
                        };
                        break;
                    case AlertMessageButtons.OKCancel:
                        alert.AddButton("OK");
                        alert.AddButton("Cancel");
                        alert.Clicked += (s, e) => {
                            switch (e.ButtonIndex) {
                                case 0:
                                    _tcs.SetResult(AlertMessageResult.OK);
                                    break;
                                case 1:
                                    _tcs.SetResult(AlertMessageResult.Cancel);
                                    break;
                                default:
                                    _tcs.SetResult(AlertMessageResult.None);
                                    break;
                            }
                        };
                        break;
                    case AlertMessageButtons.RetryCancel:
                        alert.AddButton("Retry");
                        alert.AddButton("Cancel");
                        alert.Clicked += (s, e) => {
                            switch (e.ButtonIndex) {
                                case 0:
                                    _tcs.SetResult(AlertMessageResult.Retry);
                                    break;
                                case 1:
                                    _tcs.SetResult(AlertMessageResult.Cancel);
                                    break;
                                default:
                                    _tcs.SetResult(AlertMessageResult.None);
                                    break;
                            }
                        };
                        break;
                    case AlertMessageButtons.YesNo:
                        alert.AddButton("Yes");
                        alert.AddButton("No");
                        alert.Clicked += (s, e) => {
                            switch (e.ButtonIndex) {
                                case 0:
                                    _tcs.SetResult(AlertMessageResult.Yes);
                                    break;
                                case 1:
                                    _tcs.SetResult(AlertMessageResult.No);
                                    break;
                                default:
                                    _tcs.SetResult(AlertMessageResult.None);
                                    break;
                            }
                        };
                        break;
                    case AlertMessageButtons.YesNoCancel:
                        alert.AddButton("Yes");
                        alert.AddButton("No");
                        alert.AddButton("Cancel");
                        alert.Clicked += (s, e) => {
                            switch (e.ButtonIndex) {
                                case 0:
                                    _tcs.SetResult(AlertMessageResult.Yes);
                                    break;
                                case 1:
                                    _tcs.SetResult(AlertMessageResult.No);
                                    break;
                                case 2:
                                    _tcs.SetResult(AlertMessageResult.Cancel);
                                    break;
                                default:
                                    _tcs.SetResult(AlertMessageResult.None);
                                    break;
                            }
                        };
                        break;
                    default:
                        throw new ArgumentException("The specified AlertMessage button set is not available in iOS projects.", "buttons");
                        break;
                }
                #endregion

                alert.Show();
            }
            else {
                _tcs.SetResult(AlertMessageResult.None);
            }

            return _tcs.Task;
        }