mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
* new lines & braces * Tabs /space auto fix Co-authored-by: Clint Rutkas <crutkas@microsoft.com>
71 lines
2.0 KiB
C#
71 lines
2.0 KiB
C#
// 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.
|
|
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using FancyZonesEditor.Models;
|
|
using ManagedCommon;
|
|
|
|
namespace FancyZonesEditor
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for App.xaml
|
|
/// </summary>
|
|
public partial class App : Application
|
|
{
|
|
public Settings ZoneSettings { get; }
|
|
|
|
public App()
|
|
{
|
|
ZoneSettings = new Settings();
|
|
}
|
|
|
|
private void OnStartup(object sender, StartupEventArgs e)
|
|
{
|
|
RunnerHelper.WaitForPowerToysRunner(Settings.PowerToysPID, () =>
|
|
{
|
|
Environment.Exit(0);
|
|
});
|
|
|
|
LayoutModel foundModel = null;
|
|
|
|
foreach (LayoutModel model in ZoneSettings.DefaultModels)
|
|
{
|
|
if (model.Type == Settings.ActiveZoneSetLayoutType)
|
|
{
|
|
// found match
|
|
foundModel = model;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (foundModel == null)
|
|
{
|
|
foreach (LayoutModel model in Settings.CustomModels)
|
|
{
|
|
if ("{" + model.Guid.ToString().ToUpper() + "}" == Settings.ActiveZoneSetUUid.ToUpper())
|
|
{
|
|
// found match
|
|
foundModel = model;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (foundModel == null)
|
|
{
|
|
foundModel = ZoneSettings.DefaultModels[0];
|
|
}
|
|
|
|
foundModel.IsSelected = true;
|
|
|
|
EditorOverlay overlay = new EditorOverlay();
|
|
overlay.Show();
|
|
overlay.DataContext = foundModel;
|
|
}
|
|
}
|
|
}
|