From 3fc7693fd2e9e20d8eac659ef103c9057ded0f1a Mon Sep 17 00:00:00 2001 From: Dylan Bickerstaff Date: Thu, 19 Sep 2024 09:19:37 -0400 Subject: [PATCH] . --- SuperLauncher/ModernLauncherIcon.xaml.cs | 7 +++---- SuperLauncher/ModernLauncherIcons.xaml.cs | 14 ++++++++------ SuperLauncher/ModernLauncherShared.cs | 2 ++ 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/SuperLauncher/ModernLauncherIcon.xaml.cs b/SuperLauncher/ModernLauncherIcon.xaml.cs index e166e8b..47328c2 100644 --- a/SuperLauncher/ModernLauncherIcon.xaml.cs +++ b/SuperLauncher/ModernLauncherIcon.xaml.cs @@ -35,7 +35,7 @@ public string FilePath { rFilePath = value; Icon icon = Icon.ExtractAssociatedIcon(rFilePath); - if (Name == null) + if (Title == null) { NameText.Text = Shared.ExtRemover(rFilePath); } @@ -43,7 +43,6 @@ public string FilePath { NameText.Text = Title; } - LIcon.Source = Imaging.CreateBitmapSourceFromHIcon(icon.Handle, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); } } @@ -69,8 +68,8 @@ public bool FilterFocus public ModernLauncherIcon(string FilePath, string Title = null) { InitializeComponent(); - this.FilePath = FilePath; this.Title = Title; + this.FilePath = FilePath; } private readonly DoubleAnimation To1 = new() { @@ -206,4 +205,4 @@ private void UserControl_Loaded(object sender, RoutedEventArgs e) BadgeTimer.Elapsed += BadgeTimer_Elapsed; } } -} +} \ No newline at end of file diff --git a/SuperLauncher/ModernLauncherIcons.xaml.cs b/SuperLauncher/ModernLauncherIcons.xaml.cs index b33437b..ccdc459 100644 --- a/SuperLauncher/ModernLauncherIcons.xaml.cs +++ b/SuperLauncher/ModernLauncherIcons.xaml.cs @@ -58,17 +58,19 @@ public void PopulateIcons() { try { + XmlNodeList apps = Settings.Default.XDoc.SelectNodes("/SuperLauncher/AppList/App"); IconPanel.Children.Clear(); - foreach (string filePath in Settings.Default.FileList) + foreach (XmlNode app in apps) { - if (!File.Exists(filePath)) continue; - ModernLauncherIcon mli = new(filePath); + if (!File.Exists(app.InnerText)) continue; + + ModernLauncherIcon mli = new(app.InnerText); IconPanel.Children.Add(mli); } } catch { - IconPanel.Children.Add(new ModernLauncherIcon(@"C:\Windows\System32\cmd.exe")); + IconPanel.Children.Add(new ModernLauncherIcon(@"C:\Windows\System32\cmd.exe", "Command Prompt")); } } private void CommitIconsToFile() @@ -77,8 +79,8 @@ private void CommitIconsToFile() foreach (ModernLauncherIcon mli in IconPanel.Children) { Settings.Default.FileList.Add(mli.FilePath); - XmlNode node = Settings.Default.XDoc.SelectSingleNode("/SuperLauncher/AppList/App[. = \"" + mli.FilePath + "\"]"); - node.Attributes. + //XmlNode node = Settings.Default.XDoc.SelectSingleNode("/SuperLauncher/AppList/App[. = \"" + mli.FilePath + "\"]"); + //node.Attributes. } Settings.Default.Save(); } diff --git a/SuperLauncher/ModernLauncherShared.cs b/SuperLauncher/ModernLauncherShared.cs index 0494102..cd9d4c1 100644 --- a/SuperLauncher/ModernLauncherShared.cs +++ b/SuperLauncher/ModernLauncherShared.cs @@ -13,10 +13,12 @@ public static class Shared { public static double ScalePixelsUp(this DpiScale DPI, double Pixels) { + if (DPI.DpiScaleX == 0) return Pixels; return Pixels * DPI.DpiScaleX; } public static double ScalePixelsDown(this DpiScale DPI, double Pixels) { + if (DPI.DpiScaleX == 0) return Pixels; return Pixels / DPI.DpiScaleX; } public static string GetArugement(string ArgumentName)