Exemplo n.º 1
0
        public override void ViewDidAppear(bool animated)
        {
            //			if (_isLoaded)
            //			{
            //				DidRotate(new UIInterfaceOrientation());
            //				return;
            //			}

            base.ViewDidAppear (animated);

            AddComponents ();

            Init ();

            var lbl = new UILabel (new RectangleF(100,0,100,30));
            lbl.Text = "Загрузка";
            lbl.BackgroundColor = UIColor.FromRGBA (0, 0, 0, 0);
            lbl.TextColor = UIColor.White;
            var activitySpinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
            activitySpinner.Frame = new RectangleF (0,-35,50,50);
            activitySpinner.AutoresizingMask = UIViewAutoresizing.FlexibleMargins;
            activitySpinner.StartAnimating ();
            _alert = new UIAlertView();
            _alert.Frame.Size = new SizeF (60, 60);
            _alert.AddSubview(activitySpinner);
            _alert.AddSubview (lbl);
            _alert.Show();
            _twitterConection.GeTwittstByTag(_tag, GetNumberOfRows());
            _isSelected = false;
        }
        private void PromptForName(HandlerToUse handlerType)
        {
            UITextField tf = new UITextField(new System.Drawing.RectangleF(12f, 45f, 260f, 25f));

            tf.BackgroundColor        = UIColor.White;
            tf.UserInteractionEnabled = true;
            tf.AutocorrectionType     = UITextAutocorrectionType.No;
            tf.AutocapitalizationType = UITextAutocapitalizationType.None;
            tf.ReturnKeyType          = UIReturnKeyType.Done;
            tf.SecureTextEntry        = false;       // Set this to true if you want a password-style text masking

            UIAlertView myAlertView = new UIAlertView()
            {
                Title   = "Please enter your name",
                Message = "this is hidden"
            };

            myAlertView.AddButton("Cancel");
            myAlertView.AddButton("Ok");
            myAlertView.AddSubview(tf);

            if (handlerType == HandlerToUse.Delegate)
            {
                myAlertView.Delegate = new MyAlertDelegate(this);
            }
            else
            {
                myAlertView.Clicked += HandleMyAlertViewClicked;
            }

            myAlertView.Transform = MonoTouch.CoreGraphics.CGAffineTransform.MakeTranslation(0f, 110f);
            myAlertView.Show();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _client = new TwitterClient();

            var loading = new UIAlertView("Downloading Tweets", "Please wait...", null, null, null);
            loading.Show();

            var indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
            indicator.Center = new System.Drawing.PointF(loading.Bounds.Width / 2, loading.Bounds.Size.Height - 40);
            indicator.StartAnimating();
            loading.AddSubview (indicator);

            _client.GetTweetsForUser ("OReillyMedia", tweets =>
            {
                InvokeOnMainThread(() =>
              	{
                    TableView.Source = new TwitterTableViewSource(tweets);
                    TableView.ReloadData();
                    loading.DismissWithClickedButtonIndex (0, true);
                });
            });

            _client.MentionReceived += (object sender, MentionEventArgs args) =>
            {
                InvokeOnMainThread(() =>
                    new UIAlertView("Mention Received", args.Tweet.Text,
                                    null, "Ok", null).Show());
            };
        }
