mirror of
https://github.com/mgroves/MonodroidStockPortfolio.git
synced 2024-12-29 11:17:07 +00:00
23 lines
No EOL
662 B
C#
23 lines
No EOL
662 B
C#
using Android.App;
|
|
using Android.Util;
|
|
using PostSharp.Aspects;
|
|
|
|
namespace MonoStockPortfolio.Framework
|
|
{
|
|
public class OnGuiThreadAttribute : MethodInterceptionAspect
|
|
{
|
|
public override void OnInvoke(MethodInterceptionArgs args)
|
|
{
|
|
var activity = args.Instance as Activity;
|
|
if (activity == null)
|
|
{
|
|
Log.Error("OnGuiThreadAttribute", "OnGuiThreadAttribute can only be used on methods within an Activity");
|
|
args.Proceed();
|
|
}
|
|
else
|
|
{
|
|
activity.RunOnUiThread(args.Proceed);
|
|
}
|
|
}
|
|
}
|
|
} |