How do I use the Lazy attribute?

Silverlight does support tasks yes.

how does this work now? Say atm you use a threadpool, you could instead do something like:

method MyClass.GetDataAsync: Task<String>;
begin
  var lTask := new Task<String>( -> GetData(args));
  lTask.Start;
  exit lTask;
end;

In this case you probably odn’t need all the lazy stuff.

Is that client or service code? I don’t know if I use a threadpool or not. I just create the service, run slSvcUtil and it generates all the proxy code for me. Then I do what I showed before. If that uses “a threadpool” or not, beats me. But it works.

Now I’m really struggling with what has to be done where and how. Like I’ve gone to a new language.

Assuming your code is on the client, is the “exit GetData(args)” supposed to be the WCF call? If it is, I don’t think I can do that as it requires a GetDataAsync in the generated code. No?

you have the body for GetDataAsync handy? (Is that generated?) I thought you mentioned you created this yourself.

Not sure which part of the 9000 line file you want to see. I usually don’t look into the generated file. I just use the proxy.

I think this might be the type of thing you are asking for:

method GuardianEditObservationServiceClient.GetPeopleAsync(dataConnectionKey: System.String; userState: System.Object);
begin
    if (self.onBeginGetPeopleDelegate = nil) then begin
        self.onBeginGetPeopleDelegate := new BeginOperationDelegate(@self.OnBeginGetPeople);
    end;
    if (self.onEndGetPeopleDelegate = nil) then begin
        self.onEndGetPeopleDelegate := new EndOperationDelegate(@self.OnEndGetPeople);
    end;
    if (self.onGetPeopleCompletedDelegate = nil) then begin
        self.onGetPeopleCompletedDelegate := new System.Threading.SendOrPostCallback(@self.OnGetPeopleCompleted);
    end;
    inherited InvokeAsync(self.onBeginGetPeopleDelegate, array of System.Object([dataConnectionKey]), self.onEndGetPeopleDelegate, self.onGetPeopleCompletedDelegate, userState);
end;

That’s going to be trickier yes. THis might help: http://arbel.net/2011/06/04/wcf-tasks/

The big issue is that WCF/Silverlight isn’t being updated anymore. the new WCF does this out of the box.

Don’t get me started on Microsoft dropping Silverlight :frowning: I wish there were something else as good, but I haven’t seen anything that I like as much and no time to convert to ANYTHING at the moment anyway.

I’ll check out the link.

I think I’m going to have to drop this whole idea. It just seems too complicated to figure out in the time I have. The link wasn’t for Silverlight and it wasn’t clear I could go down that path with SL. It talked about SvcUtil and I have to use SLSvcUtil. So not sure what they are talking about will even work.

I was hoping there was something in the Oxygene async and await that would help me, but I can’t figure enough out from the little examples I’ve seen in the Wiki.

Thanks anyway.