在页面之间导航时,我按下了开始或搜索按钮,这将使我退出应用程序。然后当我回到应用程序时。它说 Navigation Service 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。
![在此处输入图像描述][1]
Yellow-NavigationService.Navigate(new Uri(Common.urlstring, UriKind.Relative)) 中突出显示;
Common.urlstring = "/View/frmFirstTimeSync.xaml"
NavigationService = Null 根据错误
http://www.tiikoni.com/tis/view/?id=95ecd7b
我不能发布图片,因为我没有足够的声誉