Skip to content
This repository has been archived by the owner on Oct 1, 2023. It is now read-only.

Commit

Permalink
Fixing bug when a new instance is called when another already exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarconiGRF committed Jun 22, 2020
1 parent 01e3e60 commit ca5312e
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,22 @@ protected override void OnActivated(IActivatedEventArgs args)

if (widgetArgs != null)
{
var rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
Window.Current.Content = rootFrame;
if (widgetArgs.IsLaunchActivation)
{
var rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
Window.Current.Content = rootFrame;

widget1 = new XboxGameBarWidget(
widgetArgs,
Window.Current.CoreWindow,
rootFrame);
rootFrame.Navigate(typeof(MainPage));
widget1 = new XboxGameBarWidget(
widgetArgs,
Window.Current.CoreWindow,
rootFrame);
rootFrame.Navigate(typeof(MainPage));

Window.Current.Closed += MainPageWindow_Closed;
Window.Current.Closed += MainPageWindow_Closed;

Window.Current.Activate();
Window.Current.Activate();
}
}
else
{
Expand All @@ -92,6 +95,11 @@ protected override void OnActivated(IActivatedEventArgs args)

}

/// <summary>
/// Handles the closing event sent to Widget's main window.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async void MainPageWindow_Closed(object sender, Windows.UI.Core.CoreWindowEventArgs e)
{
widget1 = null;
Expand Down

0 comments on commit ca5312e

Please sign in to comment.