Skip to content

Instantly share code, notes, and snippets.

@blackice2999
Last active May 19, 2016 07:22
Show Gist options
  • Save blackice2999/44a3f5c3fe2de695f5cc371234dc75ee to your computer and use it in GitHub Desktop.
Save blackice2999/44a3f5c3fe2de695f5cc371234dc75ee to your computer and use it in GitHub Desktop.
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 "";
}
}
}
@blackice2999
Copy link
Author

Needs rewrite by C# Coder... this is only proof of concept

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment