Search | Synergex.com | Contact Us | Resource Center Login | Home|
News & Events

Implementing Interoperability Between Embedded .NET WinForms and your Existing Synergy/DE UI Toolkit Logic

By Richard Morris, Senior Consultant, Synergy/DE Professional Services Group

When the Synergy .NET assembly API and the UI Toolkit .NET routines were released in Synergy/DE 9.1.5 (July 2008), developers were given the ability to harness the powerful controls and classes within the .NET Framework. With these features, you can enhance the presentation layer of your application by replacing your UI Toolkit input windows with Windows Forms, which offer a greater array of input controls than standard input windows.

This article describes the first steps towards replacing your UI Toolkit input windows with Windows Forms. We’ll use this past year’s SPC demo application, ChronoTrack, to illustrate how to start migrating an existing UI Toolkit application to .NET. ChronoTrack is a UI Toolkit application whose user interface has been enhanced using .NET forms. It was created by the Synergex Professional Services Group (PSG) to demonstrate the capabilities of the latest released versions of Synergy/DE, and it uses many of the modern tools and technologies now available to the Synergy developer.

The .NET assembly API and the Toolkit .NET routines enable a Synergy application to interact directly with the .NET Framework. Within ChronoTrack, these are used to host .NET forms, which replace traditional Toolkit input windows. However, the code that processes these forms still relies on UI Toolkit menu signals to control processing and navigation, so we need to be able to communicate these UI Toolkit menu names in a way that our Synergy application code can understand.

The first step is to create a class that describes the delegate and event required to signal from our C# forms back to our Synergy application. To do this, we’ve created the SynInterop class in ChronoTrack:

namespace SynPSGNetCore.Interop
{
    public class SynInterop
    {
        ///
        /// These events allow the .NET applications to
        /// communicate back to the Synergy hosting program.
        ///
        #region Events and delegates

        /// <summary>
        /// Allow the form to signal a menu entry
        /// </summary>
        /// <param name="message"></param>
        public delegate void MenuSignalEventHandler(string menuName);
        public event MenuSignalEventHandler MenuSignal

        #endregion

        ///
        /// These methods are designed to be executed by the .NET
        /// client and allow interop with the Synergy application
        ///
        #region.NET methods

        /// <summary>
        /// Send a menu signal back to Synergy
        /// </summary>
        /// <param name="menuText">the menu string to send back
        /// </param>
        public void SendMenuSignal(string menuText)
        {
            MenuSignal(menuText);
        }
        #endregion
    }
}


> continue


          

Contact Synergex to learn more about  News and Events