/// <summary> /// Refresh the Helm renderer to redraw the content /// </summary> /// <param name="helm"></param> /// <param name="size"></param> public void ResizeRendering() { string script = ""; if (RendererMode != HelmControlMode.BrowserEditor) // all modes except editor { script += "jsd.setSize(" + Browser.Width + "," + Browser.Height + ");"; script += "jsd.refresh();"; // redraws the structure JavaScriptManager.ExecuteScript(this, script); return; } else // editor mode { script += "app.resizeWindow();"; //script += "app.refresh();"; // this seems to be slower than the resizeWindow call above JavaScriptManager.ExecuteScript(this, script); return; } }
/// <summary> /// Store the helm in the Scilligence component and render it /// </summary> /// <param name="helm"></param> /// <param name="size"></param> public void SetHelmAndRender( string helm, Size size = new Size()) { string script = ""; Helm = helm; if (RendererMode != HelmControlMode.BrowserEditor) // all modes except editor { //if (!String.IsNullOrWhiteSpace(helm)) // don't do this check, need to set if blank to clear out existing structure { script += "jsd.setHelm(\"" + helm + "\");"; // var jsd = new JSDraw(...) is JSDraw canvas object JavaScript variable //JavaScriptManager.ExecuteScript(this, script); script = ""; // debug - one command at a time } if (!size.IsEmpty) { script += "jsd.setSize(" + size.Width + "," + size.Height + ");"; //JavaScriptManager.ExecuteScript(this, script); script = ""; // debug - one command at a time } script += "jsd.refresh();"; // redraws the structure JavaScriptManager.ExecuteScript(this, script); return; } else // editor mode { script += // set the helm allowing for blank helm to clear the structure "app.canvas.setHelm(\"" + helm + "\");"; // var app = new scil.helm.App(), app.canvas is JSDraw canvas object //if (!size.IsEmpty) // script += "app.canvas.setSize(" + scaledCanvasWidth + "," + scaledCanvasHeight + ");"; script += "app.canvas.refresh();"; // redraws the structure JavaScriptManager.ExecuteScript(this, script); return; } }
/// <summary> /// ExecuteJavaScript /// </summary> /// <param name="script"></param> void ExecuteJavaScript(string script) { LoadInitialPage(); // be sure initial page is loaded JavaScriptManager.ExecuteScript(this, script); return; }