Ejemplo n.º 1
0
        /// <summary>
        /// Executes the JavaScript function specified by <paramref name="callbackName"/>
        /// </summary>
        /// <param name="sender">The NodeViewModel that raised the event</param>
        /// <param name="callbackName">The name of the JavaScript function to execute</param>
        private static void ExecuteNodeJSCallback(object sender, string callbackName)
        {
            //TODO:  VALIDATE CALLBACK
            try
            {
                NodeViewModelBase     nodeVM                = (NodeViewModelBase)sender;
                NodeMapData           nodeMapData           = MappingExtensions.GetNode(nodeVM);
                ScriptableNodeMapData scriptableNodeMapData = ScriptableMapper.GetNode(nodeMapData);

                HtmlPage.Window.Invoke(callbackName, scriptableNodeMapData);
            }
            catch (InvalidOperationException)
            {
                MessageBox.Show("Unable to find the '" + callbackName + "' method in the host application", "Unknown callback", MessageBoxButton.OK);
                // Swallow error for now
                //TODO:  LOG THIS CASE
            }
        }