using System; using System.Windows.Forms; namespace Update.Util { /// /// 应用工具 /// public static class AppUtil { /// /// 空闲时执行指定方法 /// /// 方法 public static void Idle(Action action) { EventHandler handler = null; handler = (sender, e) => { Application.Idle -= handler; action(); }; Application.Idle += handler; } } }