Kaija
Kaija

Reputation: 1

Is there a way to implement or use Invokes/Threadings in Xamarin?

First of all: I'm very new to Xamarin, so this might sound quite stupid. I need to "rewrite" a c#-programm to Xamarin (as in: I programmed an Computerprogramm and I now have to write an android-app for it. I'm using Android-App(Xamarin).). So far, so good, but I'm having problems with the Threading - MethodInvoker, InvokeRequire, etc. How can I deal with it? I kinda hope that there are simpler ways than asynchron tasks for it, given that asyn. task are an alternative?

For example this short code:

void setMessage(Messages.Message m)
            {
                MethodInvoker methodInvokerDelegate = delegate ()
                { ML.Add(m); }; // add list item to list ML
                if (this.InvokeRequired)
                {
                    Invoke(methodInvokerDelegate);
                }
                else
                    methodInvokerDelegate();
            }

Upvotes: 0

Views: 274

Answers (0)

Related Questions