using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace Sample01_SWF_And_FLV_Player
{
	/// <summary>
	/// Summary description for FormURL.
	/// </summary>
	public class FormURL : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button buttonOpen;
		private System.Windows.Forms.Button buttonCancel;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TextBox textBoxURL;
		private String m_URL;
		private bool m_IsFLV;
		internal System.Windows.Forms.GroupBox GroupBox1;
		internal System.Windows.Forms.RadioButton FLVRadioButton;
		internal System.Windows.Forms.RadioButton SWFRadioButton;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public String URL
		{
			get
			{
				return m_URL;
			}
		}

		public bool IsFLV
		{
			get
			{
				return m_IsFLV;
			}
		}

		public FormURL()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <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.buttonOpen = new System.Windows.Forms.Button();
			this.buttonCancel = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			this.textBoxURL = new System.Windows.Forms.TextBox();
			this.GroupBox1 = new System.Windows.Forms.GroupBox();
			this.FLVRadioButton = new System.Windows.Forms.RadioButton();
			this.SWFRadioButton = new System.Windows.Forms.RadioButton();
			this.GroupBox1.SuspendLayout();
			this.SuspendLayout();
			// 
			// buttonOpen
			// 
			this.buttonOpen.DialogResult = System.Windows.Forms.DialogResult.OK;
			this.buttonOpen.Location = new System.Drawing.Point(176, 168);
			this.buttonOpen.Name = "buttonOpen";
			this.buttonOpen.TabIndex = 1;
			this.buttonOpen.Text = "Open";
			this.buttonOpen.Click += new System.EventHandler(this.buttonOpen_Click);
			// 
			// buttonCancel
			// 
			this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.buttonCancel.Location = new System.Drawing.Point(256, 168);
			this.buttonCancel.Name = "buttonCancel";
			this.buttonCancel.TabIndex = 2;
			this.buttonCancel.Text = "Cancel";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(8, 16);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(32, 20);
			this.label1.TabIndex = 2;
			this.label1.Text = "URL";
			// 
			// textBoxURL
			// 
			this.textBoxURL.Location = new System.Drawing.Point(48, 16);
			this.textBoxURL.Name = "textBoxURL";
			this.textBoxURL.Size = new System.Drawing.Size(272, 20);
			this.textBoxURL.TabIndex = 0;
			this.textBoxURL.Text = "";
			// 
			// GroupBox1
			// 
			this.GroupBox1.Controls.Add(this.FLVRadioButton);
			this.GroupBox1.Controls.Add(this.SWFRadioButton);
			this.GroupBox1.Location = new System.Drawing.Point(4, 48);
			this.GroupBox1.Name = "GroupBox1";
			this.GroupBox1.Size = new System.Drawing.Size(328, 104);
			this.GroupBox1.TabIndex = 5;
			this.GroupBox1.TabStop = false;
			this.GroupBox1.Text = "File Type";
			// 
			// FLVRadioButton
			// 
			this.FLVRadioButton.Location = new System.Drawing.Point(16, 64);
			this.FLVRadioButton.Name = "FLVRadioButton";
			this.FLVRadioButton.Size = new System.Drawing.Size(152, 24);
			this.FLVRadioButton.TabIndex = 1;
			this.FLVRadioButton.Text = "FLV (Flash video)";
			// 
			// SWFRadioButton
			// 
			this.SWFRadioButton.Location = new System.Drawing.Point(16, 32);
			this.SWFRadioButton.Name = "SWFRadioButton";
			this.SWFRadioButton.TabIndex = 0;
			this.SWFRadioButton.Text = "SWF";
			// 
			// FormURL
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(336, 206);
			this.Controls.Add(this.GroupBox1);
			this.Controls.Add(this.textBoxURL);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.buttonCancel);
			this.Controls.Add(this.buttonOpen);
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "FormURL";
			this.ShowInTaskbar = false;
			this.Text = "Enter URL";
			this.Load += new System.EventHandler(this.FormURL_Load);
			this.GroupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void buttonOpen_Click(object sender, System.EventArgs e)
		{
			m_URL = textBoxURL.Text;
			m_IsFLV = FLVRadioButton.Checked;
		}

		private void FormURL_Load(object sender, System.EventArgs e)
		{
			CenterToParent();

			textBoxURL.Focus();
			SWFRadioButton.Checked = true;
			m_IsFLV = false;
		}
	}
}
