Last active
May 19, 2016 07:22
-
-
Save blackice2999/44a3f5c3fe2de695f5cc371234dc75ee to your computer and use it in GitHub Desktop.
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 FreshMvvm | |
{ | |
public class FreshPageModelMapper : IFreshPageModelMapper | |
{ | |
public string GetPageTypeName (Type pageModelType) | |
{ | |
var name = pageModelType.AssemblyQualifiedName; | |
if (name.IndexOf ("PageModel") != -1) | |
return name.Replace ("PageModel", "Page"); | |
if (name.IndexOf ("ViewModel") != -1) { | |
if (Type.GetType (name.Replace ("ViewModel", "View")) != null) | |
return name.Replace ("ViewModel", "View"); | |
if (Type.GetType (name.Replace ("ViewModel", "Page")) != null) | |
return name.Replace ("ViewModel", "Page"); | |
} | |
return ""; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Needs rewrite by C# Coder... this is only proof of concept