从我的应用程序MainPage我去一个网站(或者:我去任务:发送电子邮件)。 按'后退按钮'时会返回黑屏,而不是MainPage。我试图找到一个解决方案,但尚未找到解决方案。有人可以帮忙吗?
答案 0 :(得分:0)
我想出了如何解决这个问题(我有这个问题,但也许没有其他人!)。如果您需要创建外部链接,请不要直接从主页面进行。而是创建一个中间页面,从外部链接到(例如,网站或电子邮件应用程序)。然后你回到这个页面,后面的箭头,并使用逻辑字符串,已经在这里...没有在这里,你可以直接回到主页面。见下文:
private void Button1_Click(object sender, RoutedEventArgs e)
{
/* instead of putting the code here, you go to another page
EmailComposeTask emailcomposer = new EmailComposeTask();
emailcomposer.To = "Ä;
emailcomposer.Subject = "Customer request";
emailcomposer.Body = "Text:";
emailcomposer.Show();
*/
var b = App.Current as App;
b.Emailat = "email";
NavigationService.Navigate(new Uri("/Page2.xaml",UriKind.Relative));
}
在另一页上:
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
var c = App.Current as App;
string Howisit = c.Emailat;
if (Howisit == "email")
{
EmailComposeTask emailcomposer = new EmailComposeTask();
emailcomposer.To = "";
emailcomposer.Subject = "Customer request";
emailcomposer.Body = "Text:";
emailcomposer.Show();
var b = App.Current as App;
b.Emailat = "stop";
}
if (Howisit == "stop")
{
NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
}
}
就是这样!