Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kellabyte/1524391 to your computer and use it in GitHub Desktop.
Save kellabyte/1524391 to your computer and use it in GitHub Desktop.
public class MainViewModelFactory
: ViewModelFactory<MainViewModel, MainViewModelDesign>
{
}
/// <summary>
/// Design time version of the MainViewModel.
/// </summary>
public class MainViewModelDesign : MainViewModel
{
public override void OnLocated(bool newInstance)
{
#if DEBUG
// This gets called at design time.
this.Stories = new ObservableCollection<Story>();
this.Stories.Add(
new Story("The Windows Blog", "Upping our game..."));
this.Stories.Add(
new Story("Robot Overlords", "Nevada Passes Law..."));
this.Stories.Add(
new Story("TechCrunch", "eBay Acquired Magento..."));
this.Stories.Add(
new Story("Inside Facebook", "Facebook Testing..."));
this.Stories.Add(
new Story("FOSS Patents", "Eastman Kodak v..."));
#endif
}
}
public class MainViewModel : BaseViewModel
{
private Database db = null;
public MainViewModel()
{
}
public override void OnLocated(bool newInstance)
{
// This gets called at run time.
// Gah! Bad me. Wish I knew how to fix this.
// I will learn how though!
db = ApplicationHost.Current.Container.Resolve<Database>();
this.Stories = new ObservableCollection<Story>();
LoadDatabase();
GetFeedStories();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment