Skip to content

Commit d3a0547

Browse files
committed
implement context_menu with JoinableTaskFactory
1 parent 38c9641 commit d3a0547

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Flow.Launcher.Core/Plugin/JsonRPCPluginV2.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,23 @@ protected override async Task<bool> ExecuteResultAsync(JsonRPCResult result)
3939
}
4040
}
4141

42+
private JoinableTaskFactory JTF { get; } = new JoinableTaskFactory(new JoinableTaskContext());
43+
4244
public override List<Result> LoadContextMenus(Result selectedResult)
4345
{
44-
throw new NotImplementedException();
46+
try
47+
{
48+
var res = JTF.Run(() => RPC.InvokeWithCancellationAsync<JsonRPCQueryResponseModel>("context_menu",
49+
new object[] { selectedResult.ContextData }));
50+
51+
var results = ParseResults(res);
52+
53+
return results;
54+
}
55+
catch
56+
{
57+
return new List<Result>();
58+
}
4559
}
4660

4761
public override async Task<List<Result>> QueryAsync(Query query, CancellationToken token)

0 commit comments

Comments
 (0)