Changeset 117

Show
Ignore:
Timestamp:
03/03/07 14:54:09 (2 years ago)
Author:
mgeske2
Message:

Added ability to stop or pause a song, and used the vlcUserControl's playlist to play the next song when the current song ends. Also modified the BadClient? GUI to be a bit more useable.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dmp/trunk/BadClient/Form1.Designer.cs

    r97 r117  
    2424        /// </summary> 
    2525        private void InitializeComponent() { 
    26             System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("Servers"); 
     26            System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("Servers"); 
    2727            this.label1 = new System.Windows.Forms.Label(); 
    2828            this.txtHost = new System.Windows.Forms.TextBox(); 
     
    3232            this.lblStatus = new System.Windows.Forms.Label(); 
    3333            this.splitContainer1 = new System.Windows.Forms.SplitContainer(); 
     34            this.button4 = new System.Windows.Forms.Button(); 
    3435            this.button3 = new System.Windows.Forms.Button(); 
    3536            this.btnListServers = new System.Windows.Forms.Button(); 
    3637            this.splitContainer2 = new System.Windows.Forms.SplitContainer(); 
    3738            this.button2 = new System.Windows.Forms.Button(); 
     39            this.vlcPlayer = new VLanControl.VlcUserControl(); 
    3840            this.splitContainer3 = new System.Windows.Forms.SplitContainer(); 
    3941            this.panel1 = new System.Windows.Forms.Panel(); 
     
    4244            this.colID = new System.Windows.Forms.DataGridViewTextBoxColumn(); 
    4345            this.colLibID = new System.Windows.Forms.DataGridViewTextBoxColumn(); 
     46            this.RemoteSongId = new System.Windows.Forms.DataGridViewTextBoxColumn(); 
    4447            this.colArtist = new System.Windows.Forms.DataGridViewTextBoxColumn(); 
    4548            this.colAlbum = new System.Windows.Forms.DataGridViewTextBoxColumn(); 
    4649            this.colTrack = new System.Windows.Forms.DataGridViewTextBoxColumn(); 
    47             this.vlcPlayer = new VLanControl.VlcUserControl(); 
    4850            this.splitContainer1.Panel1.SuspendLayout(); 
    4951            this.splitContainer1.Panel2.SuspendLayout(); 
     
    120122            // splitContainer1.Panel1 
    121123            //  
     124            this.splitContainer1.Panel1.Controls.Add(this.button4); 
    122125            this.splitContainer1.Panel1.Controls.Add(this.button3); 
    123126            this.splitContainer1.Panel1.Controls.Add(this.btnListServers); 
     
    139142            this.splitContainer1.TabIndex = 8; 
    140143            //  
     144            // button4 
     145            //  
     146            this.button4.Location = new System.Drawing.Point(820, 7); 
     147            this.button4.Name = "button4"; 
     148            this.button4.Size = new System.Drawing.Size(46, 21); 
     149            this.button4.TabIndex = 11; 
     150            this.button4.Text = "Stop"; 
     151            this.button4.UseVisualStyleBackColor = true; 
     152            this.button4.Click += new System.EventHandler(this.button4_Click); 
     153            //  
    141154            // button3 
    142155            //  
    143             this.button3.Location = new System.Drawing.Point(778, 7); 
     156            this.button3.Location = new System.Drawing.Point(769, 7); 
    144157            this.button3.Name = "button3"; 
    145             this.button3.Size = new System.Drawing.Size(88, 22); 
     158            this.button3.Size = new System.Drawing.Size(45, 22); 
    146159            this.button3.TabIndex = 9; 
    147160            this.button3.Text = "Play"; 
     
    151164            // btnListServers 
    152165            //  
    153             this.btnListServers.Location = new System.Drawing.Point(697, 7); 
     166            this.btnListServers.Location = new System.Drawing.Point(688, 7); 
    154167            this.btnListServers.Name = "btnListServers"; 
    155168            this.btnListServers.Size = new System.Drawing.Size(75, 23); 
     
    169182            // button2 
    170183            //  
    171             this.button2.Location = new System.Drawing.Point(583, 8); 
     184            this.button2.Location = new System.Drawing.Point(574, 7); 
    172185            this.button2.Name = "button2"; 
    173186            this.button2.Size = new System.Drawing.Size(108, 23); 
     
    177190            this.button2.Click += new System.EventHandler(this.button2_Click); 
    178191            //  
     192            // vlcPlayer 
     193            //  
     194            this.vlcPlayer.Location = new System.Drawing.Point(430, 3); 
     195            this.vlcPlayer.Name = "vlcPlayer"; 
     196            this.vlcPlayer.Size = new System.Drawing.Size(150, 31); 
     197            this.vlcPlayer.TabIndex = 10; 
     198            this.vlcPlayer.UseMpegVbrOffset = false; 
     199            //  
    179200            // splitContainer3 
    180201            //  
     
    191212            this.splitContainer3.Panel2.Controls.Add(this.dgvSongs); 
    192213            this.splitContainer3.Size = new System.Drawing.Size(878, 407); 
    193             this.splitContainer3.SplitterDistance = 212
     214            this.splitContainer3.SplitterDistance = 211
    194215            this.splitContainer3.TabIndex = 0; 
    195216            //  
     
    200221            this.panel1.Location = new System.Drawing.Point(0, 0); 
    201222            this.panel1.Name = "panel1"; 
    202             this.panel1.Size = new System.Drawing.Size(212, 407); 
     223            this.panel1.Size = new System.Drawing.Size(211, 407); 
    203224            this.panel1.TabIndex = 0; 
    204225            //  
     
    208229            this.treeView1.Location = new System.Drawing.Point(0, 0); 
    209230            this.treeView1.Name = "treeView1"; 
    210             treeNode1.Name = "Node0"; 
    211             treeNode1.Text = "Servers"; 
     231            treeNode2.Name = "Node0"; 
     232            treeNode2.Text = "Servers"; 
    212233            this.treeView1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { 
    213             treeNode1}); 
    214             this.treeView1.Size = new System.Drawing.Size(212, 407); 
     234            treeNode2}); 
     235            this.treeView1.Size = new System.Drawing.Size(211, 407); 
    215236            this.treeView1.TabIndex = 0; 
    216237            //  
     
    221242            this.colID, 
    222243            this.colLibID, 
     244            this.RemoteSongId, 
    223245            this.colArtist, 
    224246            this.colAlbum, 
     
    228250            this.dgvSongs.Name = "dgvSongs"; 
    229251            this.dgvSongs.ReadOnly = true; 
    230             this.dgvSongs.Size = new System.Drawing.Size(662, 407); 
     252            this.dgvSongs.Size = new System.Drawing.Size(663, 407); 
    231253            this.dgvSongs.TabIndex = 7; 
     254            this.dgvSongs.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.playSelectedSong); 
    232255            //  
    233256            // colID 
     
    243266            this.colLibID.ReadOnly = true; 
    244267            //  
     268            // RemoteSongId 
     269            //  
     270            this.RemoteSongId.HeaderText = "RemoteSongId"; 
     271            this.RemoteSongId.Name = "RemoteSongId"; 
     272            this.RemoteSongId.ReadOnly = true; 
     273            //  
    245274            // colArtist 
    246275            //  
     
    260289            this.colTrack.Name = "colTrack"; 
    261290            this.colTrack.ReadOnly = true; 
    262             //  
    263             // vlcPlayer 
    264             //  
    265             this.vlcPlayer.Location = new System.Drawing.Point(430, 3); 
    266             this.vlcPlayer.Name = "vlcPlayer"; 
    267             this.vlcPlayer.Size = new System.Drawing.Size(150, 31); 
    268             this.vlcPlayer.TabIndex = 10; 
    269             this.vlcPlayer.UseMpegVbrOffset = false; 
    270291            //  
    271292            // Form1 
     
    303324                private System.Windows.Forms.SplitContainer splitContainer2; 
    304325                private System.Windows.Forms.SplitContainer splitContainer3; 
    305                 private System.Windows.Forms.DataGridView dgvSongs; 
    306                 private System.Windows.Forms.DataGridViewTextBoxColumn colID; 
    307                 private System.Windows.Forms.DataGridViewTextBoxColumn colLibID; 
    308                 private System.Windows.Forms.DataGridViewTextBoxColumn colArtist; 
    309                 private System.Windows.Forms.DataGridViewTextBoxColumn colAlbum; 
    310                 private System.Windows.Forms.DataGridViewTextBoxColumn colTrack; 
     326        private System.Windows.Forms.DataGridView dgvSongs; 
    311327                private System.Windows.Forms.Panel panel1; 
    312328                private System.Windows.Forms.TreeView treeView1; 
     
    315331        private System.Windows.Forms.Button button3; 
    316332        private VLanControl.VlcUserControl vlcPlayer; 
     333        private System.Windows.Forms.DataGridViewTextBoxColumn colID; 
     334        private System.Windows.Forms.DataGridViewTextBoxColumn colLibID; 
     335        private System.Windows.Forms.DataGridViewTextBoxColumn RemoteSongId; 
     336        private System.Windows.Forms.DataGridViewTextBoxColumn colArtist; 
     337        private System.Windows.Forms.DataGridViewTextBoxColumn colAlbum; 
     338        private System.Windows.Forms.DataGridViewTextBoxColumn colTrack; 
     339        private System.Windows.Forms.Button button4; 
    317340    } 
    318341} 
  • dmp/trunk/BadClient/Form1.cs

    r110 r117  
    33using System.ComponentModel; 
    44using System.Data; 
     5using System.Diagnostics; 
    56using System.Drawing; 
    67using System.Text; 
     
    1011        public partial class Form1 : Form { 
    1112                private Bridge  myBridge; 
     13        private System.Collections.Hashtable playlistHash; 
    1214                public Form1() { 
    1315                        InitializeComponent(); 
    1416                        myBridge = new Bridge(); 
     17            playlistHash = new System.Collections.Hashtable(); 
    1518            if( myBridge.isDatabaseUp() ) 
    1619                lblStatus.Text = "Status: Bridge constructed and db up!"; 
     
    3134                    { 
    3235                        dgvSongs.Rows.Add(row.ItemArray); 
     36                        int songId = int.Parse(row.ItemArray[0].ToString()); 
     37                        if (!playlistHash.Contains(songId)) 
     38                        { 
     39                            String songURL = this.myBridge.getSongURL(songId); 
     40                            playlistHash.Add(songId, vlcPlayer.AddToPlayList(songURL, songURL, null)); 
     41                        } 
    3342                    } 
    3443                } 
     
    6473        private void button3_Click(object sender, EventArgs e) 
    6574        { 
    66              
     75            if (vlcPlayer.IsPaused) 
     76            { 
     77                vlcPlayer.TogglePause(); 
     78                this.button3.Text = "Pause"; 
     79            } 
     80            else if (vlcPlayer.IsPlaying) 
     81            { 
     82                vlcPlayer.TogglePause(); 
     83                this.button3.Text = "Play"; 
     84            } 
     85            else 
     86            { 
     87                playSelectedSong(); 
     88            } 
     89        } 
     90 
     91        private void button4_Click(object sender, EventArgs e) 
     92        { 
     93            vlcPlayer.Stop(); 
     94            this.button3.Text = "Play"; 
     95        } 
     96 
     97        private void playSelectedSong(object sender, DataGridViewCellEventArgs e) 
     98        { 
     99            playSelectedSong(); 
     100        } 
     101 
     102        private void playSelectedSong() 
     103        { 
    67104            int songId = int.Parse(dgvSongs.CurrentRow.Cells[0].Value.ToString()); 
    68             String songURL = this.myBridge.getSongURL(songId); 
    69              
    70             vlcPlayer.AddAndPlay(songURL,""); 
     105            //String songURL = this.myBridge.getSongURL(songId); 
     106            //vlcPlayer.AddAndPlay(songURL,""); 
     107 
     108            int playlistId = (int)playlistHash[songId]; 
     109            Debug.WriteLine("Playing song with id " + playlistId.ToString()); 
     110            vlcPlayer.PlayItem(playlistId); 
     111            this.button3.Text = "Pause"; 
    71112        } 
    72113        } 
  • dmp/trunk/BadClient/Form1.resx

    r58 r117  
    124124    <value>True</value> 
    125125  </metadata> 
     126  <metadata name="RemoteSongId.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
     127    <value>True</value> 
     128  </metadata> 
     129  <metadata name="colArtist.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
     130    <value>True</value> 
     131  </metadata> 
     132  <metadata name="colAlbum.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
     133    <value>True</value> 
     134  </metadata> 
     135  <metadata name="colTrack.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
     136    <value>True</value> 
     137  </metadata> 
     138  <metadata name="colID.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
     139    <value>True</value> 
     140  </metadata> 
     141  <metadata name="colLibID.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
     142    <value>True</value> 
     143  </metadata> 
     144  <metadata name="RemoteSongId.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
     145    <value>True</value> 
     146  </metadata> 
    126147  <metadata name="colArtist.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
    127148    <value>True</value> 
  • dmp/trunk/vlc.NET/VlcUserControl.cs

    r50 r117  
    10271027                        int currentIndex = this.nativeVlc.PlaylistIndex; 
    10281028                        Debug.WriteLine("PlayItem index = " + itemId.ToString(), " currentIndex = " + currentIndex.ToString()); 
     1029            this.nativeVlc.Play(itemId); 
     1030            /* I'm not sure why they had this, but it doesn't seem necessary to call Play() when currentIndex < 0 
    10291031                        if(currentIndex < 0) 
    10301032                        { 
     
    10351037                                //this.nativeVlc.PlaylistPrevious(); 
    10361038                                this.nativeVlc.Play(itemId); 
    1037                         } 
     1039                        }*/ 
    10381040                } 
    10391041