/// <inheritdoc /> public async Task <TResult> NavigateAsync <TResult>( IWavesViewModel <TResult> viewModel, bool addToHistory = true) { try { var view = await _core.GetInstanceAsync <IWavesView>(viewModel.GetType()); switch (view) { case IWavesWindow <TContent> window: return(await NavigateToWindowAsync(window, viewModel)); case IWavesUserControl <TContent> userControl: return(await NavigateToUserControlAsync(userControl, viewModel, addToHistory)); case IWavesPage <TContent> page: return(await NavigateToPageAsync(page, viewModel, addToHistory)); case IWavesDialog <TContent> dialog: return(await NavigateToDialogAsync(dialog, (IWavesDialogViewModel <TResult>) viewModel, addToHistory)); } } catch (Exception e) { Logger.LogError(e, "An error occured while navigating"); } return(default);
/// <inheritdoc /> public async Task NavigateAsync(IWavesViewModel viewModel, bool addToHistory = true) { try { var view = await _core.GetInstanceAsync <IWavesView>(viewModel.GetType()); switch (view) { case IWavesWindow <TContent> window: await InitializeWindowAsync(window, viewModel); break; case IWavesUserControl <TContent> userControl: await InitializeUserControlAsync(userControl, viewModel, addToHistory); break; case IWavesPage <TContent> page: await InitializePageAsync(page, viewModel, addToHistory); break; case IWavesDialog <TContent> dialog: await InitializeDialogAsync(dialog, (IWavesDialogViewModel)viewModel, addToHistory); break; } } catch (Exception e) { Logger.LogError(e, "An error occured while navigating"); } }