Exemplo n.º 4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _client = new TwitterClient();

            var loading = new UIAlertView("Downloading Tweets", "Please wait...", null, null, null);

            loading.Show();

            var indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);

            indicator.Center = new System.Drawing.PointF(loading.Bounds.Width / 2, loading.Bounds.Size.Height - 40);
            indicator.StartAnimating();
            loading.AddSubview(indicator);

            _client.GetTweetsForUser("OReillyMedia", tweets =>
            {
                InvokeOnMainThread(() =>
                {
                    TableView.Source = new TwitterTableViewSource(tweets);
                    TableView.ReloadData();
                    loading.DismissWithClickedButtonIndex(0, true);
                });
            });

            _client.MentionReceived += (object sender, MentionEventArgs args) =>
            {
                InvokeOnMainThread(() =>
                                   new UIAlertView("Mention Received", args.Tweet.Text,
                                                   null, "Ok", null).Show());
            };
        }
        public async Task Display(string message, Xamarin.Forms.ImageSource imageSource)
        {
            var handler = GetHandler(imageSource);
            var image   = await handler.LoadImageAsync(imageSource);

            if (image != null)
            {
                var view = new UIView();

                if (!string.IsNullOrWhiteSpace(message))
                {
                    var label = new UILabel()
                    {
                        Text = message
                    };
                    view.AddSubview(label);
                }

                var imageView = new UIImageView(image);
                view.AddSubview(imageView);

                var alertView = new UIAlertView();
                alertView.AddSubview(view);
                alertView.Show();
            }
            else
            {
                throw new ArgumentNullException("Image is null");
            }
        }
        private UIAlertView CrearAlerta()
        {
            // manejar inicio de sesion aqui.
            String title = "Obteniendo lista de maestros";
            String message = "Descargando lista de maestros";

            // crear spinner
            UIActivityIndicatorView spinner = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge);

            // Crea la intancia de alerta e inicializa sus valores
            UIAlertView alerta = new UIAlertView (title, message, null, null, null);
            alerta.Title = title;
            alerta.Message = message;
            alerta.Delegate = null;

            // mostrar alerta siempre
            alerta.Show ();

            // le damos las coordenadas, lo agregamos y hechamos a andar
            spinner.Center = new System.Drawing.PointF (alerta.Bounds.Size.Width / 2,
                                                        alerta.Bounds.Size.Height - 50);

            alerta.AddSubview (spinner);
            spinner.StartAnimating ();

            return alerta;
        }
 public ActivityIndicator(String title)
 {
     _alert    = new UIAlertView(title, String.Empty, null, null, null);
     _ai       = new UIActivityIndicatorView();
     _ai.Frame = new System.Drawing.RectangleF(125, 50, 40, 40);
     _ai.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge;
     _alert.AddSubview(_ai);
     _ai.StartAnimating();
     _alert.Show();
 }
Exemplo n.º 8
0
 private void CreateAlert()
 {
     _alert = new UIAlertView(new RectangleF(10, 56, 300, 200));
     _alert.AlertViewStyle = UIAlertViewStyle.Default;
     _alert.Title = "HashBot";
     _alert.Message = "Загрузка данных...";
     var indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
     indicator.Center = new PointF(139.5f, 100);
     indicator.StartAnimating();
     _alert.AddSubview(indicator);
 }
Exemplo n.º 9
0
	    public static void Show(string title)
	    {
			if(_alertView != null){
				_alertView.Title = title;
				return;
			}
			_alertView = new UIAlertView();
			
	    	_alertView.Title = title;
	    	_alertView.Show();
			
			_activityView = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
			
	    	_activityView.Frame = new RectangleF((_alertView.Bounds.Width / 2) - 15, _alertView.Bounds.Height - 50, 30, 30);
	    	_activityView.StartAnimating();
			
			_alertView.AddSubview(_activityView);
	    }
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear (animated);

            _client = new RemoteDataRepository (_baseUrl);

            var loading = new UIAlertView ("Downloading Session", "Please wait...", null, null, null);

            loading.Show ();

            var indicator = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge);
            indicator.Center = new System.Drawing.PointF (loading.Bounds.Width / 2, loading.Bounds.Size.Height - 40);
            indicator.StartAnimating ();
            loading.AddSubview (indicator);

            _client.GetSession ("CodeMash-2012", this.SessionSlug, session =>
            {
                InvokeOnMainThread (() =>
                {
                    //new UIAlertView ("Session", session.title, null, "Ok", null).Show ();
                    this.sessionTitleLabel.Text = session.title;
                    this.sessionEndLabel.Text = session.end.ToString ();
                    this.sessionStartLabel.Text = session.start.ToString();
                    this.sessionTwitterHashTagLabel.Text = session.twitterHashTag;
                    loading.DismissWithClickedButtonIndex (0, true);
                }
                );
            }
            );

            // Perform any additional setup after loading the view, typically from a nib.

            //this.TableView.Source = new DataSource (this);

            //			if (!UserInterfaceIdiomIsPhone) {
            //				this.TableView.SelectRow (
            //					NSIndexPath.FromRowSection (0, 0),
            //					false,
            //					UITableViewScrollPosition.Middle
            //				);
            //			}
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            var backgroundImage = UIImage.FromBundle(@"images/appview/bg");
            //this.View.BackgroundColor = UIColor.FromPatternImage(backgroundImage);

            _client = new RemoteDataRepository (_baseUrl);

            var loading = new UIAlertView (" Downloading Speakers", "Please wait...", null, null, null);

            loading.Show ();

            var indicator = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge);
            indicator.Center = new System.Drawing.PointF (loading.Bounds.Width / 2, loading.Bounds.Size.Height - 40);
            indicator.StartAnimating ();
            loading.AddSubview (indicator);

            _client.GetSpeakers ("CodeMash-2012", speakers =>
            {
                InvokeOnMainThread (() =>
                {
                    TableView.Source = new SpeakersTableViewSource (this, speakers);
                    TableView.ReloadData ();
                    loading.DismissWithClickedButtonIndex (0, true);
                }
                );
            }
            );

            // Perform any additional setup after loading the view, typically from a nib.

            //this.TableView.Source = new DataSource (this);

            if (!UserInterfaceIdiomIsPhone)
                this.TableView.SelectRow (
                    NSIndexPath.FromRowSection (0, 0),
                    false,
                    UITableViewScrollPosition.Middle
                );
        }
 public void LoadTable(bool skipRefresh)
 {
     if (!skipRefresh)
     {
         var loading = new UIAlertView("DLoad".t(), "Wait".t(), null, null, null);
         loading.Show();
         var indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
         indicator.Center = new PointF(loading.Bounds.Width / 2, loading.Bounds.Size.Height - 40);
         indicator.StartAnimating();
         loading.AddSubview(indicator);
         RefreshTable(loading);
     }
     else if (_fromMenu)
     {
         var publications = _parser.Publications;
         TableView.Source = new PublicationsViewSource(publications, NavigationController);
         TableView.ReloadData();
     }
     else
     {
         RefreshTable();
     }
 }
Exemplo n.º 13
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            tvTabela.Delegate   = new tvTabelaDelegate();
            tvTabela.DataSource = new tvTabelaDataSource();
            (tvTabela.Delegate as tvTabelaDelegate).OnSelected = (item) => {
                lblSegundaTela.Text = string.Format("Selecionado: {0}", item);
            };
            (tvTabela.Delegate as tvTabelaDelegate).OnInsert = () => {
                var texto = new UITextField();
                texto.Placeholder = "novo item";
                var alerta = new UIAlertView("Novo item", "Insira o novo item", null, "OK");
                //alerta.AlertViewStyle = UIAlertViewStyle.PlainTextInput;
                alerta.AddSubview(texto);
                alerta.Show();
                return(texto.Text);
            };

            btnEditar.TouchUpInside += (sender, e) => {
                if (tvTabela.Editing)
                {
                    btnEditar.SetTitle("Editar", UIControlState.Normal);
                    tvTabela.SetEditing(false, true);
                    (tvTabela.Delegate as tvTabelaDelegate).DidEndEditing(tvTabela);
                    NavigationController.SetNavigationBarHidden(false, true);
                }
                else
                {
                    btnEditar.SetTitle("OK", UIControlState.Normal);
                    (tvTabela.Delegate as tvTabelaDelegate).WillBeginEditing(tvTabela);
                    tvTabela.SetEditing(true, true);
                    NavigationController.SetNavigationBarHidden(true, true);
                }
            };
        }
        protected void StartActivityAnimation(string title)
        {
            if (activityAlert != null)
            {
                StopActivityAnimation();
            }

            activityAlert = new UIAlertView
            {
                Title = title
            };

            var indicator = new UIActivityIndicatorView
            {
                ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.White,
                Center           = new CGPoint(activityAlert.Bounds.GetMidX(), activityAlert.Bounds.GetMidY()),
                AutoresizingMask = UIViewAutoresizing.FlexibleMargins
            };

            indicator.StartAnimating();

            activityAlert.AddSubview(indicator);
            activityAlert.Show();
        }
