CB-8758 [wp8]: UnauthorizedAccessException on hide()
When calling hide() from JS, the attempt to access Popup could happen on a background thread, which ends up throwing an UnauthorizedAccessException about cross-thread access. To address this, it's best to check the popup's state from within the UI thread. Fixes https://issues.apache.org/jira/browse/CB-8758
This commit is contained in:
parent
fa60f01adc
commit
62e92afae8
@ -134,11 +134,10 @@ namespace WPCordovaClassLib.Cordova.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void show(string options = null)
|
public void show(string options = null)
|
||||||
{
|
|
||||||
|
|
||||||
if (!popup.IsOpen)
|
|
||||||
{
|
{
|
||||||
Deployment.Current.Dispatcher.BeginInvoke(() =>
|
Deployment.Current.Dispatcher.BeginInvoke(() =>
|
||||||
|
{
|
||||||
|
if (!popup.IsOpen)
|
||||||
{
|
{
|
||||||
popup.Child.Opacity = 0;
|
popup.Child.Opacity = 0;
|
||||||
|
|
||||||
@ -162,17 +161,16 @@ namespace WPCordovaClassLib.Cordova.Commands
|
|||||||
{
|
{
|
||||||
StartAutoHideTimer();
|
StartAutoHideTimer();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hide(string options = null)
|
public void hide(string options = null)
|
||||||
{
|
|
||||||
if (popup.IsOpen)
|
|
||||||
{
|
{
|
||||||
Deployment.Current.Dispatcher.BeginInvoke(() =>
|
Deployment.Current.Dispatcher.BeginInvoke(() =>
|
||||||
{
|
{
|
||||||
|
if (popup.IsOpen)
|
||||||
|
{
|
||||||
popup.Child.Opacity = 1.0;
|
popup.Child.Opacity = 1.0;
|
||||||
|
|
||||||
Storyboard story = new Storyboard();
|
Storyboard story = new Storyboard();
|
||||||
@ -191,8 +189,8 @@ namespace WPCordovaClassLib.Cordova.Commands
|
|||||||
popup.IsOpen = false;
|
popup.IsOpen = false;
|
||||||
};
|
};
|
||||||
story.Begin();
|
story.Begin();
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StartAutoHideTimer()
|
private void StartAutoHideTimer()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user