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

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -