पर accessdenied अपवाद फेंकता है मैं विंडोज 8 में फिर से प्रयास/रद्द संवाद बॉक्स को कार्यान्वित करने का प्रयास कर रहा हूं। संवाद बॉक्स पहली बार ठीक दिखाता है, लेकिन फिर से प्रयास करने पर और फिर से असफल होने पर, मुझे एक एक्सेस अस्वीकार अपवाद मिलता है ShowAsync को कॉल करने पर। मुझे नहीं पता क्यों, लेकिन कभी-कभी इसकी अजीब बात ठीक काम करती है और जब मैं ब्रेकपॉइंट डालता हूं तो मुझे अपवाद नहीं मिलता है। वास्तव में यहां अनजानMessageDialog ShowAsync दूसरे संवाद
यहां कोड है।
async void DismissedEventHandler(SplashScreen sender, object e)
{
dismissed = true;
loadFeeds();
}
private async void loadFeeds()
{
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
{
try
{
RSSDataSource rssDataSource = (RSSDataSource)App.Current.Resources["RSSDataSource"];
if (rssDataSource != null)
{
await rssDataSource.DownloadFeeds();
await rssDataSource.GetFeedsAsync();
}
AdDataSource ads = (AdDataSource)App.Current.Resources["AdDataSource"];
if (ads != null)
{
await ads.DownloadAds();
}
rootFrame.Navigate(typeof(HomePageView));
Window.Current.Content = rootFrame;
}
catch
{
ShowError();
}
});
}
async void ShowError()
{
// There was likely a problem initializing
MessageDialog msg = new MessageDialog(CONNECTION_ERROR_MESSAGE, CONNECTION_ERROR_TITLE);
// Add buttons and set their command handlers
msg.Commands.Add(new UICommand(COMMAND_LABEL_RETRY, new UICommandInvokedHandler(this.CommandInvokedHandler)));
msg.Commands.Add(new UICommand(COMMAND_LABEL_CLOSE, new UICommandInvokedHandler(this.CommandInvokedHandler)));
// Set the command to be invoked when a user presses 'ESC'
msg.CancelCommandIndex = 0;
await msg.ShowAsync();
}
/// <summary>
/// Callback function for the invocation of the dialog commands
/// </summary>
/// <param name="command">The command that was invoked</param>
private void CommandInvokedHandler(IUICommand command)
{
string buttonLabel = command.Label;
if (buttonLabel.Equals(COMMAND_LABEL_RETRY))
{
loadFeeds();
}
else
{
// Close app
Application.Current.Exit();
}
}
"अ-निरुपित स्थानीय चर 'asyncCommand' का उपयोग" हो रही रोकने के लिए, मैं आवंटित करने के लिए किया था जब इसे असाइन किया जाता है तो asyncCommand को शून्य करें। –
साइड नोट: मैं एक एकल थ्रेड में अपने ही काम चल रहा है कुए थी और मैं एक बार में केवल एक धागे से एक ShowAsync कर रहा था। जाहिर है अगर एक शोएसिंक फ्रेम 1 में समाप्त होता है और दूसरा शोएसिंक फ्रेम 2 में शुरू होता है, तो एक यादृच्छिक एक्सेस अस्वीकृत त्रुटि पॉप हो सकती है: /। यद्यपि काम को मैन्युअल रूप से रद्द करना। – RelativeGames
@clay मैं – Syler