Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7914451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:07:12+00:00 2026-06-03T14:07:12+00:00

public class SyncHelper { private LiveConnectClient client; public event EventHandler SyncStarted; public event EventHandler

  • 0
public class SyncHelper
{
    private LiveConnectClient client;
    public event EventHandler SyncStarted;
    public event EventHandler SyncCompleted;

    public SyncHelper(LiveConnectClient client)
    {
        this.client = client;
    }

    public void TrySync()
    {
        Debug.WriteLine("Beginning sync");
        OnSyncStarted();
        client.GetCompleted += OnGetCompleted;
        client.GetAsync("me/skydrive/files");
    }

    private void OnGetCompleted(object sender, LiveOperationCompletedEventArgs e)
    {
        Thread.Sleep(10000);
        Debug.WriteLine("Get Completed");
        client.GetCompleted -= OnGetCompleted;
        OnSyncCompleted();
        Debug.WriteLine("Sync completed");
    }

    private void OnSyncStarted()
    {
        if (SyncStarted != null)
            SyncStarted(this, new EventArgs());
    }

    private void OnSyncCompleted()
    {
        if (SyncCompleted != null)
            SyncCompleted(this, new EventArgs());
    }
}

The function OnGetCompleted is being called in the UI thread and the UI is unresponsive. From whatever I know, I thought these callbacks would work in a different thread and we would have to use the displatcher to post it to the UI thread. Any thoughts? Help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T14:07:15+00:00Added an answer on June 3, 2026 at 2:07 pm

    The GetAsync call is likely using a background thread to do the actual fetch, but then it’s trying to help you by calling the Completed callback in the original thread context so you don’t have to use a Dispatcher.

    Why are you putting in a Sleep(10000) anyway? The callback says “hey, I’m done”. At that point you should update the UI if you want. If you need to do further processing that takes significant time, spawn a background thread, threadpool task or use another asynchronous call with another callback.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public class a { public event eventhandler test; public void RaiseTest(){//fire test} } Is
public class AllViewModel { private List<Settings> SettingsList; public ViewAgendaAllViewModel() { client.SupplierListWithSettings(GetSupplierListWithSettings_Completed) } public void
public class EventsType { public event EventHandler> NewEvent; public void SmthHappened(string data) { MyEventArgs<Object>
public class Ex7 { private int fld; private void meth(int val) { fld =
public class IdAsync extends AsyncTask<String, Void, Void> { AlertDialog alertDialog = new AlertDialog.Builder(MainClass.this).create(); protected
public class BaseFoo { private string param; public BaseFoo(string param) { this.param = param;
public class Example { public Example duplicate; public void duplicateState() { this.example = this.clone();
public class TextBoxDerived : System.Web.UI.WebControls.TextBox { protected override void OnLoad(EventArgs e) { this.Controls.Add(new LiteralControl(Hello));
public class counting { private static int counter = 0; public void boolean counterCheck(){
public class Greeter extends MovieClip { public function Greeter() { addEventListener(Event.ADDED_TO_STAGE, go); } private

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.