Skip to content

Instantly share code, notes, and snippets.

@cdm
Created March 27, 2016 07:04
Show Gist options
  • Save cdm/b09d19380bef4256e47a to your computer and use it in GitHub Desktop.
Save cdm/b09d19380bef4256e47a to your computer and use it in GitHub Desktop.
ViewModel Extensions for Xamarin
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