Home > Mobile >  How to pass a Boolean value to another script before closing window?
How to pass a Boolean value to another script before closing window?

Time:08-30

I have two windows, each has their own cs script: One login window and one main window, in the login window I have a boolean bool keepLogin which is set to true or false whenever the user ticket a "Remember me" checkbox.

Now after the login is completed, the login window closes using this.Close() and opens the main window using MainWindow mainWindow = new MainWindow() and mainWindow.Show().

I assume this also closes the CS script attached to the login window, so how can I pass on the bool keepLogin to the CS of mainWindow so it can be used there?

CodePudding user response:

Solved using Clemens method in the comment on the post:

"Add a public property to the MainWindow and set it e.g. like var mainWindow = new MainWindow { MyBooleanProperty = someBooleanValue }; mainWindow.Show();"

  • Related