15
I want to execute this code on the main thread in the WPF app and getting an error I can't figure out what is wrong:
private void AddLog(string logItem)
{
this.Dispatcher.BeginInvoke(
delegate()
{
this.Log.Add(new KeyValuePair<string, string>(DateTime.Now.ToLongTimeString(), logItem));
});
}