我有一个执行 IConfirmNavigation Request
和的查看模型, 执行 IConfirmurationNavigation Request
和http://msdn.microsoft.com/en-us/library/gg430861%28v=pandp.40%%29.aspx#sec10" rel="nofollow"。 我需要将这个查看模型的信息 传送到一个我拥有的导航中介类, 与任何特定的观点或查看模型无关。
相反,导航代理商类可以访问感兴趣的IRegion
以及IRegion Navigation Service
。
ViewModel Adding Parameters to Uri
public override void ConfirmNavigationRequest(NavigationContext navigationContext,
Action<bool> continuationCallback)
{
_verificationCount++;
navigationContext.Parameters.Add("Count", _verificationCount.ToString());
continuationCallback(Verify());
}
A Navigation Broker that Needs To Access the Passed Parameters
// Some method
_region.RequestNavigate(new Uri(_nextView, UriKind.Relative), NavigationCallback);
private void NavigationCallback(NavigationResult navigationResult)
{
if (navigationResult.Error == null)
{
if (navigationResult.Result == true)
{
// Need to evaluate the Count argument here
// int count = ...
// if (count < 5)
QueueNextView();
} else
{
Debug.WriteLine("Navigation Cancelled");
}
}
else
{
Debug.WriteLine("Navigation Error");
}
}
How to Access Parameter Through Region or NavigationService, Outside ViewModel?
- I cannot find a way to access
NavigationContext
throughNavigationService
orRegion
? - I also tried this
_region.NavigationService.Journal.CurrentEntry.Uri.OriginalString
but it did not show any query information, just the registered View string name