Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix winui-fluid example #311

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions examples/winui-fluid/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ public App()
// Node.js require() searches for modules/packages relative to the CWD.
Environment.CurrentDirectory = Path.GetDirectoryName(typeof(App).Assembly.Location)!;

string libnodePath = Path.Combine(
Path.GetDirectoryName(typeof(App).Assembly.Location)!,
"libnode.dll");
string appDir = Path.GetDirectoryName(typeof(App).Assembly.Location)!;
string libnodePath = Path.Combine(appDir, "libnode.dll");
NodejsPlatform nodejsPlatform = new(libnodePath);

Nodejs = nodejsPlatform.CreateEnvironment();
Nodejs = nodejsPlatform.CreateEnvironment(appDir);
if (Debugger.IsAttached)
{
int pid = Process.GetCurrentProcess().Id;
Expand Down
12 changes: 6 additions & 6 deletions examples/winui-fluid/CollabEditBox.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private void LoadFluidClient(string fluidServiceUri)
{
JSValue logFunction = JSValue.CreateFunction("send", (args) =>
{
var e = this.marshaller.To<TelemetryBaseEvent>(args[0]);
var e = this.marshaller.FromJS<TelemetryBaseEvent>(args[0]);
Debug.WriteLine($"[fluid:{e.Category}] {e.EventName}");
return JSValue.Undefined;
});
Expand All @@ -89,8 +89,8 @@ private void LoadFluidClient(string fluidServiceUri)

JSValue tinyliciousClient =
this.nodejs.Import("@fluidframework/tinylicious-client", "TinyliciousClient")
.CallAsConstructor(this.marshaller.From(clientProps));
this.fluidClient = this.marshaller.To<ITinyliciousClient>(tinyliciousClient);
.CallAsConstructor(this.marshaller.ToJS(clientProps));
this.fluidClient = this.marshaller.FromJS<ITinyliciousClient>(tinyliciousClient);
});
}

Expand Down Expand Up @@ -124,7 +124,7 @@ private ISharedString GetSharedDocument()
"sequenceDelta",
JSValue.CreateFunction("sequenceDelta", OnSharedStringDelta));

return this.marshaller.To<ISharedString>(sharedString);
return this.marshaller.FromJS<ISharedString>(sharedString);
}

private IDictionary<string, (int, int)> GetSharedSelections()
Expand Down Expand Up @@ -431,7 +431,7 @@ private void OnTextChanged(int index, int length, string text)

private JSValue OnSharedStringDelta(JSCallbackArgs args)
{
var deltaEvent = this.marshaller.To<SequenceDeltaEvent>(args[0]);
var deltaEvent = this.marshaller.FromJS<SequenceDeltaEvent>(args[0]);

Debug.WriteLine(
$"SequenceDelta(IsLocal={deltaEvent.IsLocal}, ClientId={deltaEvent.ClientId})");
Expand Down Expand Up @@ -527,7 +527,7 @@ private void OnRemoteEdit(MergeTreeOp op)

private JSValue OnSharedMapValueChanged(JSCallbackArgs args)
{
var changedEvent = this.marshaller.To<SharedMapValueChangedEvent>(args[0]);
var changedEvent = this.marshaller.FromJS<SharedMapValueChangedEvent>(args[0]);
bool isLocal = (bool)args[1];

if (!isLocal)
Expand Down
6 changes: 0 additions & 6 deletions examples/winui-fluid/Directory.Build.props

This file was deleted.

2 changes: 1 addition & 1 deletion examples/winui-fluid/winui-fluid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<PackageReference Include="Microsoft.JavaScript.NodeApi" Version="$(NodeApiDotnetPackageVersion)" />
<PackageReference Include="Microsoft.JavaScript.NodeApi.DotNetHost" Version="$(NodeApiDotnetPackageVersion)" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.*" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.755" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>

Expand Down
Loading