virtual public Request <ResolveResultDTO <DataType> > Resolve( Action <Request <ResolveResultDTO <DataType> > > callback = null) { var result = GetStoredStateAsResolveResult(); var request = new LocalRequest <ResolveResultDTO <DataType> >(result); request.Execute(callback); return(request); }
public Request <ResolveResultDTO <DataType> > Resolve( ResolveRequestDTO req, Action <Request <ResolveResultDTO <DataType> > > callback = null) { var result = GetStoredEntityAsResolveResult(req); var request = new LocalRequest <ResolveResultDTO <DataType> >(result); request.Execute(callback); return(request); }
/// <summary> /// Allows you to request an entity (from the store) and get a callback when load succeeds or fails. /// If the entity is not initially loaded, sends the usual notifications and then listens for updates /// </summary> public static Request <DataType> Resolve( string loadKey, HasEntities <DataType> store, Action <Request <DataType> > callback = null) { if (string.IsNullOrEmpty(loadKey)) { var err = new LocalRequest <DataType>("Load key cannot be null or empty"); err.Execute(callback); return(err); } var r = new DataRequest(NewResolveRequest(loadKey), store); r.Execute(callback); return(r); }
override public Request <ResolveResultDTO <NetworkStatusData> > Resolve( Action <Request <ResolveResultDTO <NetworkStatusData> > > callback = null) { var nstatus = new NetworkStatusData { networkReachability = Application.internetReachability }; if (nstatus.networkReachability == NetworkReachability.NotReachable) { var res = new LocalRequest <ResolveResultDTO <NetworkStatusData> >( ResolveResultDTO <NetworkStatusData> .ResolveSucceeded(nstatus) ); res.Execute(callback); return(res); } var promise = new Promise <ResolveResultDTO <NetworkStatusData> >((resolve, reject) => { new WebRequest(NextTestUrl()).Execute(req => { nstatus.hasNetworkError = (req as WebRequest).www.isNetworkError; if (nstatus.hasNetworkError) { nstatus.lastNetworkError = DateTime.Now; } else { nstatus.lastNetworkSuccess = DateTime.Now; } resolve( ResolveResultDTO <NetworkStatusData> .ResolveSucceeded(nstatus) ); }); }); promise.Execute(callback); return(promise); }