public static async Task <bool> EnsureViewType(JObject root, ISerializableView view, bool throwException = true, bool showMessage = false) { var viewType = root["type"].Value <string>(); if (viewType == view.ViewType) { return(true); } if (throwException) { throw new SerializationException("Could not deserialize view - wrong view type detected."); } if (showMessage) { await XamarinHelpers.ShowOkMessage("Wrong page or view type detected", $"Expected {view.ViewType.Split('.').Last()} but found {viewType.Split('.').Last()}\n\n\n" + $"(Full types \"{view.ViewType}\" != \"{viewType}\")"); } return(false); }
private void OnUnhandledException(object sender, UnhandledExceptionEventArgs e) { e.Handled = true; var errMsg = XamarinHelpers.ShowOkMessage("Error", $"An unexpected error occurred: \n{e.Exception}"); }