c# - Event is null after restarting app -


current have event in app.xaml.cs

    public partial class app : application     {         public static event eventhandler settingssaved;          private async void application_launching(object sender, launchingeventargs e)         {             if (settingssaved != null)             {                 settingssaved(this, null);             }      } 

and in mainpage.xaml.cs

    public mainpage()     {                 initializecomponent();          app.settingssaved += app_settingssaved;      }      void app_settingssaved(object sender, eventargs e)     {          //do here     } 

settingssaved works fine when app launched first time, when app launched second time, settingssaved becomes null. there way make sure settingssaved works same when app launched first time?

i'm novice coder , i'm pretty sure i'm missing fundamental here.

instead of putting in public mainpage(), maybe try putting in app.initialize event ensure absolutely happens on start-up.


Comments

Popular posts from this blog

java - How to Configure JAXRS and Spring With Annotations -

visual studio - TFS will not accept changes I've made to a Java project -

php - Create image in codeigniter on the fly -