home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Development
General Development (no feature request here!)
GUIListControl - Simple Example
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="kroko" data-source="post: 386338" data-attributes="member: 45719"><p>Hi GF__74,</p><p></p><p>here is small sample..</p><p></p><p>Define you facade</p><p></p><p>[SkinControlAttribute(50)]</p><p> protected GUIFacadeControl facadeView = null;</p><p></p><p>private void LoadDir() // called OnLoad</p><p></p><p>// facade clear</p><p>GUIControl.ClearControl(GetID, facadeView.GetID);</p><p></p><p>// add ".."</p><p> GUIListItem item = new GUIListItem();</p><p> item.Label = "..";</p><p> item.Path = currentFolder;</p><p> item.IsFolder = true;</p><p> item.MusicTag = null;</p><p> item.ThumbnailImage = string.Empty;</p><p> MediaPortal.Util.Utils.SetDefaultIcons(item);</p><p> facadeView.Add(item);</p><p></p><p>// all other items</p><p> for (int i = 0; i < currentPlayList.Count; ++i)</p><p> {</p><p> item = new GUIListItem();</p><p></p><p> item.Label = currentPlayList<em>.Description;</em></p><p><em> item.Path = currentPlayList<em>.FileName;</em></em></p><p><em><em> item.IsFolder = false;</em></em></p><p><em><em> item.MusicTag = null;</em></em></p><p><em><em> // see other props also</em></em></p><p><em><em></em></em></p><p><em><em> // thumbnail handling</em></em></p><p><em><em> item.ThumbnailImage = string.Empty;</em></em></p><p><em><em> item.IconImageBig = "DefaultMyradioStreamBig.png";</em></em></p><p><em><em> item.IconImage = "DefaultMyradioStream.png";</em></em></p><p><em><em></em></em></p><p><em><em> string thumbnail = MediaPortal.Util.Utils.GetCoverArt(Thumbs.Radio, item.Label);</em></em></p><p><em><em> if (System.IO.File.Exists(thumbnail))</em></em></p><p><em><em> {</em></em></p><p><em><em> item.IconImageBig = thumbnail;</em></em></p><p><em><em> item.IconImage = thumbnail;</em></em></p><p><em><em> item.ThumbnailImage = thumbnail;</em></em></p><p><em><em> }</em></em></p><p><em><em> facadeView.Add(item);</em></em></p><p><em><em>}</em></em></p><p><em><em></em></em></p><p><em><em>For the action use the Onclicked override</em></em></p><p><em><em></em></em></p><p> <em><em>if (control == facadeView)</em></em></p><p><em><em> {</em></em></p><p><em><em> GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECTED, GetID, 0, controlId, 0, 0, null);</em></em></p><p><em><em> OnMessage(msg);</em></em></p><p><em><em> int itemIndex = (int)msg.Param1;</em></em></p><p><em><em> if (actionType == Action.ActionType.ACTION_SELECT_ITEM)</em></em></p><p><em><em> {</em></em></p><p><em><em> OnClick(itemIndex);</em></em></p><p><em><em> }</em></em></p><p><em><em> }</em></em></p><p><em><em></em></em></p><p><em><em>(source from Streamradio V2)</em></em></p><p><em><em></em></em></p><p><em><em></em></em></p><p><em><em>Regards</em></em></p><p><em><em>kroko</em></em></p></blockquote><p></p>
[QUOTE="kroko, post: 386338, member: 45719"] Hi GF__74, here is small sample.. Define you facade [SkinControlAttribute(50)] protected GUIFacadeControl facadeView = null; private void LoadDir() // called OnLoad // facade clear GUIControl.ClearControl(GetID, facadeView.GetID); // add ".." GUIListItem item = new GUIListItem(); item.Label = ".."; item.Path = currentFolder; item.IsFolder = true; item.MusicTag = null; item.ThumbnailImage = string.Empty; MediaPortal.Util.Utils.SetDefaultIcons(item); facadeView.Add(item); // all other items for (int i = 0; i < currentPlayList.Count; ++i) { item = new GUIListItem(); item.Label = currentPlayList[i].Description; item.Path = currentPlayList[i].FileName; item.IsFolder = false; item.MusicTag = null; // see other props also // thumbnail handling item.ThumbnailImage = string.Empty; item.IconImageBig = "DefaultMyradioStreamBig.png"; item.IconImage = "DefaultMyradioStream.png"; string thumbnail = MediaPortal.Util.Utils.GetCoverArt(Thumbs.Radio, item.Label); if (System.IO.File.Exists(thumbnail)) { item.IconImageBig = thumbnail; item.IconImage = thumbnail; item.ThumbnailImage = thumbnail; } facadeView.Add(item); } For the action use the Onclicked override if (control == facadeView) { GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECTED, GetID, 0, controlId, 0, 0, null); OnMessage(msg); int itemIndex = (int)msg.Param1; if (actionType == Action.ActionType.ACTION_SELECT_ITEM) { OnClick(itemIndex); } } (source from Streamradio V2) Regards kroko[/i][/i] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Development
General Development (no feature request here!)
GUIListControl - Simple Example
Contact us
RSS
Top
Bottom