Exemplo n.º 15
0
        private Task <IDialogAnswer <DateTime> > ShowDateTimeDialog(string caption, UIDatePickerMode mode, DateTime current,
                                                                    IDialogButton positive, IDialogButton negative)
        {
            var tcs     = new TaskCompletionSource <IDialogAnswer <DateTime> >();
            var version = new Version(UIDevice.CurrentDevice.SystemVersion);

            if (version.Major >= 7)
            {
                var picker = new DatePicker();
                picker.Title = caption;
                picker.NativeDatePicker.Mode = mode;
                picker.NativeDatePicker.Date = current;
                picker.DoneTitle             = positive.Caption;
                picker.CancelTitle           = negative.Caption;
                picker.Click += (sender, e) =>
                {
                    if (tcs.Task.Status < TaskStatus.RanToCompletion)
                    {
                        NSDate   dateTime = (sender as DatePicker).NativeDatePicker.Date;
                        DateTime result   = dateTime != null
                            ? System.DateTime.SpecifyKind(dateTime, DateTimeKind.Utc).ToLocalTime()
                            : System.DateTime.MinValue;

                        if (e.ButtonIndex == 0)
                        {
                            tcs.SetResult(new DialogAnswer <DateTime>(true, result));
                        }
                        else if (e.ButtonIndex == 1)
                        {
                            tcs.SetResult(new DialogAnswer <DateTime>(false, result));
                        }
                    }
                };

                picker.Show(_context.MainController.View,
                            (ScreenController)_context.MainController.VisibleViewController);
            }
            else
            {
                var alertView = new UIAlertView(caption, "", null, positive.Caption, negative.Caption);
                alertView.Show();
                _alertViews.Add(alertView);

                var datePicker = new UIDatePicker();
                datePicker.Frame = new RectangleF(10, alertView.Bounds.Size.Height, 270, 150);
                datePicker.Mode  = UIDatePickerMode.Date;
                datePicker.Date  = current;
                alertView.AddSubview(datePicker);

                var timePicker = new UIDatePicker();
                timePicker.Frame = new RectangleF(10, alertView.Bounds.Size.Height + 150 + 20, 270, 150);
                timePicker.Mode  = UIDatePickerMode.Time;
                timePicker.Date  = current;
                alertView.AddSubview(timePicker);

                alertView.Clicked += (sender, e) =>
                {
                    DateTime date   = System.DateTime.SpecifyKind(datePicker.Date, DateTimeKind.Unspecified);
                    DateTime time   = System.DateTime.SpecifyKind(timePicker.Date, DateTimeKind.Utc).ToLocalTime();
                    var      result = new DateTime(date.Year, date.Month, date.Day, time.Hour, time.Minute, time.Second);
                    if (e.ButtonIndex == 0)
                    {
                        tcs.SetResult(new DialogAnswer <DateTime>(true, result));
                    }
                    else if (e.ButtonIndex == 1)
                    {
                        tcs.SetResult(new DialogAnswer <DateTime>(false, result));
                    }

                    var av = (UIAlertView)sender;
                    _alertViews.Remove(av);
                    av.Dispose();
                };

                alertView.Bounds = new RectangleF(0, 0, 290, alertView.Bounds.Size.Height + 150 + 150 + 20 + 30);
            }
            return(tcs.Task);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Shows the alert progress dialog.
        /// </summary>
        /// <param name="title">The title.</param>
        /// <param name="text">The text.</param>
        public static void ShowAlertProgress(string title, string text)
        {
            UIApplication.SharedApplication.InvokeOnMainThread(
                () =>
                {
                    if (_alertView != null)
                    {
                        _alertView.DismissWithClickedButtonIndex(-1, true);
                    }

                    _alertView = new UIAlertView(title, text ?? string.Empty, null, null, null);
                    _alertView.Show();

                    var activityView =
                        new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge)
                        {
                            Frame = new RectangleF((_alertView.Bounds.Width / 2) - 15, _alertView.Bounds.Height - 60, 30, 30)
                        };
                    activityView.StartAnimating();
                    _alertView.AddSubview(activityView);
                });
        }
