Click or drag to resize

Calling FlexPendant code using ScreenMaker

ScreenMaker allows you to import the class library DLL and add references to the Advanced tab of the Project Properties dialog box. Using ScreenMaker, you can call static methods of the public classes defined in another DLL. This DLL is usually a class library or a control library. User must be aware of the following limitations while using .NET DLLs.

  • References of DLL must reside in the same directory to load the DLL.

  • ScreenMaker only provides access to the static methods that contain basic data types such as String, Integer, Double, Boolean or Object.

Use the following steps for creating a .NET assembly. Add this assembly as a reference to the ScreenMaker project to call methods of FlexPendant SDK or to perform certain computations that are not possible when ScreenMaker is used directly.

Note Note

Use Visual Studio 2008 or above to create a .NET assembly.

Creating a .NET assembly
  1. Create a new project in Visual Studio using Class Library as template.

  2. Use the following code sample and create public static methods.

      public class FlexPendantHelp
    {
        private static Controller GetController()
        {
            Controller controller = new Controller();
            return controller;
        }
        public static string ReadRapidData(string rapidDataName, string moduleName, string taskName)
        {
            string rapidDataValue = string.Empty;
            Controller controller = GetController();
    
            RapidData rapidData = controller.Rapid.GetRapidData(taskName, moduleName, rapidDataName);
            if(rapidData != null)
                rapidDataValue = rapidData.Value.ToString();
            return rapidDataValue;
        }
        public static void WriteRapidData(string rapidDataName,string moduleName,string taskName)
        {
            Controller controller = GetController();
            RapidData rapidData = controller.Rapid.GetRapidData(taskName, moduleName, rapidDataName);
            if (rapidData != null)
                rapidData.Value.FillFromString("Data Written");
           }
    }
  3. Right-click the project and select Build.

  4. Use the assembly generated from the Class Library project to use in ScreenMaker.

  5. Add the assembly as a reference to the ScreenMaker project.

  6. After defining the references, .NET methods appear in the Project Properties dialog box. These .NET methods can be included in the Actions list that is executed while performing the required action.

  7. Double-click the method and bind the return value to the application variable. Perform binding only to the application variable.

  8. Click Build in the Ribbon to build the ScreenMaker Project.

  9. Connect to the controller and then deploy the ScreenMaker application to the controller.