| 6 | |
---|
| 7 | {{{ |
---|
| 8 | #!html |
---|
| 9 | <h1 style="font-family: Tahoma, Verdana, sans-serif; font-size: 19pt; font-weight: normal">The Juno Project</h1> |
---|
| 10 | <h2 style="font-family: Georgia, Times New Roman, serif; font-size: 14pt; font-weight: normal">Introduction</h2> |
---|
| 11 | <p style="font-family: Arial, Verdana, sans-serif; font-size: 11pt; font-weight: bold">Juno is a general-purpose class library for the D programming language. It aims to offer the kind of power and ease-of-use enjoyed on platforms such as .NET and Java to D developers.</p> |
---|
| 12 | <p style="font-family: Arial, Verdana, sans-serif; font-size: 11pt">Juno compiles only on Windows and is distributed under the BSD licence.</p> |
---|
| 13 | <p style="font-family: Arial, Verdana, sans-serif; font-size: 11pt">More details, documentation and downloads will be coming soon. In the meantime, here's Juno in action, loading an XML document and getting notified when it's loaded.</p> |
---|
| 14 | }}} |
---|
| 15 | {{{ |
---|
| 16 | #!d |
---|
| 17 | import juno.base.all, |
---|
| 18 | juno.xml.msxml; |
---|
| 19 | |
---|
| 20 | void main() { |
---|
| 21 | // Create an instance of IXMLDOMDocument3. |
---|
| 22 | using (XMLDOMDocument60.createInstance!(IXMLDOMDocument3), delegate(IXMLDOMDocument3 doc) { |
---|
| 23 | |
---|
| 24 | // Create an event provider. |
---|
| 25 | alias EventProvider!(XMLDOMDocumentEvents) Events; |
---|
| 26 | using (new Events(doc), delegate(Events e) { |
---|
| 27 | |
---|
| 28 | // Attach an event handler for doc's onReadyStateChange event. |
---|
| 29 | alias EventProvider!(XMLDOMDocumentEvents) Events; |
---|
| 30 | e.bind("onReadyStateChange", delegate { |
---|
| 31 | writefln("state changed"); |
---|
| 32 | int readyState; |
---|
| 33 | doc.get_readyState(readyState); |
---|
| 34 | // Do something once the document has fully loaded. |
---|
| 35 | if (readyState == 4) |
---|
| 36 | writefln("document complete."); |
---|
| 37 | }); |
---|
| 38 | |
---|
| 39 | // Tell the document to load asynchronously. |
---|
| 40 | doc.set_aync(com_true); |
---|
| 41 | // Load the XML document. |
---|
| 42 | com_bool result; |
---|
| 43 | doc.load("books.xml".toVariant(), result); |
---|
| 44 | |
---|
| 45 | }); // e is automatically released at the end of the scope. |
---|
| 46 | |
---|
| 47 | }); // doc is automatically released |
---|
| 48 | } |
---|
| 49 | }}} |