Exemplo n.º 17
0
        public static void Show(string messageText)
        {
            var mb = new UIAlertView{Message = messageText};
            var back = new UIImageView(new UIImage("Images/messageBoxBack.png"));

            mb.Show();
            mb.Subviews[0].Alpha = 0f;
            var label = ((UILabel) mb.Subviews[1]);
            label.TextColor = UIColor.DarkGray;
            label.ShadowColor = UIColor.Clear;
            back.Frame = new RectangleF(0,0,mb.Bounds.Width, mb.Bounds.Height);
            back.Layer.CornerRadius = 15;
            back.Layer.MasksToBounds = true;
            back.Layer.BorderColor = UIColor.FromRGB(193,183,154).CGColor;
            back.Layer.BorderWidth = 2f;

            mb.AddSubview(back);
            mb.SendSubviewToBack(back);
        }
        /// <inheritdoc />
        public override void Show(string caption, object content, ButtonConfig[] buttonConfigs, bool isFullScreen = false)
        {
            Guard.ArgumentNotNull(() => buttonConfigs);

            var stringContent = content as string;

            if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
            {
                var alertController = UIAlertController.Create(caption, string.Empty, UIAlertControllerStyle.Alert);
                if (stringContent != null)
                {
                    alertController.Message = stringContent;
                }

                var view = content as UIView;
                if (view != null)
                {
                    UIViewController v = new UIViewController();
                    v.View = view;
                    alertController.SetValueForKey(v, new NSString("contentViewController"));

                    //alertController.View.AddSubview(view);
                }

                foreach (var buttonConfig in buttonConfigs)
                {
                    var alertAction = UIAlertAction.Create(buttonConfig.Text, UIAlertActionStyle.Default, x => buttonConfig.Action());

                    EventHandler<bool> buttonConfigOnEnabledChanged = null;
                    buttonConfigOnEnabledChanged = (sender, isEnabled) => { alertAction.Enabled = isEnabled; };
                    buttonConfig.EnabledChanged += buttonConfigOnEnabledChanged;
                    alertAction.Enabled = buttonConfig.IsEnabled;
                    alertController.AddAction(alertAction);
                }

                this.dispatcherService.CheckBeginInvokeOnUI(() => { UIApplication.SharedApplication.PresentInternal(alertController); });
            }
            else
            {
                var alertView = new UIAlertView
                {
                    AlertViewStyle = UIAlertViewStyle.Default,
                    Title = caption
                };

                if (stringContent != null)
                {
                    alertView.Message = stringContent;
                }

                var view = content as UIView;
                if (view != null)
                {
                    alertView.AddSubview(view);
                }

                foreach (var buttonConfig in buttonConfigs)
                {
                    alertView.AddButton(buttonConfig.Text);
                }

                alertView.Clicked += (s, e) => { buttonConfigs[e.ButtonIndex].Action(); };

                this.dispatcherService.CheckBeginInvokeOnUI(() => { alertView.Show(); });
            }
        }
        private void CrearAlerta()
        {
            // manejar inicio de sesion aqui.
            String title = "Validando alumno";
            String message = "Estamos validando el ID y NIP, esperanos un poco...";

            // crear spinner
            UIActivityIndicatorView spinner = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge);

            // Crea la intancia de alerta e inicializa sus valores
            this.mAlert = new UIAlertView (title, message, null, null, null);
            this.mAlert.Title = title;
            this.mAlert.Message = message;
            this.mAlert.Delegate = null;

            // mostrar alerta siempre
            this.mAlert.Show ();

            // le damos las coordenadas, lo agregamos y hechamos a andar
            spinner.Center = new System.Drawing.PointF (mAlert.Bounds.Size.Width / 2,
                                                        mAlert.Bounds.Size.Height - 50);

            mAlert.AddSubview (spinner);
            spinner.StartAnimating ();
        }
        private void PromptForName(HandlerToUse handlerType)
        {
            UITextField tf = new UITextField (new System.Drawing.RectangleF (12f, 45f, 260f, 25f));
            tf.BackgroundColor = UIColor.White;
            tf.UserInteractionEnabled = true;
            tf.AutocorrectionType = UITextAutocorrectionType.No;
            tf.AutocapitalizationType = UITextAutocapitalizationType.None;
            tf.ReturnKeyType = UIReturnKeyType.Done;
            tf.SecureTextEntry = false;  // Set this to true if you want a password-style text masking

            UIAlertView myAlertView = new UIAlertView()
            {
                Title = "Please enter your name",
                Message = "this is hidden"
            };

            myAlertView.AddButton("Cancel");
            myAlertView.AddButton("Ok");
            myAlertView.AddSubview(tf);

            if (handlerType == HandlerToUse.Delegate)
            {
                myAlertView.Delegate = new MyAlertDelegate(this);
            }
            else
            {
                myAlertView.Clicked += HandleMyAlertViewClicked;
            }

            myAlertView.Transform = MonoTouch.CoreGraphics.CGAffineTransform.MakeTranslation (0f, 110f);
            myAlertView.Show ();
        }
