Exemplo n.º 1
0
            public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
            {
                var cell = tableView.DequeueReusableCell(LocalBox_iOS.Views.Table.MenuViewCell.Key) as LocalBox_iOS.Views.Table.MenuViewCell;

                if (cell == null)
                {
                    cell = new LocalBox_iOS.Views.Table.MenuViewCell();
                }

                cell.ResetView();
                cell.Titel  = boxList[indexPath.Row].Name;
                cell.Delete = () =>
                {
                    UIAlertView alertView = new UIAlertView("Waarschuwing",
                                                            "Weet u zeker dat u deze Pleiobox wilt verwijderen? \nDeze actie is niet terug te draaien.",
                                                            null,
                                                            "Annuleer",
                                                            "Verwijder");
                    alertView.Clicked += delegate(object a, UIButtonEventArgs eventArgs) {
                        if (eventArgs.ButtonIndex == 1)
                        {
                            try{
                                var selectedRow = tableView.IndexPathForSelectedRow;

                                DataLayer.Instance.DeleteLocalBox(boxList[indexPath.Row].Id);
                                boxList.RemoveAt(indexPath.Row);
                                tableView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade);
                                tableView.ReloadData();
                                if (selectedRow != null && selectedRow.Row == indexPath.Row)
                                {
                                    _parent._home.RemoveDetail();
                                }
                            } catch (Exception ex) {
                                Insights.Report(ex);
                                DialogHelper.ShowErrorDialog("Fout", "Er is een fout opgetreden bij het verwijderen van de Pleiobox.\n" +
                                                             "Probeer het a.u.b. nogmaals.");
                            }
                        }
                    };
                    alertView.Show();
                };

                cell.OnPresentingDetails = (bool presenting, SlideViewTableCell source) =>
                {
                    ResetCells(tableView, source);
                    _presentingDetails = presenting;
                };

                return(cell);
            }
            public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
            {
                var cell = tableView.DequeueReusableCell (LocalBox_iOS.Views.Table.MenuViewCell.Key) as LocalBox_iOS.Views.Table.MenuViewCell;
                if (cell == null)
                    cell = new LocalBox_iOS.Views.Table.MenuViewCell();

                cell.ResetView();
                cell.Titel = boxList[indexPath.Row].Name;
                cell.Delete = () =>
                {

					UIAlertView alertView = new UIAlertView("Waarschuwing", 
						"Weet u zeker dat u deze Pleiobox wilt verwijderen? \nDeze actie is niet terug te draaien.", 
						null, 
						"Annuleer",
						"Verwijder");
					alertView.Clicked += delegate(object a, UIButtonEventArgs eventArgs) {
						if(eventArgs.ButtonIndex == 1){
							try{
								var selectedRow = tableView.IndexPathForSelectedRow;

								DataLayer.Instance.DeleteLocalBox(boxList[indexPath.Row].Id);
								boxList.RemoveAt(indexPath.Row);
								tableView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade);
								tableView.ReloadData();
								if(selectedRow != null && selectedRow.Row == indexPath.Row) {
									_parent._home.RemoveDetail();
								}
							} catch (Exception ex){
								Insights.Report(ex);
								DialogHelper.ShowErrorDialog("Fout", "Er is een fout opgetreden bij het verwijderen van de Pleiobox.\n" +
															 "Probeer het a.u.b. nogmaals.");
							}
						}
					};
					alertView.Show();
                };

                cell.OnPresentingDetails = (bool presenting, SlideViewTableCell source) =>
                {
                    ResetCells(tableView, source);
                    _presentingDetails = presenting;
                };

                return cell;
            }