logo WinWrap®

IIS8 and IIS7

WinWrap® Basic is an embedded macro language component available for .NET and COM 32/64 bit Windows applications. The WinWrap® Basic Component is an alternative to Visual Basic for Applications (VBA), ActiveX (e.g. VBScript, JScript, PerlScript, Rexx-based WSH engines and others), and VSTA for this purpose. The WinWrap® Basic Component is compatible with VBA, Sax Basic, VB.NET and Visual Basic 6.0 style scripts.

Run Subroutine Macro Scripts from Your IIS8 and IIS7 Server Applications

  • Use WinWrap® Basic macros to specialize and extend an IIS application
  • Developers can extend an application without recompiling it
  • Installers can customize an application for a customer or group of customers
  • Share information with external applications
  • Use any of thousands of .NET Framework Classes

IIS7 and IIS8 Web Application

DataAnalyzer

  • Use WinWrap® Basic macros to specialize and extend an IIS application
  • The host IIS application promotes an "macro language extension API" into the script writer's environment
  • Script macros share and can use the powerful host API implemented in the extension dll
  • Create an script language extension API for use by script writers
  • Provide the script writer with an API (extensions) to the host IIS application
  • Use macros to extend and specialize host application functions
IIS7 and IIS8 Web Application

DataAnalyzer.Editor

  • Create a WinWrap® Basic macro editor application to edit the macros used by the IIS application
  • Check the script syntax
  • Check the .NET references
  • Receive errors in real-time from the IIS host application
  • Locate errors in script code with descriptive error information with line numbers
  • Update scripts from editor and retry IIS application from browser without use of any other development tools
IIS7 and IIS8 Web Application

DataAnalyzer.Extensions

  • The host application exposes a specific API to the macro script writer
using System.ComponentModel; namespace DataAnalyzer.Extensions { public static class Host { public static ISeries Series { get; [EditorBrowsable(EditorBrowsableState.Never)] set; } } public interface ISeries { string Title { set; } string LowerLegend { set; } string UpperLegend { set; } string AxisX { set; } string AxisY { set; } void AddY(double y1, double y2); } }

IIS Application Engine.cs Class

using DataAnalyzer.Common; using DataAnalyzer.Extensions; using System; using System.Collections.Generic; using System.Data; using WinWrap.Basic; /// /// Execute WinWrap Basic scripts /// public class Engine { private Macros Macros { get; set; } private TraceMsgs TraceMsgs { get; set; } private Series Series { get; set; } public Engine(TraceMsgs traceMsgs, Macros macros, Series series) { TraceMsgs = traceMsgs; Macros = macros; Series = series; } public List<string> Run(DataTable dt, string macro) { List<string> ls = new List<string>(); DateTime t1 = DateTime.Now; using (BasicNoUIObj winwrap = new BasicNoUIObj()) { try { winwrap.Initialize(); winwrap.ReadMacro+=winwrap_ReadMacro; winwrap.AddExtension("#", (new DataTable()).GetType().Assembly); winwrap.AddExtension("#", typeof(Host).Assembly); TraceMsgs.Append((string)winwrap.Query("GetSystemInfo")["Text"]); Host.Series = Series; // connect Series object to Host Extensions using (Module module = winwrap.ModuleInstance("*" + macro, false)) { ls = (List<string>)module.Evaluate("ChartData", dt); } } catch (Exception ex) { TraceMsgs.Append(ex.ToString(), iserror: true); if (winwrap.Error != null) { TraceMsgs.Append(winwrap.Error.ToString(), iserror: true); } } } TimeSpan ts = DateTime.Now.Subtract(t1); TraceMsgs.Append(ts.ToString()); return ls; } void winwrap_ReadMacro(object sender, WinWrap.Basic.Classic.ReadMacroEventArgs e) { try { e.Code = Macros.Read(e.FileName); e.Cancel = false; e.Changed = false; } catch (Exception ex) { TraceMsgs.Append(ex.ToString()); } } }

WWB.NET Script Code

' ' LowHighTemperatureF.bas - Show high and low temperature for each day's weather data ' '# Language "WWB.NET" Imports System Imports System.Data Imports System.Collections.Generic ' ' Extend the WWB.NET (VB.NET compatible) scripting language ' Add the host application API namespace (defined in Extensions.cs) ' Imports DataAnalyzer.Extensions ' ' Analyze and chart the raw weather data ' Function ChartData(ByVal dt As DataTable) As List(Of String) ' Set the Chart Title, Legends, and Axes text SetTitleLegendsAxes(dt) ' Analyze and plot each row in the raw data from the DataTable (dt) For Each dr As DataRow In dt.Rows ' Retrieve each row's data from the its column Dim iMin As Double = Val(dr("Min TemperatureF")) Dim iMax As Double = Val(dr("Max TemperatureF")) ' Plot each X axis point with Y axis values ' Each Y axis value is composed of 2 value parts ' The 2 Y axis value parts are drawn as (blue, yellow) Host.Series.AddY(iMin, iMax - iMin) Next ' Return a list of table columns used for plotting data Return New List(Of String) (New String() {"Min TemperatureF", "Max TemperatureF"}) End Function ' Set the Chart Title, Legends, and Axes text Sub SetTitleLegendsAxes(ByVal dt As DataTable) Host.Series.Title = "High and Low TemperatureF for Each Day" Host.Series.LowerLegend = "Min TemperatureF" Host.Series.UpperLegend = "Max minus Min TemperatureF" Host.Series.AxisX = AxisX(dt) Host.Series.AxisY = "Max/Min TemperatureF" End Sub ' Calculate the Chart X axis text from the DataTable first and last dates Function AxisX(ByVal dt As DataTable) As String Dim d1 As String = dt.Rows(0)(0) Dim d2 As String = dt.Rows(dt.Rows.Count-1)(0) Dim t1 As DateTime = Convert.ToDateTime(d1) Dim t2 As DateTime = Convert.ToDateTime(d2) Return "Days from " + Convert.ToDateTime(d1).ToString("D") & " to " & Convert.ToDateTime(d2).ToString("D") End Function

Run the Host Application and Call LowHighTemperatureF.bas

Run the Script Subroutine

Theory of Operation for Using WinWrap® Basic with IIS8 and IIS7

  • Creating a BasicNoUIObj takes about .02 seconds
  • Calling ModuleInstance takes about .02 seconds
  • Calling Evaluate takes much less than .001 seconds

Copyright Polar Engineering, Inc.