/// <summary>
 /// 设置一个选项后执行动作,执行完后设置回系统默认值
 /// </summary>
 /// <param name="app">ISldwork interface</param>
 /// <param name="toggleSetting">需要设置的枚举值</param>
 /// <param name="value">值</param>
 /// <param name="action">执行的动作</param>
 public static void WithToggleState(this ISldWorks app, swUserPreferenceToggle_e toggleSetting, bool value, Action action)
 {
     try
     {
         bool fileLockState = app.GetUserPreferenceToggle(toggleSetting.SWToInt());
         app.SetUserPreferenceToggle(swUserPreferenceToggle_e.swLockRecentDocumentsList.SWToInt(), true);
         action?.Invoke();
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         app.SetUserPreferenceToggle(toggleSetting.SWToInt(), value);
     }
 }
 /// <summary>
 /// Sets the specified user preference value
 /// </summary>
 /// <param name="preference">The preference to set</param>
 /// <returns></returns>
 public void SetUserPreferencesToggle(swUserPreferenceToggle_e preference, bool value) => BaseObject.SetUserPreferenceToggle((int)preference, value);
 /// <summary>
 /// Gets the specified user preference value
 /// </summary>
 /// <param name="preference">The preference to get</param>
 /// <returns></returns>
 public bool GetUserPreferencesToggle(swUserPreferenceToggle_e preference) => BaseObject.GetUserPreferenceToggle((int)preference);