public bool CreateApp(string name, string description, out string appId) { appId = ""; try { if (!conn.IsConnected) { return(false); } using (IHub hub = conn.location.Hub()) { var createAppRes = hub.CreateApp(name); if (!createAppRes.Success) { return(false); } var app = hub.OpenApp(createAppRes.AppId); NxAppProperties properties = app.GetAppProperties(); properties.Set <string>("description", description); app.SetAppProperties(properties); appId = createAppRes.AppId; } return(true); } catch (Exception ex) { return(false); } }
private void hideScriptToolStripMenuItem_Click(object sender, EventArgs e) { var script = ActiveApp.GetScript(); if (script != string.Empty) { NxAppProperties prop = ActiveApp.GetAppProperties().As <NxAppProperties>(); /**We use Set method from AbstractStructure. For more info about abstractstructure class see * https://help.qlik.com/sense/2.0/en-US/apis/net%20sdk/html/T_Qlik_Engine_AbstractStructure.htm * */ prop.Set("HiddenScript", script); ActiveApp.SetAppProperties(prop); ActiveApp.SetScript(string.Empty); Notify("Hide script. App need to be saved!"); } else { Notify("Empty script or script is already hidden!"); } }
public bool RenameApp(string appId, string description) { try { if (!conn.IsConnected) { return(false); } using (IHub hub = conn.location.Hub()) { var app = hub.OpenApp(appId); NxAppProperties properties = app.GetAppProperties(); properties.Set <string>("description", description); app.SetAppProperties(properties); } return(true); } catch (Exception ex) { return(false); } }
private void reloadToolStripMenuItem_Click(object sender, EventArgs e) { try { NxAppProperties prop = ActiveApp.GetAppProperties().As <NxAppProperties>(); ActiveApp.SetScript(prop.Get <string>("HiddenScript")); if (ActiveApp.GetScript().Length > 1) { ActiveApp.DoReload(); ActiveApp.SetScript(string.Empty); Notify("Reloaded hidden script. App need to be saved!"); } else { Notify("Empty script, did not reload!"); } } catch (MethodInvocationException ex) { Notify("There is no hidden script the can be reloaded! " + ex.Message); } }