C# 对话框:在背景中设置StyledStringElement的图像
我的应用程序计算StyledStringElement的图像,这个过程花费了大量的时间。都是在本地完成的 如何执行类似以下伪代码的操作:C# 对话框:在背景中设置StyledStringElement的图像,c#,ios,xamarin.ios,monotouch.dialog,C#,Ios,Xamarin.ios,Monotouch.dialog,我的应用程序计算StyledStringElement的图像,这个过程花费了大量的时间。都是在本地完成的 如何执行类似以下伪代码的操作: myElement.Image = PlaceHolderImage; myElement.GoGetTheImageFromSomeLongRunningTask = GetImageFromSomeFuntionThatWillTakeTime(); 您可以使用类似的方法(未经测试): 请注意,这假设GetImageFromSomeFunctionTh
myElement.Image = PlaceHolderImage;
myElement.GoGetTheImageFromSomeLongRunningTask = GetImageFromSomeFuntionThatWillTakeTime();
您可以使用类似的方法(未经测试): 请注意,这假设GetImageFromSomeFunctionThatWillTakeTime实际上可以在辅助线程上执行。您可以通过使用当前的MonoTouch测试版(5.3.2)轻松地测试这一点,因为如果您在辅助线程上执行了不允许的操作,则会出现异常
myElement.Image = PlaceHolderImage;
ThreadPool.QueueUserWorkItem ((v) =>
{
var image = GetImageFromSomeFunctionThatWillTakeTime ();
BeginInvokeOnMainThread (() =>
{
myElement.Image = image;
myRoot.ReloadData ();
});
});