protected override void OnNavigatedTo(NavigationEventArgs e)
{
var vm = ServiceLocator.Current.GetInstance<LoginPageViewModel>() as LoginPageViewModel;
if (vm != null)
{
if (!String.IsNullOrEmpty(vm.CurrentUserName))
pivot.SelectedIndex = 1;
vm.LoadCredentials();
if (vm.Credentials.Count > 0)
pivot.SelectedIndex = 1;
}
base.OnNavigatedTo(e);
}