Move Settings deep link logic to Microsoft.PowerToys.Common.UI (#13749)

* Move Settings deep link logic to Microsoft.PowerToys.Common.UI

* Spellcheck

* Introduce enum

* Remove PT path arg
This commit is contained in:
Stefan Markovic
2021-10-12 10:35:52 +02:00
committed by GitHub
parent 0ca9b1be48
commit 7e8e954de7
4 changed files with 79 additions and 22 deletions

View File

@@ -4,11 +4,10 @@
using System;
using System.ComponentModel.Composition;
using System.Diagnostics;
using System.IO;
using System.Windows;
using ColorPicker.Settings;
using ColorPicker.ViewModelContracts;
using Microsoft.PowerToys.Common.UI;
using Microsoft.PowerToys.Settings.UI.Library.Enumerations;
namespace ColorPicker.Helpers
@@ -189,17 +188,7 @@ namespace ColorPicker.Helpers
private void ColorEditorViewModel_OpenSettingsRequested(object sender, EventArgs e)
{
try
{
var assemblyPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
var fullPath = Directory.GetParent(assemblyPath).FullName;
Process.Start(new ProcessStartInfo(fullPath + "\\..\\PowerToys.exe") { Arguments = "--open-settings=ColorPicker" });
}
#pragma warning disable CA1031 // Do not catch general exception types
catch
#pragma warning restore CA1031 // Do not catch general exception types
{
}
SettingsDeepLink.OpenSettings(SettingsDeepLink.SettingsWindow.ColorPicker);
}
}
}