I have two customized NSWindow in my application like these:
Window 1:
public partial class LoginVindow : NSWindow
{
public LoginVindow (IntPtr handle) : base (handle)
{
}
}
Window 2:
public partial class OperationWindow : NSWindow
{
public OperationWindow (IntPtr handle) : base (handle)
{
}
}
Now, I want close the first Window after a button click and open the second Window. However, this code cannot run for me.
partial void LoginButton_Clicked(Foundation.NSObject sender)
{
Window.Close(); // Closes the first login window.
var operation_window = new OperationWindow(Handle); // Gets the second Window. IntPtr parameter is required unlike the internet codeblocks.
operation_window.ShowWindow(this); // No any method like this.
}
All of the code blocks over internet seems for non-customized standard class NSWindow items but one of them is seems stable for me. However, it is not running. (Post in Xamarin Forums: https://forums.xamarin.com/discussion/122359/open-and-close-window-programmatically-xamarin-mac)
How can I handle this operation ? Please help, thanks.
ShowWindow
via the NSWindow itself, you show it via the aNSWindowController
as the NSWindow is owned by the NSWindowController (yourWindowController.ShowWindow(yourAppDel);
) – SushiHangover