从F#发送吐司

时间:2015-05-28 18:43:33

标签: windows-8 f# windows-runtime

我想从F#控制台应用程序发送Windows 8.1样式的ToastNotification

这是我的代码:

let gotMessage message =
    let xdoc = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText03)
    let children = xdoc.ChildNodes
    children.[0 |> uint32].AppendChild(xdoc.CreateTextNode "Message coming") |> ignore
    children.[2 |> uint32].AppendChild(xdoc.CreateTextNode message) |> ignore
    let toast = new ToastNotification(xdoc)
    toast.add_Activated (fun notification _ -> 0 |> ignore) |> ignore

但我得到以下例外:

首先是德国人:

System.IO.FileNotFoundException wurde nicht behandelt.
Message: Ein Ausnahmefehler des Typs "System.IO.FileNotFoundException" ist in Ineedtea.Server.exe aufgetreten.
Zusätzliche Informationen: Die Datei oder Assembly "Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.

现在是英文

System.IO.FileNotFoundException was not handled.
Message: An exception of type "System.IO.FileNotFoundException" appeared in Ineedtea.Server.exe.
Additional information: The file or assembly "Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null" or a dependency wasn't found. The system cannot find the file.

有没有人有想法?

1 个答案:

答案 0 :(得分:1)

我找到了一个解决方法,我创建了一个C#库,并在那里编写了Toaster类。

检查此Github存储库中的代码:) https://github.com/DerKnerd/ineedtea/tree/master/WinRTMapper