示例#1
0
        /// <summary>
        /// load the player on-demand by name
        /// </summary>
        /// <param name="strName"></param>
        private void loadPlayer(string strName)
        {
            switch (strName)
            {
            case "MPLAYER":
                ///Initialize the windows media player
                mediaPlayer = new AxWMPPlayer(getClsidFromProgId("WMPlayer.OCX.7"));
                if (mediaPlayer != null)
                {
                    Panel panel = new Panel();
                    panel.SuspendLayout();
                    this.SuspendLayout();

                    panel.Controls.Add(mediaPlayer);
                    panel.Location = new System.Drawing.Point(6, 0);
                    panel.Name     = "mediaPlayerPanel";
                    panel.Size     = new System.Drawing.Size(504, 65);

                    ((System.ComponentModel.ISupportInitialize)(mediaPlayer)).BeginInit();
                    mediaPlayer.Enabled  = true;
                    mediaPlayer.Location = new System.Drawing.Point(1, 0);
                    mediaPlayer.Name     = "mediaPlayer";
                    mediaPlayer.Size     = new System.Drawing.Size(503, 65);

                    Controls.Add(panel);

                    panel.ResumeLayout();
                    ((System.ComponentModel.ISupportInitialize)(mediaPlayer)).EndInit();
                    mediaPlayer.uiMode = "mini";

                    this.ResumeLayout(false);
                    this.PerformLayout();

                    panelList.Add("MPLAYER", panel);
                }
                else
                {
                    return;
                }
                break;

            case "VLCPLAYER":
                ///Initialize the vlc media player
                vlcPlayer     = new AxVLCPlayer(getClsidFromProgId("VideoLAN.VLCPlugin.1"));
                vlcVolumeCtrl = new VolumeControl();
                lavlcVolume   = new Label();
                vlcPlayBttn   = new Button();
                vlcStopBttn   = new Button();
                laVlcDesc     = new Label();
                if (vlcPlayer != null)
                {
                    Panel panel = new Panel();

                    panel.SuspendLayout();
                    this.SuspendLayout();

                    panel.Controls.Add(this.vlcStopBttn);
                    panel.Controls.Add(this.vlcPlayBttn);
                    panel.Controls.Add(this.lavlcVolume);
                    panel.Controls.Add(this.vlcVolumeCtrl);
                    panel.Controls.Add(this.laVlcDesc);
                    panel.Controls.Add(vlcPlayer);
                    panel.Location = new System.Drawing.Point(6, 0);
                    panel.Name     = "vlcPlayerPanel";
                    panel.Size     = new System.Drawing.Size(504, 65);

                    //
                    // vlcVolumeCtrl
                    //
                    vlcVolumeCtrl.BackColor      = System.Drawing.Color.White;
                    vlcVolumeCtrl.ForeColor      = System.Drawing.Color.Blue;
                    vlcVolumeCtrl.Location       = new System.Drawing.Point(402, 45);
                    vlcVolumeCtrl.Name           = "vlcVolumeCtrl";
                    vlcVolumeCtrl.Size           = new System.Drawing.Size(87, 10);
                    vlcVolumeCtrl.Style          = System.Windows.Forms.ProgressBarStyle.Continuous;
                    vlcVolumeCtrl.TabIndex       = 4;
                    vlcVolumeCtrl.VolumeChanged += new TamilFM.volumeChanged(this.vlcVolumeCtrl_VolumeChanged);
                    //
                    // lavlcVolume
                    //
                    lavlcVolume.AutoSize = true;
                    lavlcVolume.Location = new System.Drawing.Point(348, 45);
                    lavlcVolume.Name     = "lavlcVolume";
                    lavlcVolume.Size     = new System.Drawing.Size(48, 13);
                    lavlcVolume.TabIndex = 6;
                    lavlcVolume.Text     = "Volume :";
                    //
                    // vlcPlayBttn
                    //
                    vlcPlayBttn.Location = new System.Drawing.Point(79, 39);
                    vlcPlayBttn.Name     = "vlcPlayBttn";
                    vlcPlayBttn.Size     = new System.Drawing.Size(42, 24);
                    vlcPlayBttn.TabIndex = 7;
                    vlcPlayBttn.Text     = "Play";
                    vlcPlayBttn.UseVisualStyleBackColor = true;
                    vlcPlayBttn.Click += new System.EventHandler(this.vlcPlayBttn_Click);
                    //
                    // vlcStopBttn
                    //
                    vlcStopBttn.Location = new System.Drawing.Point(161, 39);
                    vlcStopBttn.Name     = "vlcStopBttn";
                    vlcStopBttn.Size     = new System.Drawing.Size(42, 24);
                    vlcStopBttn.TabIndex = 8;
                    vlcStopBttn.Text     = "Stop";
                    vlcStopBttn.UseVisualStyleBackColor = true;
                    vlcStopBttn.Click += new System.EventHandler(this.vlcStopBttn_Click);
                    //
                    // laVlcDesc
                    //
                    laVlcDesc.Location   = new System.Drawing.Point(225, 39);
                    laVlcDesc.Name       = "laVlcDesc";
                    laVlcDesc.Size       = new System.Drawing.Size(42, 24);
                    vlcStopBttn.TabIndex = 8;
                    laVlcDesc.Text       = "Stopped...";

                    ((System.ComponentModel.ISupportInitialize)(vlcPlayer)).BeginInit();

                    vlcPlayer.Enabled  = true;
                    vlcPlayer.Location = new System.Drawing.Point(0, 9);
                    vlcPlayer.Name     = "vlcPlayer";
                    vlcPlayer.Size     = new System.Drawing.Size(55, 50);

                    Controls.Add(panel);

                    panel.ResumeLayout();

                    ((System.ComponentModel.ISupportInitialize)(vlcPlayer)).EndInit();

                    this.ResumeLayout(false);
                    this.PerformLayout();
                    ///workaround for vlc player size problem
                    vlcPlayer.Location = new System.Drawing.Point(0, 9);
                    vlcPlayer.Size     = new System.Drawing.Size(55, 50);
                    vlcPlayer.AutoPlay = true;

                    panelList.Add("VLCPLAYER", panel);
                }
                else
                {
                    return;
                }
                break;
            }
        }
