public void RestoreState() { _ignoreChanges = true; try { if (_store != null && _store.WindowPositions.TryGetValue(_windowName, out var data)) { WindowPosition.SizeToFit(ref data); WindowPosition.MoveIntoView(ref data); if (IsMainWindow) { WindowPosition.SizeToMinSize(ref data, MinSizeFactor); } WindowPosition.ToWindow(_window, data); } else if (IsMainWindow) { _window.WindowState = WindowState.Maximized; } } finally { _ignoreChanges = false; } }