public async void Handler(object parm1, ExecutedRoutedEventArgs parm2) { try { if (_sync) { await DispatcherService.InvokeTaskAsync(async() => await _del(parm1, parm2)).ConfigureAwait(false); } else { await _del(parm1, parm2).ConfigureAwait(false); } } catch (Exception e) { LogManager.GetLogger <CommandFactory>().Error(e); } }