public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndexPath indexPath) { UITableViewRowAction btnRemove = UITableViewRowAction.Create( UITableViewRowActionStyle.Destructive, "Fjern én", (action, path) => { if (path.Section != 0) { return; } var cartItem = this.viewModel.CartItems[indexPath.Row]; if (cartItem.Quantity > 1) { cartItem.Quantity--; return; } tableView.BeginUpdates(); this.viewModel.RemoveOne(cartItem); tableView.DeleteRows(new[] { indexPath }, UITableViewRowAnimation.Left); tableView.EndUpdates(); }); return(new[] { btnRemove }); }
public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndexPath indexPath) { if (editActions == null) { editActions = new[] { UITableViewRowAction.Create( UITableViewRowActionStyle.Normal, "Billable", OnFlipBillable), UITableViewRowAction.Create( UITableViewRowActionStyle.Normal, "Not Billable", OnFlipBillable), UITableViewRowAction.Create( UITableViewRowActionStyle.Destructive, "Delete", OnDelete), }; editActions[0].BackgroundColor = UIColor.Blue; } Expense expense = expenses[indexPath.Row]; var rowActions = new UITableViewRowAction[2]; rowActions[0] = (expense.Billable) ? editActions[1] : editActions[0]; rowActions[1] = editActions[2]; return(rowActions); }
private void handleDeleteTableViewRowAction(UITableViewRowAction _, NSIndexPath indexPath) { SwipeToDeleteWasUsed?.Invoke(this, EventArgs.Empty); var timeEntry = (TimeEntryViewModel)GetItemAt(indexPath); DeleteTimeEntryCommand.Execute(timeEntry); }
public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndexPath indexPath) { var item = categories[indexPath.Section].Items[indexPath.Row]; var exists = AppDelegate.databaseConnection.FavoriteCategoryAlreadyPresent(item.Key); string title = exists ? "\u2605" : "\u2606"; var favorite = UITableViewRowAction.Create(UITableViewRowActionStyle.Default, title, async delegate { tableView.SetEditing(false, true); if (exists) { await AppDelegate.databaseConnection.DeleteFavoriteCategoryAsync(item.Key); } else { await AppDelegate.databaseConnection.AddNewFavoriteCategoryAsync(item.Key, item.Value); } Console.WriteLine(AppDelegate.databaseConnection.StatusMessage); if (this.Favorited != null) { this.Favorited(this, new CategorySelectedEventArgs() { SelectedCat = item }); } }); favorite.BackgroundColor = ColorScheme.Carrot; return(new UITableViewRowAction[] { favorite }); }
void handleTableActionMore(UITableViewRowAction action, NSIndexPath indexPath) { activeAsset = saved ? savedAssets [indexPath.Row] : allAssets [indexPath.Row]; Log.Debug($"More: {activeAsset?.Music?.DisplayName}"); var alertController = UIAlertController.Create(activeAsset.Music.DisplayName, null, UIAlertControllerStyle.ActionSheet); var downloadState = AssetPersistenceManager.Shared.DownloadState(activeAsset); alertController.AddAction(UIAlertAction.Create("Share", UIAlertActionStyle.Default, handleAlertControllerActionShare)); switch (downloadState) { case MusicAssetDownloadState.NotDownloaded: alertController.AddAction(UIAlertAction.Create("Download", UIAlertActionStyle.Default, handleAlertControllerActionDownload)); break; case MusicAssetDownloadState.Downloading: alertController.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Destructive, handleAlertControllerActionCancel)); break; case MusicAssetDownloadState.Downloaded: alertController.AddAction(UIAlertAction.Create("Delete", UIAlertActionStyle.Destructive, handleAlertControllerActionDelete)); break; } alertController.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, handleAlertControllerActionDismiss)); PresentViewController(alertController, true, null); }
public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndexPath indexPath) { var actions = new UITableViewRowAction[1]; actions[0] = UITableViewRowAction.Create(UITableViewRowActionStyle.Destructive, "Delete", DeleteSample); return(actions); }
public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndexPath indexPath) { return(new UITableViewRowAction[] { UITableViewRowAction.Create(UITableViewRowActionStyle.Normal, "Open", OpenInBrowser) }); }
public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndexPath indexPath) { UITableViewRowAction deleteButton = UITableViewRowAction.Create( UITableViewRowActionStyle.Destructive, _delete, delegate { tableView.BeginUpdates(); tableView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Bottom); DeleteCallEvent?.Invoke(this, indexPath.Row); tableView.EndUpdates(); tableView.ReloadData(); }); deleteButton.BackgroundColor = Colors.Red; UITableViewRowAction infoButton = UITableViewRowAction.Create( UITableViewRowActionStyle.Normal, _info, delegate { CallStackEvent?.Invoke(this, indexPath.Row); }); infoButton.BackgroundColor = Colors.Orange; return(new UITableViewRowAction[] { deleteButton, infoButton }); }
public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndexPath indexPath) { var cell = tableView.CellAt(indexPath) as ExampleCell; UITableViewRowAction deleteAction = UITableViewRowAction.Create( UITableViewRowActionStyle.Default, "Delete", delegate { tableView.SetEditing(false, true); _controller.ViewModel.DeleteCell(cell.ViewModel); }); deleteAction.BackgroundColor = UIColor.Red; UITableViewRowAction editAction = UITableViewRowAction.Create( UITableViewRowActionStyle.Default, "Edit", delegate { tableView.SetEditing(false, true); _controller.ViewModel.EditCell(cell.ViewModel).ConfigureAwait(false); }); editAction.BackgroundColor = UIColor.DarkGray; return(new UITableViewRowAction[] { deleteAction, editAction }); }
public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndexPath indexPath) { var buttons = new List <UITableViewRowAction>(); var itemViewModel = _sourceRef.Target?.DataSource[indexPath.Row]; if (itemViewModel == null) { return(buttons.ToArray()); } if (itemViewModel.CanLeave) { var createButton = UITableViewRowAction.Create( UITableViewRowActionStyle.Default, _viewModelRef.Target?.LocalizedStrings.Leave, (row, index) => OnClickLeave(row, index, tableView)); buttons.Add(createButton); } if (itemViewModel.CanClose) { var closeButton = UITableViewRowAction.Create( UITableViewRowActionStyle.Default, _viewModelRef.Target?.LocalizedStrings.Delete, (row, index) => OnClickDelete(row, index, tableView)); closeButton.BackgroundColor = UIColor.Orange; buttons.Add(closeButton); } return(buttons.ToArray()); }
public TimeEntriesLogViewSource( ObservableGroupedOrderedCollection <TimeEntryViewModel> collection, string cellIdentifier, ITimeService timeService, ISchedulerProvider schedulerProvider) : base(collection, cellIdentifier) { Ensure.Argument.IsNotNull(timeService, nameof(timeService)); Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider)); this.timeService = timeService; this.schedulerProvider = schedulerProvider; if (!UIDevice.CurrentDevice.CheckSystemVersion(11, 0)) { deleteTableViewRowAction = UITableViewRowAction.Create( UITableViewRowActionStyle.Destructive, Resources.Delete, handleDeleteTableViewRowAction); deleteTableViewRowAction.BackgroundColor = Foundation.MvvmCross.Helper.Color.TimeEntriesLog.DeleteSwipeActionBackground.ToNativeColor(); } ContinueTap = continueTapSubject.AsDriver(schedulerProvider); SwipeToContinue = swipeToContinueSubject.AsDriver(schedulerProvider); SwipeToDelete = swipeToDeleteSubject.AsDriver(schedulerProvider); FirstCell = firstCellSubject.AsDriver(schedulerProvider); }
public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndexPath indexPath) { UITableViewRowAction archiveButton = UITableViewRowAction.Create( UITableViewRowActionStyle.Destructive, _textResources[0], delegate { tableView.BeginUpdates(); tableView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Bottom); ChatListActionsEvent?.Invoke(this, new Tuple <ChatEventType, int> (ChatEventType.Archive, _chats[indexPath.Row].MemberId)); _chats.RemoveAt(indexPath.Row); tableView.EndUpdates(); tableView.ReloadData(); }); archiveButton.BackgroundColor = Colors.GrayIndicator; UITableViewRowAction infoButton = UITableViewRowAction.Create( UITableViewRowActionStyle.Normal, _chats[indexPath.Row].IsMemberMuted ? _textResources[2] : _textResources[1], delegate { tableView.BeginUpdates(); ChatListActionsEvent?.Invoke(this, new Tuple <ChatEventType, int>(ChatEventType.Mute, _chats[indexPath.Row].MemberId)); tableView.ReloadRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Right); tableView.EndUpdates(); }); infoButton.BackgroundColor = Colors.Orange; return(new UITableViewRowAction[] { archiveButton, infoButton }); }
async void OnComplete(UITableViewRowAction rowAction, NSIndexPath indexPath) { TodoItem todo = data[indexPath.Row]; todo.Completed = !todo.Completed; TableView.ReloadRows(new[] { indexPath }, UITableViewRowAnimation.Automatic); await new DataStore().Update(todo); }
async void OnFlipBillable(UITableViewRowAction rowAction, NSIndexPath indexPath) { Expense expense = expenses[indexPath.Row]; expense.Billable = !expense.Billable; TableView.ReloadRows(new[] { indexPath }, UITableViewRowAnimation.Automatic); await new DataStore().Update(expense); }
async void OnDelete(UITableViewRowAction rowAction, NSIndexPath indexPath) { Expense expense = expenses[indexPath.Row]; expenses.RemoveAt(indexPath.Row); TableView.DeleteRows(new[] { indexPath }, UITableViewRowAnimation.Automatic); await new DataStore().Delete(expense); }
public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndexPath indexPath) { var action = UITableViewRowAction.Create(UITableViewRowActionStyle.Destructive, Mvx.Resolve <ILocalizationService>().GetLocalizableString(BasketConstants.RESX_NAME, "Basket_DeleteItem"), (rowAction, inPath) => { CommitEditingStyle(tableView, UITableViewCellEditingStyle.Delete, inPath); }); return(new [] { action }); }
public override UITableViewRowAction [] EditActionsForRow(UITableView tableView, NSIndexPath indexPath) { var deleteButton = UITableViewRowAction.Create(UITableViewRowActionStyle.Default, IosLocalizator.Translate(Constants.BUTTON_DELETE), (s, e) => { accountController.ShowOkCancelAlert(IosLocalizator.Translate(Constants.TITLE_DELETE), IosLocalizator.Translate(Constants.MESSAGE_DELETE), () => DeleteAccount(indexPath)); }); var exportButton = UITableViewRowAction.Create(UITableViewRowActionStyle.Normal, IosLocalizator.Translate(Constants.BUTTON_EXPORT), (s, e) => Export(indexPath)); return(new UITableViewRowAction[] { deleteButton, exportButton }); }
private UITableViewRowAction createLegacySwipeDeleteAction() { var deleteAction = UITableViewRowAction.Create( UITableViewRowActionStyle.Destructive, Resources.Delete, handleDeleteTableViewRowAction); deleteAction.BackgroundColor = Core.UI.Helper.Colors.TimeEntriesLog.DeleteSwipeActionBackground.ToNativeColor(); return(deleteAction); }
public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, Foundation.NSIndexPath indexPath) { var action = UITableViewRowAction.Create(UITableViewRowActionStyle.Default, "Delete", (arg1, arg2) => { var cell = tableView.CellAt(arg2); cell.TextLabel.Text += "_Clicked"; }); return(new UITableViewRowAction[] { action }); }
public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndexPath indexPath) { UITableViewRowAction deleteButton = UITableViewRowAction.Create(UITableViewRowActionStyle.Destructive, "Dismiss", delegate { var alertItem = Values.ElementAt(indexPath.Row); DismissSingleAlert(alertItem); }); deleteButton.BackgroundColor = UIColor.FromRGB(17, 125, 184); return(new UITableViewRowAction[] { deleteButton }); }
/// <summary> /// Override the default behavior when editing a row in the table and define a set of /// custom actions. /// </summary> /// <returns>The actions for row.</returns> /// <param name="tableView">Table view.</param> /// <param name="indexPath">Index path.</param> public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndexPath indexPath) { UITableViewRowAction hiButton = UITableViewRowAction.Create( UITableViewRowActionStyle.Default, "Hi", delegate { Console.WriteLine("Hello World!"); }); return(new UITableViewRowAction[] { hiButton }); }
public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndexPath indexPath) { // var conncatbutton = UITableViewRowAction.Create(UITableViewRowActionStyle.Default,library.StrForm(1), click_connact); var deletebutton = UITableViewRowAction.Create(UITableViewRowActionStyle.Default, library.StrForm(2), click_delete); //conncatbutton.BackgroundColor = UIColor.Blue; deletebutton.BackgroundColor = UIColor.Red; return(new UITableViewRowAction[] { connctionButtons[indexPath.Row].retrun_button(), deletebutton }); }
public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndexPath indexPath) { return(new UITableViewRowAction[] { UITableViewRowAction.Create(UITableViewRowActionStyle.Default, "Browse", (_, selectedIndexPath) => { var rssArticle = data[selectedIndexPath.Row]; UIApplication.SharedApplication.OpenUrl(new NSUrl(rssArticle.Link)); }) }); }
// Add Row Action public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, Foundation.NSIndexPath indexPath) { var threeAction = indexPath.Row % 2 == 0; var actions = new List <UITableViewRowAction>(); var viewAction = UITableViewRowAction.Create( UITableViewRowActionStyle.Normal, "檢視", (UITableViewRowAction arg1, Foundation.NSIndexPath arg2) => { User user = Users[arg2.Row]; WriteLine($" { user.Name } : 檢視 Action"); } ); viewAction.BackgroundColor = UIColor.FromRGB(170, 170, 170); actions.Add(viewAction); var execAction = UITableViewRowAction.Create(UITableViewRowActionStyle.Normal, "執行", (UITableViewRowAction arg1, Foundation.NSIndexPath arg2) => { User user = Users[arg2.Row]; WriteLine($" { user.Name } : 執行 Action"); } ); execAction.BackgroundColor = UIColor.FromRGB(185, 185, 185); if (threeAction) { actions.Add(execAction); } var changeAction = UITableViewRowAction.Create(UITableViewRowActionStyle.Normal, "異動", (UITableViewRowAction arg1, Foundation.NSIndexPath arg2) => { User user = Users[arg2.Row]; WriteLine($" { user.Name } : 異動 Action"); } ); changeAction.BackgroundColor = UIColor.FromRGB(200, 200, 200); if (threeAction) { actions.Add(changeAction); } return(actions.ToArray()); }
public TimeEntriesLogViewSource(ObservableGroupedOrderedCollection <TimeEntryViewModel> collection, string cellIdentifier) : base(collection, cellIdentifier) { if (!UIDevice.CurrentDevice.CheckSystemVersion(11, 0)) { deleteTableViewRowAction = UITableViewRowAction.Create( UITableViewRowActionStyle.Destructive, Resources.Delete, handleDeleteTableViewRowAction); deleteTableViewRowAction.BackgroundColor = Color.TimeEntriesLog.DeleteSwipeActionBackground.ToNativeColor(); } }
public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndexPath indexPath) { var deletion = UITableViewRowAction.Create(UITableViewRowActionStyle.Destructive, " ", async delegate { await AppDelegate.databaseConnection.DeletePostingAsync(savedListings[indexPath.Row]); savedListings.RemoveAt(indexPath.Row); tableView.DeleteRows(new [] { indexPath }, UITableViewRowAnimation.Fade); Console.WriteLine(AppDelegate.databaseConnection.StatusMessage); }); deletion.BackgroundColor = UIColor.FromPatternImage(UIImage.FromBundle("DeletePattern.png")); return(new UITableViewRowAction[] { deletion }); }
public override UITableViewRowAction [] EditActionsForRow(UITableView tableView, NSIndexPath indexPath) { var defaultAction = UITableViewRowAction.Create(UITableViewRowActionStyle.Normal, Strings.EmptyActionTitle, handleTableActionSave); defaultAction.BackgroundColor = UIColor.FromPatternImage(Images.TableActionSave); var moreAction = UITableViewRowAction.Create(UITableViewRowActionStyle.Normal, Strings.EmptyActionTitle, handleTableActionMore); moreAction.BackgroundColor = UIColor.FromPatternImage(Images.TableActionMore); return(new UITableViewRowAction [] { defaultAction, moreAction }); }
public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndexPath indexPath) { var rowActions = new List <UITableViewRowAction>(); var item = GetItemAt(indexPath) as DailyToDoTaskViewModel; if (item.DismissCommand.CanExecute(indexPath.Row)) { rowActions.Add(UITableViewRowAction.Create(UITableViewRowActionStyle.Destructive, "Dismiss", (action, path) => { item.DismissCommand.Execute(item); })); } return(rowActions.ToArray()); }
public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndexPath indexPath) { UITableViewRowAction deleteButton = UITableViewRowAction.Create( UITableViewRowActionStyle.Default, "Delete", delegate { var item = GetItemAt(indexPath) as Models.TodoItem; viewController.ViewModel.DeleteItem.Execute(item); }); return(new UITableViewRowAction[] { deleteButton }); }
private void click_delete(UITableViewRowAction row, NSIndexPath indexPath) //Action Delete button { dataSql.process(library.File(2), library.DELETE(0), DataSql_Parameters(cellList[indexPath.Row])); PortList.RemoveAt(indexPath.Row); cellList.RemoveAt(indexPath.Row); // // delete the row from the table tableView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade); // tableView.DeleteRows(new[] { indexPath[0] }, UITableViewRowAnimation.Fade); // tableView.DeleteRows(new NSIndexPath[] { NSIndexPath.FromItemSection(0, 0) }, UITableViewRowAnimation.Fade); }