/// <summary> /// /// </summary> /// <param name="obj">Takes responsibility over this object to ease disposing</param> /// <param name="scheduler"></param> public LockedWrapper(T obj, IScheduler scheduler) { if (obj == null) { throw new ArgumentNullException("obj"); } _safeCall = callFactory.Create(); _obj = obj; Scheduler = scheduler; }
private async Task <T> SetupSteam <T>(uint appId, Func <IScheduler, Task <T> > initialize, Action simulate) { if (!(appId > 0)) { throw new ArgumentException("appId > 0"); } _safeCall = LockedWrapper.callFactory.Create(); await SetupAppId(appId).ConfigureAwait(false); StartSteamIfRequiredAndConfirm(); _scheduler = new EventLoopScheduler(); var init = await initialize(_scheduler).ConfigureAwait(false); _callbackRunner = CreateCallbackRunner(simulate, _cts.Token); return(init); }