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?
Solved using Clemens method in the comment on the post:
"Add a public property to the MainWindow and set it eg like var mainWindow = new MainWindow { MyBooleanProperty = someBooleanValue }; mainWindow.Show();
"
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.