private void OnDeleting(Object dataObject) { if (Deleting != null) { Deleting.Invoke(dataObject, EventArgs.Empty); } }
public virtual void DeleteValues(IDictionary parentValues) { var items = GetDataForDelete(); if (items == null || items.Count == 0) { return; } var args = new CancelEventArgs(); Deleting?.Invoke(items, args); if (args.Cancel) { return; } var dataSourceView = GetDataSourceView(); var keys = new Dictionary <string, object>(); // todo: подумать что если прийдет id который пользователю не доступен foreach (var item in items) { if (item.ContainsKey(DataValueField)) { parentValues[DataValueField] = item[DataValueField].ToString(); } keys[DataSelectedKeyField] = item[DataSelectedKeyField].ToString(); dataSourceView.Delete(keys, parentValues, OnDeleted); } }
private void OnBindBaseNoteExecute(SimpleNote simpleNote) { if (!isBindedBaseNote) { simpleNote.DataContext.Note = Context; simpleNote.DataContext.Deleting += () => { Deleting?.Invoke(); }; simpleNote.DataContext.SelectDate += (n) => { SelectDate?.Invoke(Context); }; isBindedBaseNote = true; } }
public async Task <ICommandResult <TEntity> > DeleteAsync(TEntity model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } var result = new CommandResult <TEntity>(); var entity = await _entityStore.GetByIdAsync(model.Id); if (entity == null) { return(result.Failed(new CommandError($"An entity with the id {model.Id} could not be found"))); } // Raise Deleting event Deleting?.Invoke(this, new EntityEventArgs <TEntity>(entity)); // Invoke EntityDeleting subscriptions foreach (var handler in _broker.Pub <TEntity>(this, new MessageOptions() { Key = "EntityDeleting" }, entity)) { entity = await handler.Invoke(new Message <TEntity>(entity, this)); } var success = await _entityStore.DeleteAsync(entity); if (success) { // Raise Deleted event Deleted?.Invoke(this, new EntityEventArgs <TEntity>(entity, true)); // Invoke EntityDeleted subscriptions foreach (var handler in _broker.Pub <TEntity>(this, new MessageOptions() { Key = "EntityDeleted" }, entity)) { entity = await handler.Invoke(new Message <TEntity>(entity, this)); } return(result.Success(entity)); } return(result.Failed(new CommandError("An unknown error occurred whilst attempting to create an eneity."))); }
public void Delete(IValueSet valueSet) { if (valueSet.IsCustom && this.isCustomValue.Get(valueSet) && !valueSet.IsNew()) { Deleting?.Invoke(this, valueSet); this.repository.Delete(valueSet); Deleted?.Invoke(this, valueSet); return; } throw new InvalidOperationException("ValueSet was not a custom value set and cannot be deleted."); }
//private void OnEditSLStandardDescription(SLStandardDescription sLStandardDescription) //{ // sLStandardDescription.SLId = SLId; // EditSLStandardDescriptionRequested(sLStandardDescription); //} private async void OnDeleteSLStandardDescription(SLStandardDescription sLStandardDescription) { if (Deleting?.Invoke() == true) { try { await _sLStandardDescriptionsService.DeleteSLStandardDescriptionAsync(sLStandardDescription.SLStandardDescriptionId); SLStandardDescriptions.Remove(sLStandardDescription); Deleted(); } catch (Exception ex) { Failed(ex); } } }
//private void OnEditRelatedPerson(RelatedPerson relatedPerson) //{ // relatedPerson.RelatedPersonId = RelatedId; // EditRelatedPersonRequested(relatedPerson); //} private async void OnDeleteRelatedPerson(RelatedPerson relatedPerson) { if (Deleting?.Invoke() == true) { try { await _relatedPeopleService.DeleteRelatedPersonAsync(relatedPerson.RelatedPersonId); RelatedPeople.Remove(relatedPerson); Deleted(); } catch (Exception ex) { Failed(ex); } } }
//private void OnEditAccDocumentItem(AccDocumentItem accDocumentItem) //{ // accDocumentItem.SLId = SLId; // EditAccDocumentItemRequested(accDocumentItem); //} private async void OnDeleteAccDocumentItem(EditableAccDocumentItem accDocumentItem) { if (Deleting?.Invoke() == true) { try { await _accDocumentItemsService.DeleteAccDocumentItemAsync(accDocumentItem.AccDocumentItemId); AccDocumentItems.Remove(accDocumentItem); Deleted(); } catch (Exception ex) { Failed(ex); } } }
public async Task <int> DeleteAsync(Type type, Expression predicate) { if (_deleteAsync == null) { throw new NotImplementedException("Delete not implemented"); } if (_deleting != null) { await _deleting.Invoke(type, predicate); } var deleteCount = await _deleteAsync(type, predicate); if (_deleted != null) { await _deleted(type, deleteCount); } return(deleteCount); }
/// <summary> /// Déclenche l'événement <see cref="Deleting"/> /// </summary> protected virtual bool OnDeleting(OperationCancelEventArgs args) { if (args == null) { return(true); } // Si ça n'a pas été annulé if (args.Cancel == false) { //TODO: Confirm message // Demande de confirmation //if (!args.CancelDefaultMessage) // args.Cancel = !ShellServices.MessageService.ShowYesNo(string.Format(CultureInfo.InvariantCulture, Resources.Message_DeleteConfirm, ViewTitle)); Deleting?.Invoke(this, args); } return(args.Cancel); }
public async Task <ICommandResult <TReply> > DeleteAsync(TReply reply) { // Validate if (reply == null) { throw new ArgumentNullException(nameof(reply)); } var result = new CommandResult <TReply>(); // Raise Deleting event Deleting?.Invoke(this, new EntityReplyEventArgs <TReply>(null, reply)); // Invoke EntityReplyDeleting subscriptions foreach (var handler in _broker.Pub <TReply>(this, "EntityReplyDeleting")) { reply = await handler.Invoke(new Message <TReply>(reply, this)); } var success = await _entityReplyStore.DeleteAsync(reply); if (success) { // Raise Deleted event Deleted?.Invoke(this, new EntityReplyEventArgs <TReply>(null, reply)); // Invoke EntityReplyDeleted subscriptions foreach (var handler in _broker.Pub <TReply>(this, "EntityReplyDeleted")) { reply = await handler.Invoke(new Message <TReply>(reply, this)); } return(result.Success(reply)); } return(result.Failed(new CommandError("An unknown error occurred whilst attempting to delete the reply."))); }
/// <summary> /// Gets called before the model element gets deleted /// </summary> /// <param name="e"></param> protected virtual void OnDeleting(UriChangedEventArgs e) { Deleting?.Invoke(this, e); }
internal void OnDeleting(FileWatcher sender, EventArgs e) { Deleting?.Invoke(sender, e); WatchList.Remove(sender); }
internal void OnDeleting() { Log.Informational($"Server {this.ID:00} Deleting."); Deleting.Invoke(this, null); }
protected void OnDeleting(DeletingEventArgs <T> args) { Deleting?.Invoke(this, args); }
private void DeleteFailingTestEntry_Execute() => Deleting?.Invoke(this, null);
protected internal virtual void OnDeleting(CancelEventArgs e) => Deleting?.Invoke(this, e);
private void OnDeleteButtonClicked() { Deleting?.Invoke(this); }
/// <summary> /// Gets called before the model element gets deleted /// </summary> /// <param name="e"></param> protected virtual void OnDeleting(EventArgs e, Uri originalAbsoluteUri) { Deleting?.Invoke(this, e); OnBubbledChange(BubbledChangeEventArgs.ElementDeleting(this, originalAbsoluteUri)); }
internal void OnDeleting(EntityRecord record) { Deleting?.Invoke(record, EventArgs.Empty); }
private void Delete_Click(object sender, RoutedEventArgs e) { Deleting?.Invoke(this, EventArgs.Empty); }
protected virtual void OnDeleting(EntityEventArgs <TModel> e) { Deleting?.Invoke(this, e); }
private void OnDeleteExecute() { Deleting?.Invoke(); }
public virtual void OnDeleting(EntityReplyEventArgs <TModel> e) { Deleting?.Invoke(this, e); }
private void DeleteTag(object sender, EventArgs e) { Deleting?.Invoke(this, e); }