fancy new command palette

This commit is contained in:
Frank Skare
2021-06-22 20:54:14 +02:00
parent bac8b2b96c
commit 55f16d2c53
19 changed files with 69 additions and 305 deletions

View File

@@ -12,8 +12,6 @@ namespace mpvnet
{
public static class App
{
public static event Action ShowCommandPalette;
public static List<string> TempFiles { get; } = new List<string>();
public static string ConfPath { get => Core.ConfigFolder + "mpvnet.conf"; }

View File

@@ -44,7 +44,6 @@ namespace mpvnet
case "show-input-editor": ShowDialog(typeof(InputWindow)); break;
case "show-keys": ShowTextWithEditor("input-key-list", Core.get_property_string("input-key-list").Replace(",", BR)); break;
case "show-media-info": ShowMediaInfo(args); break;
case "show-media-search": ShowDialog(typeof(EverythingWindow)); break;
case "show-playlist": ShowPlaylist(); break;
case "show-profiles": ShowTextWithEditor("profile-list", mpvHelp.GetProfiles()); break;
case "show-properties": ShowProperties(); break;

View File

@@ -388,7 +388,7 @@ namespace mpvnet
if (LogMessage != null || LogMessageAsync != null)
{
string msg = $"[{ConvertFromUtf8(data.prefix)}] {ConvertFromUtf8(data.text)}";
InvokeAsync<mpv_log_level, string>(LogMessageAsync, data.log_level, msg);
InvokeAsync(LogMessageAsync, data.log_level, msg);
LogMessage?.Invoke(data.log_level, msg);
}
}

View File

@@ -242,7 +242,14 @@ namespace mpvnet
public static IEnumerable<CommandPaletteItem> GetItems()
{
return CommandItem.Items.Select(i => new CommandPaletteItem() { Text = i.Display, SecondaryText = i.Input });
var aaa = CommandItem.Items.ToArray();
return CommandItem.Items
.Where(i => i.Command != "")
.Select(i => new CommandPaletteItem() {
Text = i.Display,
SecondaryText = i.Input,
Action = () => Core.command(i.Command)
});
}
}
}