Net Interface Guide Version 12.1
Total Page:16
File Type:pdf, Size:1020Kb
The tool of thought for expert programming .Net Interface Guide Version 12.1 Dyalog is a trademark of Dyalog Limited Copyright 1982-2009 by Dyalog Limited. All rights reserved. Version 12.1.0 produced on 2009/11/06 First Edition October 2009 No part of this publication may be reproduced in any form by any means without the prior written permission of Dyalog Limited. Dyalog Limited makes no representations or warranties with respect to the contents hereof and specifically disclaims any implied warranties of merchantability or fitness for any particular purpose. Dyalog Limited reserves the right to revise this publication without notification. TRADEMARKS: SQAPL is copyright of Insight Systems ApS. UNIX is a trademark of X/Open Ltd. Windows, Windows Vista, Visual Basic and Excel are trademarks of Microsoft Corporation. All other trademarks and copyrights are acknowledged. iii Contents C H A P T E R 1 Overview ......................................................................................... 1 Classic and Unicode Versions ..................................................................................... 1 Introduction ................................................................................................................. 1 .NET Classes ............................................................................................................... 2 GUI Programming with System.Windows.Forms ...................................................... 2 Web Services .............................................................................................................. 2 ASP.NET and WebForms ........................................................................................... 3 Prerequisites ................................................................................................................ 3 The bin Directory ........................................................................................................ 3 Files Installed with Dyalog ......................................................................................... 4 C H A P T E R 2 Accessing .NET Classes ............................................................... 5 Introduction ................................................................................................................. 5 Locating .NET Classes and Assemblies ...................................................................... 5 Using .NET Classes .................................................................................................... 8 Constructors and Overloading .................................................................................... 9 How the ⎕NEW System Function is implemented ....................................................... 9 Displaying a .NET Object ......................................................................................... 10 Exploring .NET Classes ............................................................................................ 10 Advanced Techniques ............................................................................................... 18 Shared Members ....................................................................................................... 18 APL language extensions for .NET objects .............................................................. 18 Exceptions ................................................................................................................. 20 More Examples ......................................................................................................... 21 Directory and File Manipulation ............................................................................... 21 Sending an email ....................................................................................................... 22 Web Scraping ............................................................................................................ 23 Enumerations ............................................................................................................ 25 Handling Pointers with Dyalog.ByRef ..................................................................... 27 C H A P T E R 3 Using Windows.Forms ................................................................ 29 Introduction ............................................................................................................... 29 Creating GUI Objects................................................................................................ 29 Object Hierarchy ....................................................................................................... 30 Positioning and Sizing Forms and Controls .............................................................. 30 Modal Dialog Boxes ................................................................................................. 30 Example 1 ................................................................................................................. 31 Example 2 ................................................................................................................. 34 iv Contents Non-Modal Forms .................................................................................................... 35 DataGrid Examples .................................................................................................. 35 GDIPLUS Workspace .............................................................................................. 36 TETRIS Workspace .................................................................................................. 36 WEBSERVICES Workspace ................................................................................... 36 C H A P T E R 4 Writing .NET Classes in Dyalog APL ........................................... 37 Introduction .............................................................................................................. 37 Assemblies, Namespaces and Classes ...................................................................... 37 Example 1 ................................................................................................................. 38 aplfns1.cs .................................................................................................................. 41 Calling IndexGen from Dyalog APL ........................................................................ 42 Example 2 ................................................................................................................. 43 aplfns2.cs .................................................................................................................. 45 Example 2a ............................................................................................................... 46 aplfns2a.cs ................................................................................................................ 46 Example 3 ................................................................................................................. 48 aplfns3.cs .................................................................................................................. 51 Example 4 ................................................................................................................. 52 aplfns4.cs .................................................................................................................. 55 Example 5 ................................................................................................................. 56 aplfns5.cs .................................................................................................................. 58 Interfaces .................................................................................................................. 60 C H A P T E R 5 Dyalog APL and IIS ..................................................................... 63 Introduction .............................................................................................................. 63 IIS Applications and Virtual Directories .................................................................. 64 Internet Services Manager ........................................................................................ 64 The dyalog.net Virtual Directory .............................................................................. 65 Creating the dyalog.net Virtual Directory ................................................................ 66 Creating the dyalog.net Virtual Sub-Directories ...................................................... 71 C H A P T E R 6 Writing Web Services .................................................................. 73 Introduction .............................................................................................................. 73 Web Service (.asmx) Scripts .................................................................................... 74 Compilation .............................................................................................................. 75 Exporting Methods ................................................................................................... 75 Add1 ......................................................................................................................... 76 Add2 ......................................................................................................................... 76 Web Service Data Types .........................................................................................