Created
March 27, 2016 07:04
-
-
Save cdm/b09d19380bef4256e47a to your computer and use it in GitHub Desktop.
ViewModel Extensions for Xamarin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace FooBar.Extensions | |
{ | |
public static class ViewModelExtensions | |
{ | |
#region Static Methods | |
public static string GetExceptionMessage(this Exception exception) | |
{ | |
string exceptionMessage = exception.Message; | |
if (string.IsNullOrEmpty(exceptionMessage) && exception.InnerException != null) | |
exceptionMessage = exception.InnerException.Message; | |
return exceptionMessage.Replace("\"", ""); | |
} | |
public static void NavigateToMainViewModel(this INavigable viewModel) | |
{ | |
viewModel.NavigationService.Navigate<PropertySearchViewModel>(); | |
} | |
#endregion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment