Skip to content

Instantly share code, notes, and snippets.

@JakeGinnivan
Created November 10, 2012 08:27
Show Gist options
  • Select an option

  • Save JakeGinnivan/4050418 to your computer and use it in GitHub Desktop.

Select an option

Save JakeGinnivan/4050418 to your computer and use it in GitHub Desktop.
public async void SaveDocument()
{
if (IsWorking) return;
var doc = MDI.ActiveItem as DocumentViewModel;
if (doc != null)
{
using (DoingWork(string.Format("Saving {0}", doc.MarkpadDocument.Title)))
{
await doc.Save();
await TaskEx.Delay(5000);
}
}
}
//If I add this guy, I get a 5 second UI thread lockup... wtf
public bool CanSaveDocument
{
get { return !IsWorking; }
}
@JakeGinnivan
Copy link
Copy Markdown
Author

@distantcam I put the delegate command in to fix the issue. DelegateCommand = working, CM = not

@caleb-vear
Copy link
Copy Markdown

Who sets IsWorking, because the moment that is set is when CM will be handling the event not when you hit the await.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment