This commit is contained in:
stax76
2024-01-06 23:13:33 +01:00
parent 85e4e3f9df
commit 44e8ef7cd8

View File

@@ -385,7 +385,9 @@ public partial class MainForm : Form
foreach (string path in App.Settings.RecentFiles)
{
var file = AppClass.GetTitleAndPath(path);
var menuItem = MenuHelp.Add(recentMenuItem.Items, file.Title.ShortPath(100))!;
var menuItem = MenuHelp.Add(recentMenuItem.Items, file.Title.ShortPath(100));
if (menuItem != null)
menuItem.Click += (sender, args) => Player.LoadFiles(new[] { file.Path }, true, false);
}
@@ -416,13 +418,17 @@ public partial class MainForm : Form
{
if (item.Length != TimeSpan.Zero)
{
var menuItem = MenuHelp.Add(titlesMenuItem.Items, $"Title {item.Index + 1}")!;
var menuItem = MenuHelp.Add(titlesMenuItem.Items, $"Title {item.Index + 1}");
if (menuItem != null)
{
menuItem.InputGestureText = item.Length.ToString();
menuItem.Click += (sender, args) => Player.SetBluRayTitle(item.Index);
}
}
}
}
}
var profilesMenuItem = FindMenuItem(_("Profile"), "Profile");
@@ -432,8 +438,10 @@ public partial class MainForm : Form
{
if (!profile.StartsWith("extension."))
{
var menuItem = MenuHelp.Add(profilesMenuItem.Items, profile)!;
var menuItem = MenuHelp.Add(profilesMenuItem.Items, profile);
if (menuItem != null)
{
menuItem.Click += (sender, args) =>
{
Player.CommandV("show-text", profile);
@@ -442,6 +450,7 @@ public partial class MainForm : Form
}
}
}
}
var audioDevicesMenuItem = FindMenuItem(_("Audio Device"), "Audio Device");
@@ -451,7 +460,10 @@ public partial class MainForm : Form
foreach (var pair in Player.AudioDevices)
{
var menuItem = MenuHelp.Add(audioDevicesMenuItem.Items, pair.Value)!;
var menuItem = MenuHelp.Add(audioDevicesMenuItem.Items, pair.Value);
if (menuItem != null)
{
menuItem.IsChecked = pair.Name == Player.GetPropertyString("audio-device");
menuItem.Click += (sender, args) =>
@@ -462,6 +474,7 @@ public partial class MainForm : Form
};
}
}
}
var customMenuItem = FindMenuItem(_("Custom"), "Custom");
@@ -473,11 +486,15 @@ public partial class MainForm : Form
{
foreach (Binding binding in customBindings)
{
var menuItem = MenuHelp.Add(customMenuItem.Items, binding.Comment)!;
var menuItem = MenuHelp.Add(customMenuItem.Items, binding.Comment);
if (menuItem != null)
{
menuItem.Click += (sender, args) => Player.Command(binding.Command);
menuItem.InputGestureText = binding.Input;
}
}
}
else
{
if (ContextMenu.Items.Contains(customMenuItem))
@@ -889,7 +906,7 @@ public partial class MainForm : Form
path = path + "|" + title;
}
if (!string.IsNullOrEmpty(path) && path != @"bd://" && path != @"dvd://")
if (!string.IsNullOrEmpty(path) && path != "-" && path != @"bd://" && path != @"dvd://")
{
if (App.Settings.RecentFiles.Contains(path))
App.Settings.RecentFiles.Remove(path);