私はいくつかの重い仕事を実行するタスクを持っています。その結果をパスする必要がありますLogContent
Task<Tuple<SupportedComunicationFormats, List<Tuple<TimeSpan, string>>>>.Factory
.StartNew(() => DoWork(dlg.FileName))
.ContinueWith(obj => LogContent = obj.Result);
これはプロパティです:
public Tuple<SupportedComunicationFormats, List<Tuple<TimeSpan, string>>> LogContent
{
get { return _logContent; }
private set
{
_logContent = value;
if (_logContent != null)
{
string entry = string.Format("Recognized {0} log file",_logContent.Item1);
_traceEntryQueue.AddEntry(Origin.Internal, entry);
}
}
}
問題は、_traceEntryQueue
データが UI にバインドされていることです。そのため、このようなコードでは例外が発生します。
それで、私の質問はそれを正しく機能させる方法ですか?