#442 show chapters in the command palette

This commit is contained in:
stax76
2022-06-19 05:23:10 +02:00
parent 55f4a340af
commit 500fe9abc4
7 changed files with 63 additions and 14 deletions

View File

@@ -46,6 +46,7 @@ namespace mpvnet
case "show-about": ShowDialog(typeof(AboutWindow)); break;
case "show-audio-devices": Msg.ShowInfo(Core.GetPropertyOsdString("audio-device-list")); break;
case "show-audio-tracks": ShowAudioTracks(); break;
case "show-chapters": ShowChapters(); break;
case "show-command-palette": ShowCommandPalette(); break;
case "show-commands": ShowCommands(); break;
case "show-conf-editor": ShowDialog(typeof(ConfWindow)); break;
@@ -669,6 +670,16 @@ namespace mpvnet
CommandPalette.Instance.SelectFirst();
});
public static void ShowChapters() => App.InvokeOnMainThread(() =>
{
var items = Core.Chapters.Select(i => new CommandPaletteItem(i.Title, i.TimeDisplay, () =>
Core.CommandV("seek", i.Time.ToString(CultureInfo.InvariantCulture), "absolute")));
CommandPalette.Instance.SetItems(items);
MainForm.Instance.ShowCommandPalette();
CommandPalette.Instance.SelectFirst();
});
public static void ShowMenu() => Core.RaiseShowMenu();
public static void PlaylistAdd(int value)