Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Generally speaking, the WPF/VB.NET sample will be analogous to the WPF/C# sample. However, the problems are in the details: I initially find the WPF subsystem contains several C#-specific patterns in vbcontrols.xml; for example there example, there are a int and double casts as well as a few other C# patterns relating to data binding; for example:

 

Code Block
title vbcontrols.xml
 <pattern id="Top.Set" >
 <wpf narg="2" code="Canvas.SetTop(%2d,(double)(%1d))\c" />
 <all narg="2" code="%2d.Top = %1d\c" />
 </pattern> 

 

What is needed here is a VB.NET form for some WPF operations. This is analogous to the situation with SubSystem=loc/lob where some patterns need both a VB.NET and a C# form.  For WPF we will need a pair of subsystems, wpf/wpb, for C#/VB.NET respectively. The new subsystem is added to enumerations.xml:

...

I find another dialect-specific WPF pattern in VBASIC.XML.   This pattern specifies the operation needed to start a WPF application.  A VB.NET version is added:

...

A critical part of supporting the WPF upgrade relates to authoring XAML from the VB6 forms and declaring the WPF Application class.  This work is done in the wpfSubSystem.gmsl script.  This gmSL script contains various upgrade event handlers and supportig supporting routines that are called by gmBasic at the appropriate times during the authoring process.   Support for VB.NET was added by making the code in wpfSubSystem.gmsl dialect-specific: adding logic to author either C# or VB.NET code depending on the dialect setting.

...

Code Block
titleVB7Lang.xml
<gmSL NameSpace="gmSL" class="WPFSubSystem" Source="%UserFolder%\WPFSubsystem.gmsl" /> 
<gmSL NameSpace="gmSL" class="WPBSubSystem" Source="%UserFolder%\WPFSubsystem.gmsl" /> <-------------- added 

...

Once all of these metalang file changes are made, I need to recompile the Metalanguage code so it using the modified files. This creates a binary metalanguage file that can be used during the translation process.

...

With these changes, the WPF feature may be activated by adding one line to a translation script:

 

Code Block
<Select SubSystem="wpf"/> 

 

The above now works for both Dialect=csh and Dialect=vbn.  Note: the WPF upgrade subsystem is a limited implementation: it supports most VB6 intrinsic controls and the COM TabControl (TabDlg).  Additional VB6/COM controls and other features may be added by modifying the appropriate language scripts and COM description files.  Contact us if you have any questions.