Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
291 changes: 0 additions & 291 deletions src/Files.App/Data/Items/WindowEx.cs

This file was deleted.

4 changes: 1 addition & 3 deletions src/Files.App/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<!-- Copyright (c) Files Community. Licensed under the MIT License. -->
<winuiex:WindowEx
<Window
x:Class="Files.App.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:items="using:Files.App.Data.Items"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:winuiex="using:WinUIEx"
mc:Ignorable="d" />
19 changes: 12 additions & 7 deletions src/Files.App/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Microsoft.Extensions.Logging;
using Microsoft.UI;
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media.Animation;
using System.IO;
Expand All @@ -15,7 +16,7 @@

namespace Files.App
{
public sealed partial class MainWindow : WinUIEx.WindowEx
public sealed partial class MainWindow : Window
{
private static MainWindow? _Instance;
public static MainWindow Instance => _Instance ??= new();
Expand All @@ -28,18 +29,21 @@ public MainWindow()
{
InitializeComponent();

WindowHandle = WinUIEx.WindowExtensions.GetWindowHandle(this);
MinHeight = 316;
MinWidth = 416;
WindowHandle = WinRT.Interop.WindowNative.GetWindowHandle(this);
ExtendsContentIntoTitleBar = true;
Title = "Files";
PersistenceId = "FilesMainWindow";
AppWindow.TitleBar.ButtonBackgroundColor = Colors.Transparent;
AppWindow.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
AppWindow.TitleBar.ButtonPressedBackgroundColor = Colors.Transparent;
AppWindow.TitleBar.ButtonHoverBackgroundColor = Colors.Transparent;
AppWindow.SetIcon(AppLifecycleHelper.AppIconPath);

if (AppWindow.Presenter.TryCast<OverlappedPresenter>() is { } presenter)
{
presenter.PreferredMinimumHeight = 316;
presenter.PreferredMinimumWidth = 416;
}

WinUIEx.WindowManager.Get(this).WindowMessageReceived += WindowManager_WindowMessageReceived;
}

Expand Down Expand Up @@ -201,8 +205,9 @@ public async Task InitializeApplicationAsync(object activatedEventArgs)
Win32Helper.BringToForegroundEx(new(WindowHandle));
}

if (Windows.Win32.PInvoke.IsIconic(new(WindowHandle)))
WinUIEx.WindowExtensions.Restore(Instance); // Restore window if minimized
if (Windows.Win32.PInvoke.IsIconic(new(WindowHandle)) &&
AppWindow.Presenter.TryCast<OverlappedPresenter>() is { } presenter)
presenter.Restore(); // Restore window if minimized
}

private Frame? EnsureWindowIsInitialized()
Expand Down
Loading
Loading