protected virtual async void OnButtonAddBranchClicked(object sender, EventArgs e) { var dlg = new EditBranchDialog(repo); try { if (MessageService.RunCustomDialog(dlg) == (int)ResponseType.Ok) { var token = destroyTokenSource.Token; await repo.CreateBranchAsync(dlg.BranchName, dlg.TrackSource, dlg.TrackRef); if (!token.IsCancellationRequested) { FillBranches(); } } } catch (Exception ex) { MessageService.ShowError(GettextCatalog.GetString("The branch could not be created"), ex); } finally { dlg.Destroy(); dlg.Dispose(); } }