示例#2
0
        /// <summary>
        /// load the player on-demand by name
        /// </summary>
        /// <param name="strName"></param>
        private void loadPlayer(string strName)
        {
            switch (strName)
            {
                case "MPLAYER":
                    ///Initialize the windows media player
                    mediaPlayer = new AxWMPPlayer(getClsidFromProgId("WMPlayer.OCX.7"));
                    if (mediaPlayer != null)
                    {
                        Panel panel = new Panel();
                        panel.SuspendLayout();
                        this.SuspendLayout();

                        panel.Controls.Add(mediaPlayer);
                        panel.Location = new System.Drawing.Point(6, 0);
                        panel.Name = "mediaPlayerPanel";
                        panel.Size = new System.Drawing.Size(504, 65);

                        ((System.ComponentModel.ISupportInitialize)(mediaPlayer)).BeginInit();
                        mediaPlayer.Enabled = true;
                        mediaPlayer.Location = new System.Drawing.Point(1, 0);
                        mediaPlayer.Name = "mediaPlayer";
                        mediaPlayer.Size = new System.Drawing.Size(503, 65);

                        Controls.Add(panel);

                        panel.ResumeLayout();
                        ((System.ComponentModel.ISupportInitialize)(mediaPlayer)).EndInit();
                        mediaPlayer.uiMode = "mini";

                        this.ResumeLayout(false);
                        this.PerformLayout();

                        panelList.Add("MPLAYER", panel);
                    }
                    else
                    {
                        return;
                    }
                    break;
                case "VLCPLAYER":
                    ///Initialize the vlc media player
                    vlcPlayer = new AxVLCPlayer(getClsidFromProgId("VideoLAN.VLCPlugin.1"));
                    vlcVolumeCtrl = new VolumeControl();
                    lavlcVolume = new Label();
                    vlcPlayBttn = new Button();
                    vlcStopBttn = new Button();
                    laVlcDesc = new Label();
                    if (vlcPlayer != null)
                    {
                        Panel panel = new Panel();

                        panel.SuspendLayout();
                        this.SuspendLayout();

                        panel.Controls.Add(this.vlcStopBttn);
                        panel.Controls.Add(this.vlcPlayBttn);
                        panel.Controls.Add(this.lavlcVolume);
                        panel.Controls.Add(this.vlcVolumeCtrl);
                        panel.Controls.Add(this.laVlcDesc);
                        panel.Controls.Add(vlcPlayer);
                        panel.Location = new System.Drawing.Point(6, 0);
                        panel.Name = "vlcPlayerPanel";
                        panel.Size = new System.Drawing.Size(504, 65);

                        // 
                        // vlcVolumeCtrl
                        // 
                        vlcVolumeCtrl.BackColor = System.Drawing.Color.White;
                        vlcVolumeCtrl.ForeColor = System.Drawing.Color.Blue;
                        vlcVolumeCtrl.Location = new System.Drawing.Point(402, 45);
                        vlcVolumeCtrl.Name = "vlcVolumeCtrl";
                        vlcVolumeCtrl.Size = new System.Drawing.Size(87, 10);
                        vlcVolumeCtrl.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
                        vlcVolumeCtrl.TabIndex = 4;
                        vlcVolumeCtrl.VolumeChanged += new TamilFM.volumeChanged(this.vlcVolumeCtrl_VolumeChanged);
                        // 
                        // lavlcVolume
                        // 
                        lavlcVolume.AutoSize = true;
                        lavlcVolume.Location = new System.Drawing.Point(348, 45);
                        lavlcVolume.Name = "lavlcVolume";
                        lavlcVolume.Size = new System.Drawing.Size(48, 13);
                        lavlcVolume.TabIndex = 6;
                        lavlcVolume.Text = "Volume :";
                        // 
                        // vlcPlayBttn
                        // 
                        vlcPlayBttn.Location = new System.Drawing.Point(79, 39);
                        vlcPlayBttn.Name = "vlcPlayBttn";
                        vlcPlayBttn.Size = new System.Drawing.Size(42, 24);
                        vlcPlayBttn.TabIndex = 7;
                        vlcPlayBttn.Text = "Play";
                        vlcPlayBttn.UseVisualStyleBackColor = true;
                        vlcPlayBttn.Click += new System.EventHandler(this.vlcPlayBttn_Click);
                        // 
                        // vlcStopBttn
                        // 
                        vlcStopBttn.Location = new System.Drawing.Point(161, 39);
                        vlcStopBttn.Name = "vlcStopBttn";
                        vlcStopBttn.Size = new System.Drawing.Size(42, 24);
                        vlcStopBttn.TabIndex = 8;
                        vlcStopBttn.Text = "Stop";
                        vlcStopBttn.UseVisualStyleBackColor = true;
                        vlcStopBttn.Click += new System.EventHandler(this.vlcStopBttn_Click);
                        // 
                        // laVlcDesc
                        // 
                        laVlcDesc.Location = new System.Drawing.Point(225, 39);
                        laVlcDesc.Name = "laVlcDesc";
                        laVlcDesc.Size = new System.Drawing.Size(42, 24);
                        vlcStopBttn.TabIndex = 8;
                        laVlcDesc.Text = "Stopped...";

                        ((System.ComponentModel.ISupportInitialize)(vlcPlayer)).BeginInit();

                        vlcPlayer.Enabled = true;
                        vlcPlayer.Location = new System.Drawing.Point(0, 9);
                        vlcPlayer.Name = "vlcPlayer";
                        vlcPlayer.Size = new System.Drawing.Size(55, 50);

                        Controls.Add(panel);

                        panel.ResumeLayout();

                        ((System.ComponentModel.ISupportInitialize)(vlcPlayer)).EndInit();

                        this.ResumeLayout(false);
                        this.PerformLayout();
                        ///workaround for vlc player size problem
                        vlcPlayer.Location = new System.Drawing.Point(0, 9);
                        vlcPlayer.Size = new System.Drawing.Size(55, 50);
                        vlcPlayer.AutoPlay = true;

                        panelList.Add("VLCPLAYER", panel);
                    }
                    else
                    {
                        return;
                    }
                    break;
            }
        }