private List <AsyncAction> SetBondModeActions() { var ans = new List <AsyncAction>(); foreach (var bond in network.Connection.ResolveAll(network.TheBonds())) { Bond b = bond; // have to copy it otherwise it will change to the last bond before the delegates are called ans.Add(new DelegatedAsyncAction(bond.Connection, Messages.SET_BOND_MODE_ACTION_TITLE, Messages.SET_BOND_MODE_ACTION_START, Messages.SET_BOND_MODE_ACTION_END, session => Bond.set_mode(session, b.opaque_ref, NewBondMode), true, "bond.set_mode")); } return(ans.Count == 0 ? null : ans); }