MainWindow.cs: fix window-size clamping function, and only save size&position when  not maximized & not minimized

this fix issue: https://github.com/ZeroK-RTS/Zero-K-Infrastructure/issues/44