|
|
|
Refer to the SDK examples HelloWorld and SimpleList projects for basic working examples (Setup.cs, Setup.vb, Seup.cpp).
public Setup() { // Set the number of pages this setup has in basic mode totalpages = 1; // If user has advanced settings turned on, then the CF_showAdvancedSettings flag will be set to true // Some plugins may require more pages for advanced settings, this must be determined by plugin developer. if (CF_showAdvancedSettings) totalpages = 1; // Current page when settings are opened is always 1 currentpage = 1; // Builds the controls. buildControls(); // Loads the plugin configuration from the specified path. this.CF_loadConfig(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile); // Loads the plugin language file from the specified path. This is loaded using the language // specified in the configuration file. this.CF_loadLang(PluginPathLanguages + this.pluginConfig.readPluginField("/APPCONFIG/APPLANG") + ".xml"); // Loads the configuration file into the local XmlDocument. configxml.Load(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile); languagexml.Load(PluginPathLanguages + this.pluginConfig.readPluginField("/APPCONFIG/APPLANG") + ".xml"); }
public void setupSection() { // Build controls this.buildSetup(); // Populate the setup page this.loadSetupPage(); // Populate button texts this.CF_updateButtonText("OK", LanguageReader.getText("APPLANG/BUTTONS/SAVE")); this.CF_updateButtonText("CANCEL", LanguageReader.getText("APPLANG/BUTTONS/CANCEL")); this.CF_updateText("TITLE", this.pluginLang.readPluginField("/APPLANG/SETUP/TITLE")); }
public override void readConfig() { try { int i = SetupButton.One; if (CF_showAdvancedSettings) { /*******************************************************************************************/ /***** ADVANCED SETTINGS - PAGE 1 ********************************************************/ /*******************************************************************************************/ if (currentpage == 1) { // TEXT BUTTONS (1-4) ButtonHandler[i] = new SettingsClickHandler(SetDisplayName); ButtonText[i] = this.pluginLang.readPluginField("APPLANG/SETUP/DISPLAYNAME"); ButtonValue[i++] = this.pluginLang.readPluginField("APPLANG/HELLOWORLD/DISPLAYNAME"); ButtonHandler[i] = null; ButtonText[i] = ""; ButtonValue[i++] = ""; ButtonHandler[i] = null; ButtonText[i] = ""; ButtonValue[i++] = ""; ButtonHandler[i] = null; ButtonText[i] = ""; ButtonValue[i++] = ""; // BOOL BUTTONS (5-8) ButtonHandler[i] = new SettingsClickHandler(SetLogEvents); ButtonText[i] = this.pluginLang.readPluginField("/APPLANG/SETUP/LOGEVENTS"); ButtonValue[i++] = readConfig("/APPCONFIG/LOGEVENTS"); ButtonHandler[i] = null; ButtonText[i] = ""; ButtonValue[i++] = ""; ButtonHandler[i] = null; ButtonText[i] = ""; ButtonValue[i++] = ""; ButtonHandler[i] = null; ButtonText[i] = ""; ButtonValue[i++] = ""; } } else { /*******************************************************************************************/ /***** BASIC SETTINGS - PAGE 1 ***********************************************************/ /*******************************************************************************************/ if (currentpage == 1) { // TEXT BUTTONS (1-4) ButtonHandler[i] = new SettingsClickHandler(SetDisplayName); ButtonText[i] = this.pluginLang.readPluginField("APPLANG/SETUP/DISPLAYNAME"); ButtonValue[i++] = this.pluginLang.readPluginField("APPLANG/HELLOWORLD/DISPLAYNAME"); ButtonHandler[i] = null; ButtonText[i] = ""; ButtonValue[i++] = ""; ButtonHandler[i] = null; ButtonText[i] = ""; ButtonValue[i++] = ""; ButtonHandler[i] = null; ButtonText[i] = ""; ButtonValue[i++] = ""; // BOOL BUTTONS (5-8) ButtonHandler[i] = null; ButtonText[i] = ""; ButtonValue[i++] = ""; ButtonHandler[i] = null; ButtonText[i] = ""; ButtonValue[i++] = ""; ButtonHandler[i] = null; ButtonText[i] = ""; ButtonValue[i++] = ""; ButtonHandler[i] = null; ButtonText[i] = ""; ButtonValue[i++] = ""; } } } catch (Exception errmsg) { CFTools.writeError(errmsg.Message, errmsg.StackTrace); } }
private void SetDisplayName(ref object value) { try { object tempobject; string resultvalue, resulttext; if (this.CF_systemDisplayDialog(CF_Dialogs.OSK, this.pluginLang.readPluginField("/APPLANG/SETUP/DISPLAYNAME"), ButtonValue[(int)value], null, out resultvalue, out resulttext, out tempobject, null, true, true, true, true, false, false, 1) == DialogResult.OK) { languagexml.SelectSingleNode("/APPLANG/HELLOWORLD/DISPLAYNAME").InnerText = HttpUtility.HtmlEncode(resultvalue); ButtonValue[(int)value] = resultvalue; } } catch (Exception errmsg) { CFTools.writeError(errmsg.Message, errmsg.StackTrace); } }
private void SetLogEvents(ref object value) { updateConfig("/APPCONFIG/LOGEVENTS", value.ToString()); }
private void section1_CFSetup_ok(object sender, EventArgs e) { // Launches system YesNo dialog to verify the user wants to overwrite their current settings. If yes then the // local XML document is saved. object tempobject; string temp, temp2; try { if (this.CF_systemDisplayDialog(CF_Dialogs.YesNo, LanguageReader.getText("APPLANG/SETUP/OVERWRITETEXT"), null, null, out temp, out temp2, out tempobject, null, true, true, true, true, false, false, 1) == DialogResult.OK) { configxml.Save(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile); languagexml.Save(PluginPathLanguages + configxml.SelectSingleNode("/APPCONFIG/APPLANG").InnerText + ".xml"); this.DialogResult = DialogResult.OK; } } catch (Exception errmsg) { CFTools.writeError(errmsg.Message, errmsg.StackTrace); } }
private void section1_CFSetup_cancel(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; }
| Copyright © 2008 Flux Media, Inc. (U.S. Copyright Registration Number: TXu-1-239-794) |
|