protected async void OnButtonBranchClicked(object sender, System.EventArgs e) { Stash s = GetSelected(); int stashIndex = GetSelectedIndex(); if (s != null) { var dlg = new EditBranchDialog(repository); try { if (MessageService.RunCustomDialog(dlg) == (int)ResponseType.Ok) { await repository.CreateBranchFromCommitAsync(dlg.BranchName, s.Base); if (await GitService.SwitchToBranchAsync(repository, dlg.BranchName)) { await ApplyStashAndRemove(stashIndex); } } } finally { dlg.Destroy(); dlg.Dispose(); } Respond(ResponseType.Ok); } }