Last active
December 29, 2021 07:08
-
-
Save dhindrik/f82d0756fdca468747a0bb8e3c75e362 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
public class MyViewModel : ViewModelBase | |
{ | |
public event EventHandler DataUpdated | |
public override Task Initialize() | |
{ | |
//Subscribe to event when ViewModel in initialized. | |
DataUpdated += Data_DataUpdated; | |
} | |
public override Task OnApplicationSleep() | |
{ | |
//Unsubscribe to event. | |
DataUpdated -= Data_DataUpdated; | |
} | |
public override Task OnApplicationResume() | |
{ | |
//Subcribe to event again. | |
DataUpdated += Data_DataUpdated; | |
} | |
private void Data_Updated(object sender, EventArgs e) | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment