简体   繁体   中英

How can I get Variable from One Page To Other Page withput using navigation In UWP C#?

I needed help.. [ ]

        _eMARTimer.Stop();
        _faxTimer.Stop();
        _faxRingtoneTimer.Stop();

This is my main page and I want to excute these method in thin page from.cs page which is in second page ] 1

What can I do in IF loop for excute that prog?

Please help me to solve this. Thank You so much for gave your focus.

I want to excute these method in thin page from.cs page which is in second page

For this scenario, you could use mvvmlight Messenger to approach. And if the other page and send page are not in the same window. you need set other page NavigationCacheMode="Required" in the xaml.

 public MainPage()
 {
     this.InitializeComponent(); 
     Messenger.Default.Register<bool>(this,(s) =>
     {
         if (s)
         {
        _eMARTimer.Stop();
        _faxTimer.Stop();
        _faxRingtoneTimer.Stop();
         }
        
     });

 }

Second Page

 Messenger.Default.Send<bool>(true);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM