This example is a C# application using the PTC Mathcad Prime API to exercise some fundamental methods and properties, and to demonstrate how to enable events. This example mimics the functionality of the C++.NET example.
There are two main pieces of code:
• MainWindow.xaml.cs builds the user interface.
• ComEvents2.cs implements the methods of the MathcadPrimeComEvents2 class that tells PTC Mathcad Prime what to do on event.
MainWindow.xaml.cs starts Mathcad. This callback creates a MathcadPrimeApplication3 and a MathcadPrimeComEvents2 object. These PTC Mathcad Prime objects are part of the API, and are the only two objects that you create with new. Note that in C#, we create ApplicationCreator(). After you create the MathcadPrimeComEvents2 object, you can implement the methods in terms of what you want to happen upon events, including OnExit and OnWorksheetClosed. There are a total of eight events.