Former Borussia Dortmund manager Lucien Favre has agreed a three-year-deal to become the new Crystal Palace manager.