I have a method and something weird is happening
public void UpdateProgressBar(double newValue)
{
// Make sure we don't go over the maximum value for the progress bar
if (newValue > _maxValueProgressBar)
newValue = _maxValueProgressBar;
// Make sure we don't go under the minimum value for the progress bar
if (newValue < _minValueProgressBar)
newValue = _minValueProgressBar;
if (!NSThread.Current.IsMainThread)
{
using (var pool = new NSAutoreleasePool())
pool.BeginInvokeOnMainThread(delegate
{
JobProgressBar.DoubleValue = newValue;
});
}
else
// jobProgressBar.DoubleValue = newValue;
// InvokeOnMainThread (() => JobProgressBar.DoubleValue=newValue);
}
as you can see this method must be called from the Mainthread, but when i comment either of the 2 methods bellow the else, my app crash. i will appreciated any help