2005-12-04, 10:20 PM
After adding an extra config setting my plugin now does not show in the config app. It builds fine but the config.exe log reports a good old null object ref at the plugin's constructor
Please Help :confused:
Code:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Xml;
using CommonGBPVRUtilities;
using GBPVR.Public;
namespace UKCinemaListingsPlugin
{
/// <summary>
/// Summary description for UKCinemaListingsPluginConfigForm.
/// </summary>
public class UKCinemaListingsPlugInConfigForm : System.Windows.Forms.Form
{
// The settings we are passed from the config app
private XmlDocument settings;
private System.Windows.Forms.Label labelCinemaNumber;
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBoxCinemaNumber;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBoxDefaultCinemaNumber;
private System.Windows.Forms.Label labelDefaultCinemaNumber;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public UKCinemaListingsPlugInConfigForm(XmlDocument document)
{
// hold a reference to the config.xml document for later
settings = document;
//
// Required for Windows Form Designer support
//
//InitializeComponent();
LoadInitialSettings();
}
private void LoadInitialSettings()
{
// Initialize any settings needed on the form
// Modify this to match the properties you use
textBoxCinemaNumber.Text = ConfigFileUtilities.GetStringConfigSetting(settings, UKCinemaListings.MyPlugInConfigSectionName, "CinemaNumbers", "1004181",false);
textBoxDefaultCinemaNumber.Text = ConfigFileUtilities.GetStringConfigSetting(settings, UKCinemaListings.MyPlugInConfigSectionName, "DefaultCinema", "1004181",false);
}
private void buttonOK_Click(object sender, System.EventArgs e)
{
// Create the root node if needed
ConfigFileUtilities.CreateRootNodeIfNeeded(settings, UKCinemaListings.MyPlugInConfigSectionName);
// Create or update each property
// Modify this to save your properties
ConfigFileUtilities.CreateOrUpdateProperty(settings, UKCinemaListings.MyPlugInConfigSectionName, "CinemaNumbers", textBoxCinemaNumber.Text);
ConfigFileUtilities.CreateOrUpdateProperty(settings, UKCinemaListings.MyPlugInConfigSectionName, "DefaultCinema", textBoxDefaultCinemaNumber.Text);
// .... file will be saved later by the config app, if the user presses the OK button
this.Close();
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.labelCinemaNumber = new System.Windows.Forms.Label();
this.buttonOK = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.textBoxCinemaNumber = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.textBoxDefaultCinemaNumber = new System.Windows.Forms.TextBox();
this.labelDefaultCinemaNumber = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// labelCinemaNumber
//
this.labelCinemaNumber.AutoSize = true;
this.labelCinemaNumber.Location = new System.Drawing.Point(16, 24);
this.labelCinemaNumber.Name = "labelCinemaNumber";
this.labelCinemaNumber.TabIndex = 4;
this.labelCinemaNumber.Text = "Cinema Number(s)";
//
// buttonOK
//
this.buttonOK.Location = new System.Drawing.Point(352, 200);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(96, 32);
this.buttonOK.TabIndex = 9;
this.buttonOK.Text = "OK";
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// label4
//
this.label4.Location = new System.Drawing.Point(16, 104);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(360, 16);
this.label4.TabIndex = 10;
this.label4.Text = "1) Go to http://www.britinfo.net/cinema/index.htm and find your cinema.";
//
// label2
//
this.label2.Location = new System.Drawing.Point(16, 128);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(448, 16);
this.label2.TabIndex = 11;
this.label2.Text = "2) Look in the address bar and you will see a 7 digit number, this is the cinema " +
"number.";
//
// textBoxCinemaNumber
//
this.textBoxCinemaNumber.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.textBoxCinemaNumber.Location = new System.Drawing.Point(120, 24);
this.textBoxCinemaNumber.Name = "textBoxCinemaNumber";
this.textBoxCinemaNumber.Size = new System.Drawing.Size(336, 22);
this.textBoxCinemaNumber.TabIndex = 12;
this.textBoxCinemaNumber.Text = "";
//
// label3
//
this.label3.Location = new System.Drawing.Point(28, 144);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(360, 16);
this.label3.TabIndex = 14;
this.label3.Text = "To enter multiple cinemas simply add a comma between each number.";
//
// label1
//
this.label1.Location = new System.Drawing.Point(16, 168);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(440, 16);
this.label1.TabIndex = 17;
this.label1.Text = "3) Choose your favourite cinema and enter its number in \'Default Cinema\'. ";
//
// textBoxDefaultCinemaNumber
//
this.textBoxDefaultCinemaNumber.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.textBoxDefaultCinemaNumber.Location = new System.Drawing.Point(120, 56);
this.textBoxDefaultCinemaNumber.Name = "textBoxDefaultCinemaNumber";
this.textBoxDefaultCinemaNumber.Size = new System.Drawing.Size(112, 22);
this.textBoxDefaultCinemaNumber.TabIndex = 16;
this.textBoxDefaultCinemaNumber.Text = "";
//
// labelDefaultCinemaNumber
//
this.labelDefaultCinemaNumber.Location = new System.Drawing.Point(16, 56);
this.labelDefaultCinemaNumber.Name = "labelDefaultCinemaNumber";
this.labelDefaultCinemaNumber.Size = new System.Drawing.Size(82, 16);
this.labelDefaultCinemaNumber.TabIndex = 15;
this.labelDefaultCinemaNumber.Text = "Default Cinema";
//
// UKCinemaListingsPlugInConfigForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(472, 246);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBoxDefaultCinemaNumber);
this.Controls.Add(this.textBoxCinemaNumber);
this.Controls.Add(this.labelCinemaNumber);
this.Controls.Add(this.labelDefaultCinemaNumber);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label4);
this.Controls.Add(this.buttonOK);
this.Name = "UKCinemaListingsPlugInConfigForm";
this.Text = "UK Cinema Listings Config";
this.ResumeLayout(false);
}
#endregion
}
}
Please Help :confused:
My Projects
Programs Plugin [SIZE=2](retired) | Volume OSD Plugin (retired) | Documentation Wiki (retired)[/SIZE]
Programs Plugin [SIZE=2](retired) | Volume OSD Plugin (retired) | Documentation Wiki (retired)[/SIZE]