Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up App.xaml.cs #1628

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Clean up App.xaml.cs #1628

wants to merge 2 commits into from

Conversation

MGGSK
Copy link
Contributor

@MGGSK MGGSK commented Oct 1, 2024

Cleaned up the app.xaml.cs file.

Description

1.Removed UWP code from the file.
2.Added comments to the file.
3.Made the code cleaner.
4.Removed unused code.

Motivation and Context

UWP code should not be in a WinUI app.

How Has This Been Tested?

No testing needed.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

WinUIGallery/App.xaml.cs Outdated Show resolved Hide resolved
@karkarl
Copy link
Collaborator

karkarl commented Nov 13, 2024

/azp run

/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();

#if WINUI_PRERELEASE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is related to using WinUI Gallery with (internal) builds of WASDK?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code I removed was UWP code that doesn't work on the WASDK.


public void EnableSound(bool withSpatial = false)
{
ElementSoundPlayer.State = ElementSoundPlayerState.On;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still works today in WinUI, right? There's a setting in Settings to turn this on/off

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function is not being used and the setting works without it.

public Frame GetRootFrame()
{
Frame rootFrame;
NavigationRootPage rootPage = StartupWindow.Content as NavigationRootPage;
var rootPage = StartupWindow.Content as NavigationRootPage;
if (rootPage == null)
Copy link
Contributor

@niels9001 niels9001 Dec 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we fix this, could we do this instead:

if (StaturWindow.Content is NavigationRootPage rootpage)

@MGGSK MGGSK closed this Dec 6, 2024
@MGGSK MGGSK force-pushed the Cleanup-app.xaml.cs branch from f2ad3b1 to 96beae3 Compare December 6, 2024 16:19
@MGGSK MGGSK reopened this Dec 6, 2024
@MGGSK MGGSK closed this Dec 6, 2024
@MGGSK MGGSK reopened this Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants