Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
krisdb2009 committed Sep 19, 2024
1 parent 46031a0 commit 3fc7693
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
7 changes: 3 additions & 4 deletions SuperLauncher/ModernLauncherIcon.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,14 @@ public string FilePath
{
rFilePath = value;
Icon icon = Icon.ExtractAssociatedIcon(rFilePath);
if (Name == null)
if (Title == null)
{
NameText.Text = Shared.ExtRemover(rFilePath);
}
else
{
NameText.Text = Title;
}

LIcon.Source = Imaging.CreateBitmapSourceFromHIcon(icon.Handle, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
}
}
Expand All @@ -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()
{
Expand Down Expand Up @@ -206,4 +205,4 @@ private void UserControl_Loaded(object sender, RoutedEventArgs e)
BadgeTimer.Elapsed += BadgeTimer_Elapsed;
}
}
}
}
14 changes: 8 additions & 6 deletions SuperLauncher/ModernLauncherIcons.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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();
}
Expand Down
2 changes: 2 additions & 0 deletions SuperLauncher/ModernLauncherShared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3fc7693

Please sign in to comment.