Example #1
0
        public void AddNode(ScriptableNodeMapData scriptableNode)
        {
            NodeMapData objNode = ScriptableMapper.GetNode(scriptableNode);

            GraphComponents graphComponents = GraphManager.Instance.DefaultGraphComponentsInstance;

            MappingExtensions.AddNode(graphComponents, CreationType.Live, objNode);
        }
Example #2
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
            }
        }