Common CustomDataSourceCommon_CustomDataSource_CSharp\CustomDataSource_CSharp\REXMLDataSource_CSharp\Design\DataSourceDefinitionEditorFormREXML.cs
// Copyright 2007 ESRI
//
// All rights reserved under the copyright laws of the United States
// and applicable international laws, treaties, and conventions.
//
// You may freely redistribute and use this sample code, with or
// without modification, provided you include the original copyright
// notice and use restrictions.
//
// See the use restrictions.
//
/*
COPYRIGHT � 2006 ESRI
TRADE SECRETS: ESRI PROPRIETARY AND CONFIDENTIAL
Unpublished material - all rights reserved under the
Copyright Laws of the United States and applicable international
laws, treaties, and conventions.
For additional information, contact:
Environmental Systems Research Institute, Inc.
Attn: Contracts and Legal Services Department
380 New York Street
Redlands, California, 92373
USA
email: contracts@esri.com
*/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using ESRI.ArcGIS.ADF.Web.UI.WebControls;
namespace REXMLDataSource_CSharp.Design
{
/// <summary>
/// Summary description for DataSourceDefinitionEditorFormLocal.
/// </summary>
public class DataSourceDefinitionEditorFormREXML : System.Windows.Forms.Form, ESRI.ArcGIS.ADF.Web.DataSources.IDesignEditorForm
{
private System.Windows.Forms.TextBox txtPath;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnOK;
public string Path;
private string m_oldPath;
private object m_contextInstance;
private Label label2;
private Label label3;
private PictureBox pictureBox1;
private Button btnHelp;
private GroupBox groupBox1;
private Button btnDataSource;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public DataSourceDefinitionEditorFormREXML()
{
InitializeComponent();
}
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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DataSourceDefinitionEditorFormREXML));
this.txtPath = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.btnCancel = new System.Windows.Forms.Button();
this.btnOK = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.btnHelp = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnDataSource = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// txtPath
//
this.txtPath.Location = new System.Drawing.Point(120, 94);
this.txtPath.Name = "txtPath";
this.txtPath.Size = new System.Drawing.Size(244, 20);
this.txtPath.TabIndex = 5;
this.txtPath.TextChanged += new System.EventHandler(this.txtPath_TextChanged);
//
// label1
//
this.label1.Location = new System.Drawing.Point(16, 97);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(104, 22);
this.label1.TabIndex = 4;
this.label1.Text = "Path to REXML file:";
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(331, 180);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 10;
this.btnCancel.Text = "&Cancel";
//
// btnOK
//
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.Location = new System.Drawing.Point(250, 180);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 9;
this.btnOK.Text = "&OK";
//
// label2
//
this.label2.BackColor = System.Drawing.Color.White;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(10, 31);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(336, 18);
this.label2.TabIndex = 17;
this.label2.Text = "Enter the path to a local file containing REXML.";
//
// label3
//
this.label3.AutoSize = true;
this.label3.BackColor = System.Drawing.Color.White;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(10, 6);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(311, 20);
this.label3.TabIndex = 16;
this.label3.Text = "REXML Data Source Definition Editor";
//
// pictureBox1
//
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Top;
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(418, 63);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox1.TabIndex = 15;
this.pictureBox1.TabStop = false;
//
// btnHelp
//
this.btnHelp.Location = new System.Drawing.Point(15, 180);
this.btnHelp.Name = "btnHelp";
this.btnHelp.Size = new System.Drawing.Size(75, 23);
this.btnHelp.TabIndex = 19;
this.btnHelp.Text = "&Help";
this.btnHelp.UseVisualStyleBackColor = true;
this.btnHelp.Click += new System.EventHandler(this.btnHelp_Click);
//
// groupBox1
//
this.groupBox1.Location = new System.Drawing.Point(15, 168);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(388, 4);
this.groupBox1.TabIndex = 18;
this.groupBox1.TabStop = false;
//
// btnDataSource
//
this.btnDataSource.Location = new System.Drawing.Point(376, 92);
this.btnDataSource.Name = "btnDataSource";
this.btnDataSource.Size = new System.Drawing.Size(30, 22);
this.btnDataSource.TabIndex = 20;
this.btnDataSource.Text = "...";
this.btnDataSource.UseVisualStyleBackColor = true;
this.btnDataSource.Click += new System.EventHandler(this.btnDataSource_Click);
//
// DataSourceDefinitionEditorFormREXML
//
this.AcceptButton = this.btnOK;
this.AutoSize = true;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(418, 214);
this.Controls.Add(this.btnDataSource);
this.Controls.Add(this.btnHelp);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.label2);
this.Controls.Add(this.label3);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.txtPath);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.HelpButton = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "DataSourceDefinitionEditorFormREXML";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "REXML Data Source Definition Editor";
this.Load += new System.EventHandler(this.REXMLDataSourceDefinitionEditorForm_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private void REXMLDataSourceDefinitionEditorForm_Load(object sender, System.EventArgs e)
{
txtPath.Text = Path;
m_oldPath = Path;
}
private void txtPath_CausesValidationChanged(object sender, System.EventArgs e)
{
if (txtPath.Text != m_oldPath)
{
Cursor = Cursors.WaitCursor;
Path = txtPath.Text;
m_oldPath = txtPath.Text;
this.Cursor = Cursors.Default;
}
}
#region IDesignEditorForm Members
public void Initialize(object contextInstance, object value)
{
m_contextInstance = contextInstance;
Path = value as string;
}
public bool PropertyInUse
{
get { return true; }
}
public object Value
{
get
{
return Path;
}
}
public object DefaultValue
{
get { return null; }
}
#endregion
private void txtPath_TextChanged(object sender, EventArgs e)
{
Path = txtPath.Text;
}
private void btnDataSource_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Title = "Select REXML data file";
if (Path != null || Path != string.Empty)
{
ofd.FileName = Path;
}
else
{
ofd.InitialDirectory = Application.ExecutablePath;
}
ofd.Filter = "xml files (*.xml)|*.xml|txt files (*.txt)|*.txt|All files (*.*)|*.*";
if (ofd.ShowDialog() == DialogResult.OK)
{
txtPath.Text = (string)ofd.FileName;
}
}
private void btnHelp_Click(object sender, EventArgs e)
{
ESRI.ArcGIS.ADF.Web.VSUtility.DisplayMSHelp2(null, "ms-help://");
}
}
}