Skip to content

Commit

Permalink
Remove WinRTHelper, now gallery runs on Windows 7
Browse files Browse the repository at this point in the history
  • Loading branch information
NotYoojun committed Dec 23, 2024
1 parent a150575 commit 5189d40
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 108 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,6 @@ public NavigationView NavigationView

public Action NavigationViewLoaded { get; set; }

public DeviceFamilyType DeviceFamily { get; set; }

public bool IsFocusSupported
{
get
{
return DeviceFamily == DeviceFamilyType.Xbox || _isGamePadConnected || _isKeyboardConnected;
}
}

public PageHeader PageHeader
{
Expand All @@ -93,23 +84,10 @@ public NavigationRootPage()

_navHelper = new RootFrameNavigationHelper(rootFrame, NavigationViewControl);

DeviceFamily = WinRTHelper.GetCurrentDeviceFamilyType() ?? DeviceFamilyType.Other;
AddNavigationMenuItems();
Current = this;
RootFrame = rootFrame;

try
{
if (WinRTHelper.IsSupported)
{
Gamepad.GamepadAdded += OnGamepadAdded;
Gamepad.GamepadRemoved += OnGamepadRemoved;

_isKeyboardConnected = Convert.ToBoolean(new KeyboardCapabilities().KeyboardPresent);
}
}
catch { _isKeyboardConnected = true; }

// remove the solid-colored backgrounds behind the caption controls and system back button if we are in left mode
// This is done when the app is loaded since before that the actual theme that is used is not "determined" yet
Loaded += delegate (object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -252,10 +230,10 @@ private static IconElement GetIcon(string imagePath)

private void OnNewControlsMenuItemLoaded(object sender, RoutedEventArgs e)
{
if (IsFocusSupported && NavigationViewControl.DisplayMode == NavigationViewDisplayMode.Expanded)
{
//controlsSearchBox.Focus(FocusState.Keyboard);
}
//if (IsFocusSupported && NavigationViewControl.DisplayMode == NavigationViewDisplayMode.Expanded)
//{
// //controlsSearchBox.Focus(FocusState.Keyboard);
//}
}

private void OnGamepadRemoved(object sender, Gamepad e)
Expand Down Expand Up @@ -577,10 +555,7 @@ private void UpdateHeaderMargin(NavigationView sender)

private void Page_Loaded(object sender, RoutedEventArgs e)
{
if (WinRTHelper.GetCurrentDeviceFamilyType() == DeviceFamilyType.Xbox)
{
XboxContentSafeRect.Visibility = Visibility.Visible;
}

}

private void rootFrame_Navigating(object sender, NavigatingCancelEventArgs e)
Expand Down
10 changes: 2 additions & 8 deletions source/iNKORE.UI.WPF.Modern.Gallery/Pages/ItemPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ public void SetInitialVisuals()
NavigationRootPage.Current.PageHeader.ToggleThemeAction = OnToggleTheme;
NavigationRootPage.Current.PageHeader.ResetCopyLinkButton();

if (NavigationRootPage.Current.IsFocusSupported)
{
this.Focus();
}
this.Focus();

//if (UIHelper.IsScreenshotMode)
//{
Expand Down Expand Up @@ -268,10 +265,7 @@ private void OnContentRootSizeChanged(object sender, SizeChangedEventArgs e)

private void Page_Loaded(object sender, RoutedEventArgs e)
{
if (WinRTHelper.GetCurrentDeviceFamilyType() == DeviceFamilyType.Xbox)
{
svPanel.Margin = new Thickness(0, 0, 48, 27);
}

}
}
}
8 changes: 4 additions & 4 deletions source/iNKORE.UI.WPF.Modern.Gallery/Pages/ItemsPageBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ protected async void OnItemGridViewLoaded(object sender, RoutedEventArgs e)
{
gridView.ScrollIntoView(item);

if (NavigationRootPage.Current.IsFocusSupported)
{
//((GridViewItem)gridView.ContainerFromItem(item))?.Focus(FocusState.Programmatic);
}
//if (NavigationRootPage.Current.IsFocusSupported)
//{
// //((GridViewItem)gridView.ContainerFromItem(item))?.Focus(FocusState.Programmatic);
//}
}
}
}
Expand Down
66 changes: 0 additions & 66 deletions source/iNKORE.UI.WPF.Modern/Helpers/WinRTHelper.cs

This file was deleted.

0 comments on commit 5189d40

Please sign in to comment.