Multithreaded process will not run

blearibleari Member ✭✭
edited September 2018 in Xamarin.Forms

I am programming an app in Xamarin.forums. I have a long process which has started to block the UI thread. I tried to move this to a background thread but I am unable to get this to run. The function should also run every 10 seconds hence the timer. Will this code work/perform well?

    public  void timerRefreshAsync()
        Device.StartTimer(TimeSpan.FromSeconds(10), () =>
            Task.Run(async () =>
                await PassArrayAsync();
            return true;

PassArrayAsync() will run multiple Bluetooth commands and continuously receive data from a ble device. This data will be entered into an array and finally passed to mainPage.xaml.cs to be displayed. The ui is never changed because the process thread is always being used.


Sign In or Register to comment.