public void create(IReadOnlyList<string> tabElements, IReadOnlyDictionary<string, string> tabBarProperties, IMethodResult oResult) { MainPage mp = getMainPage(); if (mp != null) { mp.tabbarHide(); mp.toolbarRemoveAllButtons(); string tab_background_color = null; if (tabBarProperties.ContainsKey("backgroundColor")) tab_background_color = tabBarProperties["backgroundColor"]; for (int i = 0; i < tabElements.Count; ++i) { string tb = tabElements[i]; CJSONEntryProxy oEntry = new CJSONEntryProxy(tb); string label = null; string action = null; string icon = null; string reload = null; string selected_color = null; string disabled = null; string background_color = null; string use_current_view_for_tab = null; if (oEntry.hasName("label")) label = oEntry.getString("label"); if (oEntry.hasName("action")) action = oEntry.getString("action"); if (oEntry.hasName("icon")) icon = oEntry.getString("icon"); if (oEntry.hasName("reload")) reload = oEntry.getString("reload"); if (oEntry.hasName("selectedColor")) selected_color = oEntry.getString("selectedColor"); if (oEntry.hasName("disabled")) disabled = oEntry.getString("disabled"); if (oEntry.hasName("backgroundColor")) background_color = oEntry.getString("backgroundColor"); if (oEntry.hasName("useCurrentViewForTab")) use_current_view_for_tab = oEntry.getString("useCurrentViewForTab"); if ((icon != null) && (icon.Length > 0)) icon = CRhoRuntime.getInstance().getAppRootPath(icon); CRhoRuntime.getInstance().logEvent("AddTab: " + (label==null?"(null)":label) + "; " + (icon==null?"(null)":icon) + "; " + (action==null?"(null)":action) + "; " + charToBool(disabled) + "; " + (background_color==null?"(null)":background_color) + "; " + (selected_color==null?"(null)":selected_color) + "; " + (tab_background_color==null?"(null)":tab_background_color) + "; " + charToBool(reload) + "; " + charToBool(use_current_view_for_tab)); mp.tabbarAddTab(label, icon, action, charToBool(disabled), background_color, selected_color, tab_background_color, charToBool(reload), charToBool(use_current_view_for_tab), oResult.hasCallback(), oResult); } mp.tabbarSwitch(0); mp.tabbarShow(); } }
public void create(IReadOnlyList<string> toolbarElements, IReadOnlyDictionary<string, string> toolBarProperties, IMethodResult oResult) { MainPage mp = getMainPage(); if (mp != null) { mp.toolbarRemoveAllButtons(); string bgCr = ""; string mask = ""; if (toolBarProperties.ContainsKey("backgroundColor")) bgCr = toolBarProperties["backgroundColor"]; if (toolBarProperties.ContainsKey("maskColor")) mask = toolBarProperties["maskColor"]; mp.setToolbarStyle(false, bgCr, mask); for (int i = 0; i < toolbarElements.Count; ++i) { string tb = toolbarElements[i]; CJSONEntryProxy oEntry = new CJSONEntryProxy(tb); string label = null; string action = null; string icon = null; if (oEntry.hasName("label")) label = oEntry.getString("label"); if (oEntry.hasName("action")) action = oEntry.getString("action"); if (oEntry.hasName("icon")) icon = oEntry.getString("icon"); CRhoRuntime.getInstance().logEvent("addToolbarButton: Label: '" + (label==null?"":label) + "';Action: '" + (action==null?"":action) + "'"); if ((action != null) && !action.Equals("separator", StringComparison.InvariantCultureIgnoreCase)) { if ((icon != null) && (icon.Length > 0)) { icon = "apps"+icon; icon = CRhoRuntime.getInstance().getRootPath(icon); } else { if (action.Equals("options", StringComparison.InvariantCultureIgnoreCase)) icon = "res/options_btn.png"; else if (action.Equals("home", StringComparison.InvariantCultureIgnoreCase)) icon = "res/home_btn.png"; else if (action.Equals("refresh", StringComparison.InvariantCultureIgnoreCase)) icon = "res/refresh_btn.png"; else if (action.Equals("back", StringComparison.InvariantCultureIgnoreCase)) icon = "res/back_btn.png"; else if (action.Equals("forward", StringComparison.InvariantCultureIgnoreCase)) icon = "res/forward_btn.png"; if (icon != null) icon = CRhoRuntime.getInstance().getRERuntimePath("lib/" + icon); } mp.toolbarAddAction(icon, label, action); } } mp.toolbarShow(); } }
public void create(IReadOnlyList <string> toolbarElements, IReadOnlyDictionary <string, string> toolBarProperties, IMethodResult oResult) { MainPage mp = getMainPage(); if (mp != null) { mp.toolbarRemoveAllButtons(); string bgCr = ""; string mask = ""; if (toolBarProperties.ContainsKey("backgroundColor")) { bgCr = toolBarProperties["backgroundColor"]; } if (toolBarProperties.ContainsKey("maskColor")) { mask = toolBarProperties["maskColor"]; } mp.setToolbarStyle(false, bgCr, mask); for (int i = 0; i < toolbarElements.Count; ++i) { string tb = toolbarElements[i]; CJSONEntryProxy oEntry = new CJSONEntryProxy(tb); string label = null; string action = null; string icon = null; if (oEntry.hasName("label")) { label = oEntry.getString("label"); } if (oEntry.hasName("action")) { action = oEntry.getString("action"); } if (oEntry.hasName("icon")) { icon = oEntry.getString("icon"); } CRhoRuntime.getInstance().logEvent("addToolbarButton: Label: '" + (label == null?"":label) + "';Action: '" + (action == null?"":action) + "'"); if ((action != null) && !action.Equals("separator", StringComparison.InvariantCultureIgnoreCase)) { if ((icon != null) && (icon.Length > 0)) { icon = "apps" + icon; icon = CRhoRuntime.getInstance().getRootPath(icon); } else { if (action.Equals("options", StringComparison.InvariantCultureIgnoreCase)) { icon = "res/options_btn.png"; } else if (action.Equals("home", StringComparison.InvariantCultureIgnoreCase)) { icon = "res/home_btn.png"; } else if (action.Equals("refresh", StringComparison.InvariantCultureIgnoreCase)) { icon = "res/refresh_btn.png"; } else if (action.Equals("back", StringComparison.InvariantCultureIgnoreCase)) { icon = "res/back_btn.png"; } else if (action.Equals("forward", StringComparison.InvariantCultureIgnoreCase)) { icon = "res/forward_btn.png"; } if (icon != null) { icon = CRhoRuntime.getInstance().getRERuntimePath("lib/" + icon); } } mp.toolbarAddAction(icon, label, action); } } mp.toolbarShow(); } }
public override void create(IReadOnlyList <string> tabElements, IReadOnlyDictionary <string, string> tabBarProperties, IMethodResult oResult) { MainPage mp = getMainPage(); if (mp != null) { mp.tabbarHide(); mp.toolbarRemoveAllButtons(); string tab_background_color = null; if (tabBarProperties.ContainsKey("backgroundColor")) { tab_background_color = tabBarProperties["backgroundColor"]; } for (int i = 0; i < tabElements.Count; ++i) { string tb = tabElements[i]; CJSONEntryProxy oEntry = new CJSONEntryProxy(tb); string label = null; string action = null; string icon = null; string reload = null; string selected_color = null; string disabled = null; string background_color = null; string use_current_view_for_tab = null; if (oEntry.hasName("label")) { label = oEntry.getString("label"); } if (oEntry.hasName("action")) { action = oEntry.getString("action"); } if (oEntry.hasName("icon")) { icon = oEntry.getString("icon"); } if (oEntry.hasName("reload")) { reload = oEntry.getString("reload"); } if (oEntry.hasName("selectedColor")) { selected_color = oEntry.getString("selectedColor"); } if (oEntry.hasName("disabled")) { disabled = oEntry.getString("disabled"); } if (oEntry.hasName("backgroundColor")) { background_color = oEntry.getString("backgroundColor"); } if (oEntry.hasName("useCurrentViewForTab")) { use_current_view_for_tab = oEntry.getString("useCurrentViewForTab"); } if ((icon != null) && (icon.Length > 0)) { icon = CRhoRuntime.getInstance().getAppRootPath(icon); } CRhoRuntime.getInstance().logEvent("AddTab: " + (label == null?"(null)":label) + "; " + (icon == null?"(null)":icon) + "; " + (action == null?"(null)":action) + "; " + charToBool(disabled) + "; " + (background_color == null?"(null)":background_color) + "; " + (selected_color == null?"(null)":selected_color) + "; " + (tab_background_color == null?"(null)":tab_background_color) + "; " + charToBool(reload) + "; " + charToBool(use_current_view_for_tab)); mp.tabbarAddTab(label, icon, action, charToBool(disabled), background_color, selected_color, tab_background_color, charToBool(reload), charToBool(use_current_view_for_tab), oResult.hasCallback(), oResult); } mp.tabbarSwitch(0); mp.tabbarShow(); } }