RevelDigital Player API

The RevelDigital Player API provides runtime access to the RevelDigital player software. The player software is built on the .NET 3.5 and WPF (Windows Presentation Foundation) architectures and utilizes a Python scripting engine for interpretation of user supplied code. Scripts are able to leverage the complete .NET 3.5 and WPF frameworks.

At the heart of the API is the Controller which is responsible for template/playlist scheduling. The Controller has a reference to the currently active Schedule and Template. Each Template has a list of its Modules which together compose the template content. Each template Module has a reference to the actual WPF control responsible for rendering its content. The WPF control is accessed through the IRevelControl interface and has a number of RevelDigital specific methods and properties. The IRevelControl interface can also be treated as a reference to a WPF ContentControl for performing any WPF specific operations. Similarily the ITemplate interface can be treated as a reference to the WPF Window control.

As a rule, the classes in this library are representative of definitions for the schedules, templates, modules, etc. That is they should be considered read-only and are purely data bound. Interfaces on the other hand represent the underlying WPF windows and controls. These objects are normally the focus of any scripting since they provide access to the live template objects and directly affect the template visuals.

The following example will fade in an image when a hot spot is clicked. The image is named 'Image 1' and the hot spot is named 'Hot Spot 1'. These names are assigned at template design time and are always accessible from script directly by name. Spaces and other special characters in the name are always replaced with an underscore.

from System import *
from System.Windows import *
from System.Windows.Controls import *
from System.Windows.Threading import *
from System.Windows.Media import *
from System.Windows.Media.Animation import *
from RevelScript import *

class Kiosk:
   sb_fade_in = Storyboard()
   da_fade_in = DoubleAnimation(0, 1, Duration(TimeSpan.FromSeconds(1.0)))
   
   def __init__(self):
     Storyboard.SetTargetProperty(self.da_fade_in, PropertyPath("Opacity"))
     self.sb_fade_in.Children.Add(self.da_fade_in)
     
     Controller.TemplateInitialized += self.Template_Initialized
   
     Hot_Spot_1.MouseDown += self.Hot_Spot_Click
    
   def Template_Initialized(self, sender, event):
     Image_1.Opacity = 0

   def Hot_Spot_Click(self, sender, event):
      self.sb_fade_in.Begin(Image_1)

s = Kiosk()

You can see this is fairly straightforward WPF code with animations handled by the stock Storyboard and DoubleAnimation classes. Note that the example utilizes Python OOP design with classes, which is not strictly necessary, but makes for cleaner code in more complicated scenarios. The script takes advantage of the Controller TemplateInitialized event to configure the initial state of the image and handles the MouseDown event of the hot spot to initiate the fade in. The MouseDown event is a WPF event and is available since all modules inherit from WPF ContentControl.


© Catalyst LLC, 1996-2016 • Updated: 05/27/14
Comment or report problem with topic


This page was generated by the shareware version of West Wind Html Help Builder.