2020-04-10 15:22:07 -07:00
|
|
|
|
// Copyright (c) Microsoft Corporation
|
|
|
|
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|
|
|
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
|
|
|
2021-03-02 20:56:37 +03:00
|
|
|
|
using System;
|
2020-03-06 17:46:51 -08:00
|
|
|
|
using System.Windows;
|
2021-03-02 20:56:37 +03:00
|
|
|
|
using Microsoft.PowerToys.Settings.UI.Library.Telemetry.Events;
|
|
|
|
|
|
using Microsoft.PowerToys.Telemetry;
|
2020-03-06 17:46:51 -08:00
|
|
|
|
|
2021-02-11 19:29:56 +03:00
|
|
|
|
namespace PowerToys.Settings
|
2020-03-06 17:46:51 -08:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2020-04-10 15:22:07 -07:00
|
|
|
|
/// Interaction logic for App.xaml.
|
2020-03-06 17:46:51 -08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public partial class App : Application
|
|
|
|
|
|
{
|
2021-03-02 20:56:37 +03:00
|
|
|
|
private MainWindow settingsWindow;
|
|
|
|
|
|
|
|
|
|
|
|
public bool ShowOobe { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public void OpenSettingsWindow(Type type)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (settingsWindow == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
settingsWindow = new MainWindow();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
settingsWindow.Show();
|
|
|
|
|
|
settingsWindow.NavigateToSection(type);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void InitHiddenSettingsWindow()
|
|
|
|
|
|
{
|
|
|
|
|
|
settingsWindow = new MainWindow();
|
|
|
|
|
|
|
2021-03-04 17:58:01 +01:00
|
|
|
|
Utils.ShowHide(settingsWindow);
|
|
|
|
|
|
Utils.CenterToScreen(settingsWindow);
|
2021-03-02 20:56:37 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Application_Startup(object sender, StartupEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!ShowOobe)
|
|
|
|
|
|
{
|
|
|
|
|
|
settingsWindow = new MainWindow();
|
|
|
|
|
|
settingsWindow.Show();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
PowerToysTelemetry.Log.WriteEvent(new OobeStartedEvent());
|
|
|
|
|
|
|
|
|
|
|
|
// Create the Settings window so that it's fully initialized and
|
|
|
|
|
|
// it will be ready to receive the notification if the user opens
|
|
|
|
|
|
// the Settings from the tray icon.
|
|
|
|
|
|
InitHiddenSettingsWindow();
|
|
|
|
|
|
|
|
|
|
|
|
OobeWindow oobeWindow = new OobeWindow();
|
|
|
|
|
|
oobeWindow.Show();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-03-06 17:46:51 -08:00
|
|
|
|
}
|
|
|
|
|
|
}
|