Skip to content

Instantly share code, notes, and snippets.

@AnsonSmith
Created October 8, 2010 20:13
Show Gist options
  • Save AnsonSmith/617448 to your computer and use it in GitHub Desktop.
Save AnsonSmith/617448 to your computer and use it in GitHub Desktop.
public class RandomScreenViewModel:Screen
{
public RandomScreenViewModel()
{
Guid id = Guid.NewGuid();
DisplayName = id.ToString();
}
private int onInitializeCalls = 0;
private int onActivateCalls = 0;
private int onDeactivateCalls = 0;
public int OnInitializeCalls
{
get
{
return onInitializeCalls;
}
set
{
onInitializeCalls = value;
NotifyOfPropertyChange(() => OnInitializeCalls);
}
}
public int OnActivateCalls
{
get
{
return onActivateCalls;
}
set
{
onActivateCalls = value;
NotifyOfPropertyChange(() => OnActivateCalls);
}
}
public int OnDeactivateCalls
{
get
{
return onDeactivateCalls;
}
set
{
onDeactivateCalls = value;
NotifyOfPropertyChange(() => OnDeactivateCalls);
}
}
protected override void OnInitialize()
{
OnInitializeCalls++;
base.OnInitialize();
}
protected override void OnActivate()
{
OnActivateCalls++;
base.OnActivate();
}
protected override void OnDeactivate(bool close)
{
OnDeactivateCalls++;
base.OnDeactivate(close);
}
public void CloseScreen()
{
base.TryClose();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment