I suggest you ...

implement parallel extensions

It would be great to be able to use the parallel extensions in Silverlight. Using multiple CPUs on the host machine could speed things up.

104 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    sorskootsorskoot shared this idea  ·   ·  Admin →

    3 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • MicheleMichele commented  · 

        Hi,
        We are developing an application that uses Composite WPF & Silverlight (Prism). All back-end logic resides inside WCF Data Services and WCF Services.
        We found extremely convenient using the capabilities offered by the Task infrastructure to handle the communication between the WPF client application and the back-end.

        Scenario1: Retrieving data from the Data Service using the FromAsyn factory becomes straightforward:

        var q = from e in context.Employees.Expand(...)…
        select e;
        var dsq = q as DataServiceQuery<BoltService.BoltModel.Employee>;
        if (dsq != null)
        {
        var pexTask = Task<IEnumerable<BoltService.BoltModel.Employee>>.Factory.FromAsync(dsq.BeginExecute, dsq.EndExecute, operationId);
        pexTask.ContinueWith(antecedent =>
        {
        if (!antecedent.IsFaulted)
        {
        …Do something in the UI thread…
        }
        else
        {
        …Handle exception in the UI thread…
        }
        }, TaskScheduler.FromCurrentSynchronizationContext());
        ...

        Scenario2: when the UI needs to load some data used as a prerequisite to allow editing (i.e. lookup values) with Task is really easy to start all remote load operations and having a Task.Factory.ContinueWhenAll(...) to complete the operation and allow the UI to change state:

        protected override void LoadPrerequisiteData(Action callbackAction, Action<Exception> exceptionCallbackAction)
        {
        base.LoadPrerequisiteData(callbackAction, exceptionCallbackAction);
        var task1 = employeeService.GetAllInsurancePositions(DataContext, delegate(IEnumerable<Stakeholder> data)
        {
        …load the data in the combo
        },
        exceptionCallbackAction.Invoke);
        var task2 = employeeService.GetAllCategories(DataContext, delegate(IEnumerable<Stakeholder> data)
        {
        ...load the data in the combo
        },
        exceptionCallbackAction.Invoke);
        TaskManager.ContinueWhenAll(new[] {task1, task2}, delegate { callbackAction.Invoke(); });
        }

        Other scenarios are for example validation before saving data. We can use tasks to perform needed validation (i.e. by calling a remote service to check some data, by performing some computation on the data that needs to be saved, etc). When all validation logic completes than the UI can change state.

        Thanks a lot,
        Michele

      • ShrikeShrike commented  · 

        Exactly!
        Must have

      Feedback and Knowledge Base