当页面间导航时,我要么按“开始”,要么按“搜索”按钮,这将使我从应用程序中脱颖而出。然后当我回到应用程序。它说导航服务为null或类似的东西。
我怎么能解决呢!?
Dispatcher.BeginInvoke(delegate()
{
TextBlock b = (TextBlock)sender;
var CusId = (TextBlock)b.FindName("CusId");
var SCHTime1 = (TextBlock)b.FindName("pschtime");
int intCusId = Convert.ToInt32(CusId.Text);
string ScheduleTime = SCHTime1.Text;
LoginVM.GetCustomerDetail(intCusId);
if (LoginVM.OBCustomerDetail.Count != 0)
{
foreach (var c in LoginVM.OBCustomerDetail)
{
Common.CustomerNetworkId = c.CustomerNetworkId;
Common.intCustomerId = c.Id;
Common.CustomerName = c.Name;
Common.RouteId = c.RouteId.Value;
Common.strReportedTime = DateTime.Now.TimeOfDay.Hours + ":" + DateTime.Now.TimeOfDay.Minutes;
}
getVisitDetailNo();
if (VN == false)
{
myPopup.IsOpen = false;
backstatus = false;
return;
}
if (Common.visitDetailNo == null)
{
return;
}
if (LoginVM.SaveVisitedCustomer(Common.visitDetailNo, Common.strVisitHeaderNo, Common.RouteId, Common.intCustomerId, Common.SPOAccId, Common.intSalesRepId, Common.intAreaSalesManagerAccId, Common.intAreaSalesManagerId, Common.strTransactionDate, ScheduleTime, Common.strReportedTime) == true)
{
//update next Visit Detail No
if (UpdateVisitConfigTable() == true)
{
myPopup.IsOpen = false;
backstatus = false;
Common.urlstring = "/View/frmCustomerMenu.xaml";
NavigationService.Navigate(new Uri("/View/LoadingView.xaml", UriKind.Relative));
configVM = new ConfigViewModel();
//Bind Visited Outlets
bindVisited();
}
else
}
}
});上面的内容将指向loading.aspx及其代码,如下所示
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
Dispatcher.BeginInvoke(delegate() {
NavigationService.Navigate(new Uri(Common.urlstring, UriKind.Relative));
});错误来自于loading.aspx,尽管在此之前,我是从页面导航的。
突出显示在黄色-NavigationService.Navigate(新Uri(Common.urlstring,UriKind.Relative));
Common.urlstring = "/View/frmFirstTimeSync.xaml“
NavigationService =根据误差为零
http://www.tiikoni.com/tis/view/?id=95ecd7b
我不能发照片,因为我没有足够的声誉。
发布于 2013-11-07 09:55:57
以上问题运行FormLoad方法。我更改了导航服务的位置。
现在导航服务在OnNavigatedTo方法中工作。它很好用
https://stackoverflow.com/questions/19219768
复制相似问题