When navigation between pages, I pressed either start or search button which will bring me out from the app. Then when I come back to the app. It says Navigation Service null or something similar to it.
How could i solve it!?
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
}
}
});
The above will direct to loading.aspx and its code as below
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
Dispatcher.BeginInvoke(delegate() {
NavigationService.Navigate(new Uri(Common.urlstring, UriKind.Relative));
});
error comes from the loading.aspx even though i navigate away from the page before that.
![enter image description here][1]
Highlighted in Yellow- NavigationService.Navigate(new Uri(Common.urlstring, UriKind.Relative));
Common.urlstring = "/View/frmFirstTimeSync.xaml"
NavigationService = Null according to error
http://www.tiikoni.com/tis/view/?id=95ecd7b
I cannot post pictures because I do not have enough reputation