Exemplo n.º 21
0
        public void ShowDateTimeDialog(string caption, UIDatePickerMode mode, DateTime current, DialogButton <DateTime> positive, DialogButton <DateTime> negative)
        {
            Version version = new Version(UIDevice.CurrentDevice.SystemVersion);

            if (version.Major >= 7)
            {
                DatePicker picker = new DatePicker();
                picker.Title = caption;
                picker.NativeDatePicker.Mode = mode;
                picker.NativeDatePicker.Date = current;
                picker.DoneTitle             = positive.Caption;
                picker.CancelTitle           = negative.Caption;
                picker.Click += (object sender, UIButtonEventArgs e) => {
                    var      dateTime = (sender as DatePicker).NativeDatePicker.Date;
                    DateTime result   = dateTime != null?System.DateTime.SpecifyKind(dateTime, DateTimeKind.Utc).ToLocalTime() : System.DateTime.MinValue;

                    if (e.ButtonIndex == 0)
                    {
                        positive.Execute(result);
                    }
                    else if (e.ButtonIndex == 1)
                    {
                        negative.Execute(result);
                    }
                };

                picker.Show(_context.MainController.View, (ScreenController)_context.MainController.VisibleViewController);
            }
            else
            {
                var alertView = new UIAlertView(caption, "", null, positive.Caption, negative.Caption);
                alertView.Show();
                _alertViews.Add(alertView);

                UIDatePicker datePicker = new UIDatePicker();
                datePicker.Frame = new System.Drawing.RectangleF(10, alertView.Bounds.Size.Height, 270, 150);
                datePicker.Mode  = UIDatePickerMode.Date;
                datePicker.Date  = current;
                alertView.AddSubview(datePicker);

                UIDatePicker timePicker = new UIDatePicker();
                timePicker.Frame = new System.Drawing.RectangleF(10, alertView.Bounds.Size.Height + 150 + 20, 270, 150);
                timePicker.Mode  = UIDatePickerMode.Time;
                timePicker.Date  = current;
                alertView.AddSubview(timePicker);

                alertView.Clicked += (object sender, UIButtonEventArgs e) => {
                    DateTime date   = System.DateTime.SpecifyKind(datePicker.Date, DateTimeKind.Unspecified);
                    DateTime time   = System.DateTime.SpecifyKind(timePicker.Date, DateTimeKind.Utc).ToLocalTime();
                    DateTime result = new DateTime(date.Year, date.Month, date.Day, time.Hour, time.Minute, time.Second);
                    if (e.ButtonIndex == 0)
                    {
                        positive.Execute(result);
                    }
                    else if (e.ButtonIndex == 1)
                    {
                        negative.Execute(result);
                    }

                    var av = (UIAlertView)sender;
                    _alertViews.Remove(av);
                    av.Dispose();
                };

                alertView.Bounds = new System.Drawing.RectangleF(0, 0, 290, alertView.Bounds.Size.Height + 150 + 150 + 20 + 30);
            }
        }
        /// <inheritdoc />
        public override void Show(string caption, object content, ButtonConfig[] buttonConfigs, bool isFullScreen = false)
        {
            Guard.ArgumentNotNull(() => buttonConfigs);

            var stringContent = content as string;

            if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
            {
                var alertController = UIAlertController.Create(caption, string.Empty, UIAlertControllerStyle.Alert);
                if (stringContent != null)
                {
                    alertController.Message = stringContent;
                }

                var view = content as UIView;
                if (view != null)
                {
                    UIViewController v = new UIViewController();
                    v.View = view;
                    alertController.SetValueForKey(v, new NSString("contentViewController"));

                    //alertController.View.AddSubview(view);
                }

                foreach (var buttonConfig in buttonConfigs)
                {
                    var alertAction = UIAlertAction.Create(buttonConfig.Text, UIAlertActionStyle.Default, x => buttonConfig.Action());

                    EventHandler <bool> buttonConfigOnEnabledChanged = null;
                    buttonConfigOnEnabledChanged = (sender, isEnabled) => { alertAction.Enabled = isEnabled; };
                    buttonConfig.EnabledChanged += buttonConfigOnEnabledChanged;
                    alertAction.Enabled          = buttonConfig.IsEnabled;
                    alertController.AddAction(alertAction);
                }

                this.dispatcherService.CheckBeginInvokeOnUI(() => { UIApplication.SharedApplication.PresentInternal(alertController); });
            }
            else
            {
                var alertView = new UIAlertView
                {
                    AlertViewStyle = UIAlertViewStyle.Default,
                    Title          = caption
                };

                if (stringContent != null)
                {
                    alertView.Message = stringContent;
                }

                var view = content as UIView;
                if (view != null)
                {
                    alertView.AddSubview(view);
                }

                foreach (var buttonConfig in buttonConfigs)
                {
                    alertView.AddButton(buttonConfig.Text);
                }

                alertView.Clicked += (s, e) => { buttonConfigs[e.ButtonIndex].Action(); };

                this.dispatcherService.CheckBeginInvokeOnUI(() => { alertView.Show(); });
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            var backgroundImage = UIImage.FromBundle(@"images/appview/bg");
            //this.View.BackgroundColor = UIColor.FromPatternImage(backgroundImage);

            _client = new RemoteDataRepository (_baseUrl);

            var loading = new UIAlertView (" Downloading Sessions", "Please wait...", null, null, null);

            loading.Show ();

            var indicator = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge);
            indicator.Center = new System.Drawing.PointF (loading.Bounds.Width / 2, loading.Bounds.Size.Height - 40);
            indicator.StartAnimating ();
            loading.AddSubview (indicator);

            //			_client.GetFullConference("CodeMash-2012", conference => {
            //				var connectionString = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments), "conferences.db");
            //				var localDatabase = new LocalDatabase(connectionString);
            //				localDatabase.CreateDatabase();
            //
            //				var conferenceMapper = new ConferenceDtoToConferenceEntityMapper();
            //				var conferenceEntity = conferenceMapper.Map(conference);
            //
            //				var sessionMapper = new SessionDtoToSessionEntityMapper();
            //				var sessions = sessionMapper.MapAll(conferenceEntity.Id, conference.sessions.AsEnumerable());
            //				//localDatabase.SaveSessions(sessions);
            //
            //				var speakersMapper = new SessionDtoToSessionEntityMapper();
            //				var speakerEntities = speakersMapper.MapAll(conferenceEntity.Id, conference.speakers.AsEnumerable());
            //				localDatabase.SaveConference(conferenceEntity, sessions, speakers);
            //
            //			});
            _client.GetSessions ("CodeMash-2012", sessions =>
            {
                InvokeOnMainThread (() =>
                {
                    TableView.Source = new SessionsTableViewSource (this, sessions);
                    TableView.ReloadData ();
                    loading.DismissWithClickedButtonIndex (0, true);
                });
            }
            );

            // Perform any additional setup after loading the view, typically from a nib.

            //this.TableView.Source = new DataSource (this);

            if (!UserInterfaceIdiomIsPhone)
                this.TableView.SelectRow (
                    NSIndexPath.FromRowSection (0, 0),
                    false,
                    UITableViewScrollPosition.Middle
                );
        }