public static async Task <bool> EndEditAsync(Authentication authentication, ITableContentDescriptor descriptor) { if (descriptor.Target is ITableContent content) { var domain = await content.Dispatcher.InvokeAsync(() => { content.LeaveEdit(authentication); return(content.Domain); }); var isEmpty = await domain.Dispatcher.InvokeAsync(() => domain.Users.Any() == false); await content.Dispatcher.InvokeAsync(() => { if (isEmpty == true) { content.EndEdit(authentication); } }); return(true); } else { throw new NotImplementedException(); } }
public static async Task BeginEditAsync(Authentication authentication, ITableContentDescriptor descriptor) { if (descriptor.Target is ITableContent content) { var domain = await content.Dispatcher.InvokeAsync(() => { if (content.Domain == null) { content.BeginEdit(authentication); } return(content.Domain); }); var isEntered = await domain.Dispatcher.InvokeAsync(() => { return(domain.Users.Contains(authentication.ID)); }); await content.Dispatcher.InvokeAsync(() => { if (isEntered == false) { content.EnterEdit(authentication); } }); } else { throw new NotImplementedException(); } }
public static async Task BeginEditAsync(Authentication authentication, ITableContentDescriptor descriptor) { if (descriptor.Target is ITableContent content) { if (content.Domain == null) { await content.BeginEditAsync(authentication); } var domain = content.Domain; var isEntered = await domain.Members.ContainsAsync(authentication.ID); if (isEntered == false) { await content.EnterEditAsync(authentication); } } else { throw new NotImplementedException(); } }