mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-09-20 10:05:57 +08:00
Update demo projects
This commit is contained in:
parent
26305a9687
commit
f5dbc2de9f
|
@ -24,6 +24,15 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||
|
||||
ElixirKit.API.publish("log", "Hello from AppKit!")
|
||||
|
||||
ElixirKit.API.addObserver(queue: .main) { (name, data) in
|
||||
switch name {
|
||||
case "log":
|
||||
print("[client] " + data)
|
||||
default:
|
||||
fatalError("unknown event \(name)")
|
||||
}
|
||||
}
|
||||
|
||||
let menuItemOne = NSMenuItem()
|
||||
menuItemOne.submenu = NSMenu(title: "Demo")
|
||||
menuItemOne.submenu?.items = [
|
||||
|
|
|
@ -19,6 +19,19 @@ static class DemoMain
|
|||
|
||||
ElixirKit.API.Publish("log", "Hello from Windows Forms!");
|
||||
|
||||
ElixirKit.API.Subscribe((name, data) =>
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "log":
|
||||
Console.WriteLine($"[client] {data}");
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception($"unknown event {name}");
|
||||
}
|
||||
});
|
||||
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new DemoForm());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue