Interestingly, the following code works in my environment:
if (App.HasDashboardRole) { App.Current.Dispatcher.Invoke(new Action(() => { var bs = new BBCodeBlock(); bs.LinkNavigator.Navigate(new Uri("/Pages/Dashboard.xaml", UriKind.Relative), this); })); } else if (App.HasBarcodeBuilderRole) { App.Current.Dispatcher.Invoke(new Action(() => { var bs = new BBCodeBlock(); bs.LinkNavigator.Navigate(new Uri("/Pages/BarcodeBuilderPage.xaml", UriKind.Relative), this); })); }
If this code is not:
App.Current.Dispatcher.Invoke(new Action(() => { var bs = new BBCodeBlock(); if (App.HasDashboardRole) bs.LinkNavigator.Navigate(new Uri("/Pages/Dashboard.xaml", UriKind.Relative), this); else if (App.HasBarcodeBuilderRole) bs.LinkNavigator.Navigate(new Uri("/Pages/BarcodeBuilderPage.xaml", UriKind.Relative), this); }));
source share