[ create a new paste ] login | about

Link: http://codepad.org/M16GLZp1    [ raw code | fork ]

C, pasted on Mar 16:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Net;
using System.Xml;

namespace RadikoDotNet
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        string[]  = new string[]{"TBSラジオ","文化放送","ニッポン放送","ラジオNIKKEI",
            "INTERFM","TOKYO FM","J-WAVE","ABC","MBS","ラジオ大阪","FMこころ","FM802","FM大阪"};
        string[] URL = new string[] { "TBS", "QRR", "LFR", "NSB", "INT", "FMT", "FMJ","ABC","MBS","OBC","CCL","802","FMO" }; 
        private void Form1_Load(object sender, EventArgs e)
        {
            WebClient wc = new WebClient();
            Stream st = wc.OpenRead("http://radiko.jp/station/");
            Encoding enc = Encoding.GetEncoding("UTF-8");
            StreamReader sr = new StreamReader(st, enc);
            XmlDocument doc = new XmlDocument();
            doc.Load(sr);
            sr.Close();
            st.Close();


            //XmlNodeList node = doc.GetElementsByTagName("stations");
            //XmlElement elm = doc.FirstChild.InnerText;
            //this.Text = doc.ParentNode.InnerText;
            for (int i = 0; i < 7; i++)
            {
                Button button = new Button();
                button.Name = URL[i];
                button.Text = [i];
                button.Click += new EventHandler(button_Click);
                flowLayoutPanel1.Controls.Add(button);
            }
            for (int i = 7; i < 13; i++)
            {
                Button button = new Button();
                button.Name = URL[i];
                button.Text = [i];
                button.Click += new EventHandler(button_Click);
                flowLayoutPanel2.Controls.Add(button);
            }
            //comboBox1.Items.AddRange(局);
        }

        void button_Click(object sender, EventArgs e)
        {
            if (NavigateFlg == 1) return;
            string url = "http://radiko.jp/player/player.html#" + ((Button)sender).Name;
            //this.Text = 局[comboBox1.SelectedIndex]+ " [" + url + "]"; 
            webBrowser1.Navigate(url);
            NavigateFlg = 1;
        }
        int NavigateFlg = 0;
        /*private void comboBox1_DropDownClosed(object sender, EventArgs e)
        {
            if (NavigateFlg == 1) return;
            string url = "http://radiko.jp/player/player.html#" + URL[comboBox1.SelectedIndex];
            //this.Text = 局[comboBox1.SelectedIndex]+ " [" + url + "]"; 
            webBrowser1.Navigate(url);
            NavigateFlg = 1;
        }*/

        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            NavigateFlg = 0;
        }
    }
}
namespace RadikoDotNet
{
    partial class Form1
    {
        /// <summary>
        /// 必要なデザイナ変数です。
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// 使用中のリソースをすべてクリーンアップします。
        /// </summary>
        /// <param name="disposing">マネージ リソースが破棄される場合 true、破棄されない場合は false です。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows フォーム デザイナで生成されたコード

        /// <summary>
        /// デザイナ サポートに必要なメソッドです。このメソッドの内容を
        /// コード エディタで変更しないでください。
        /// </summary>
        private void InitializeComponent()
        {
            this.webBrowser1 = new System.Windows.Forms.WebBrowser();
            this.tabPage2 = new System.Windows.Forms.TabPage();
            this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
            this.tabPage1 = new System.Windows.Forms.TabPage();
            this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
            this.tabControl1 = new System.Windows.Forms.TabControl();
            this.tabPage3 = new System.Windows.Forms.TabPage();
            this.tabPage2.SuspendLayout();
            this.tabPage1.SuspendLayout();
            this.tabControl1.SuspendLayout();
            this.SuspendLayout();
            // 
            // webBrowser1
            // 
            this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.webBrowser1.Location = new System.Drawing.Point(0, 127);
            this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
            this.webBrowser1.Name = "webBrowser1";
            this.webBrowser1.Size = new System.Drawing.Size(292, 539);
            this.webBrowser1.TabIndex = 1;
            this.webBrowser1.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.webBrowser1_DocumentCompleted);
            // 
            // tabPage2
            // 
            this.tabPage2.Controls.Add(this.flowLayoutPanel2);
            this.tabPage2.Location = new System.Drawing.Point(4, 21);
            this.tabPage2.Name = "tabPage2";
            this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
            this.tabPage2.Size = new System.Drawing.Size(284, 102);
            this.tabPage2.TabIndex = 1;
            this.tabPage2.Text = "関西";
            this.tabPage2.UseVisualStyleBackColor = true;
            // 
            // flowLayoutPanel2
            // 
            this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
            this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 3);
            this.flowLayoutPanel2.Name = "flowLayoutPanel2";
            this.flowLayoutPanel2.Size = new System.Drawing.Size(278, 96);
            this.flowLayoutPanel2.TabIndex = 0;
            // 
            // tabPage1
            // 
            this.tabPage1.Controls.Add(this.flowLayoutPanel1);
            this.tabPage1.Location = new System.Drawing.Point(4, 21);
            this.tabPage1.Name = "tabPage1";
            this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
            this.tabPage1.Size = new System.Drawing.Size(284, 102);
            this.tabPage1.TabIndex = 0;
            this.tabPage1.Text = "関東";
            this.tabPage1.UseVisualStyleBackColor = true;
            // 
            // flowLayoutPanel1
            // 
            this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3);
            this.flowLayoutPanel1.Name = "flowLayoutPanel1";
            this.flowLayoutPanel1.Size = new System.Drawing.Size(278, 96);
            this.flowLayoutPanel1.TabIndex = 0;
            // 
            // tabControl1
            // 
            this.tabControl1.Controls.Add(this.tabPage1);
            this.tabControl1.Controls.Add(this.tabPage2);
            this.tabControl1.Controls.Add(this.tabPage3);
            this.tabControl1.Dock = System.Windows.Forms.DockStyle.Top;
            this.tabControl1.Location = new System.Drawing.Point(0, 0);
            this.tabControl1.Name = "tabControl1";
            this.tabControl1.SelectedIndex = 0;
            this.tabControl1.Size = new System.Drawing.Size(292, 127);
            this.tabControl1.TabIndex = 2;
            // 
            // tabPage3
            // 
            this.tabPage3.Location = new System.Drawing.Point(4, 21);
            this.tabPage3.Name = "tabPage3";
            this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
            this.tabPage3.Size = new System.Drawing.Size(284, 102);
            this.tabPage3.TabIndex = 2;
            this.tabPage3.Text = "エリア判定";
            this.tabPage3.UseVisualStyleBackColor = true;
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(292, 666);
            this.Controls.Add(this.webBrowser1);
            this.Controls.Add(this.tabControl1);
            this.Name = "Form1";
            this.Text = "Radiko";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.tabPage2.ResumeLayout(false);
            this.tabPage1.ResumeLayout(false);
            this.tabControl1.ResumeLayout(false);
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.WebBrowser webBrowser1;
        private System.Windows.Forms.TabPage tabPage2;
        private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
        private System.Windows.Forms.TabPage tabPage1;
        private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
        private System.Windows.Forms.TabControl tabControl1;
        private System.Windows.Forms.TabPage tabPage3;
    }
}


Create a new paste based on this one


Comments: