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
MediaPortal 1 Talk
Guicontrolsdemo ? come out, come out, whereever you are?
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="gpnash" data-source="post: 1201243" data-attributes="member: 151666"><p>Guess I just don't get it.... but then again the windows 10 universal windows code baffles me too. windows forms... that I understand.</p><p></p><p>Thanks for the last straw.. Here's the working vb example....</p><p></p><p></p><p></p><p>[code]</p><p> <window></p><p> <id>10001</id></p><p> <defaultcontrol>3</defaultcontrol></p><p> <allowoverlay>yes</allowoverlay></p><p> <controls></p><p> <control></p><p> <id>0</id></p><p> <type>image</type></p><p> <posX>66</posX></p><p> <posY>34</posY></p><p> <width>61</width></p><p> <height>57</height></p><p> <texture>icon_tv.png</texture></p><p> <animation effect="fade" time="250">WindowOpen</animation></p><p> <animation effect="fade" time="250">WindowClose</animation></p><p> </control></p><p> <import>common.time.xml</import></p><p> <control></p><p> <description>Refresh</description></p><p> <type>button</type></p><p> <id>3</id></p><p> <posX>100</posX></p><p> <posY>175</posY></p><p> <height>60</height></p><p> <onleft>3</onleft></p><p> <onright>3</onright></p><p> <onup>3</onup></p><p> <ondown>4</ondown></p><p> <label>Refresh</label></p><p> </control></p><p> <control></p><p> <description>text label</description></p><p> <type>label</type></p><p> <id>2</id></p><p> <posX>100</posX></p><p> <posY>240</posY></p><p> <label></label></p><p> <font>font16</font></p><p> <align>left</align></p><p> <textcolor>ffffffff</textcolor></p><p> </control></p><p> <control></p><p> <description>GuiList</description></p><p> <type>listcontrol</type></p><p> <id>4</id></p><p> <posX>100</posX></p><p> <posY>305</posY></p><p> <scrollOffset>2</scrollOffset></p><p> <font>font10</font></p><p> <align>left</align></p><p> <onleft>3</onleft></p><p> <onright>3</onright></p><p> <textcolor>ffffffff</textcolor></p><p> <unfocusedAlpha>160</unfocusedAlpha></p><p> </control></p><p> </controls></p><p></window></p><p>[/code]</p><p>[code]</p><p>Imports System</p><p></p><p>Imports System.Windows.Forms</p><p></p><p>Imports MediaPortal.GUI.Library</p><p></p><p>Imports MediaPortal.Dialogs</p><p></p><p></p><p></p><p>Namespace MPtvApprove</p><p></p><p>' http://wiki.team-mediaportal.com/1_MEDIAPORTAL_1/18_Contribute/6_Plugins/Plugin_Developer's_Guide/1_Develop_a_Plugin/Visual_Basic</p><p></p><p>Public Class TvApprove</p><p></p><p>Inherits GUIWindow</p><p></p><p>Implements ISetupForm</p><p></p><p><SkinControlAttribute(2)> Protected lblText As GUILabelControl = Nothing</p><p></p><p><SkinControlAttribute(3)> Protected buttonOne As GUIButtonControl = Nothing</p><p></p><p><SkinControlAttribute(4)> Protected myList As GUIListControl = Nothing</p><p></p><p>Private _windowID As Integer = 10001</p><p></p><p>Private errors As String = String.Empty</p><p></p><p>' With GetID it will be an window-plugin / otherwise a process-plugin</p><p></p><p>' Enter the id number here again</p><p></p><p>Public Overrides Property GetID As Integer</p><p></p><p>Get</p><p></p><p>Return _windowID</p><p></p><p>End Get</p><p></p><p>Set(value As Integer)</p><p></p><p>_windowID = value</p><p></p><p>End Set</p><p></p><p>End Property</p><p></p><p>Public Overrides Function Init() As Boolean</p><p></p><p>Dim result As Boolean = Load(GUIGraphicsContext.Skin + "\MPtvapprove.xml")</p><p></p><p>Return result</p><p></p><p>End Function</p><p></p><p>Protected Overrides Sub OnPageLoad()</p><p></p><p>GUIPropertyManager.SetProperty("#header.label", "TV Approve for Recording")</p><p></p><p>myList.Clear()</p><p></p><p>errors = String.Empty</p><p></p><p>myList.SetTextOffsets(100, 0, 1090, 0, 1100, 0)</p><p></p><p>myList.IconOffsetX = 0</p><p></p><p>myList.IconOffsetY = 0</p><p></p><p>myList.TypeOfList = GUIListControl.ListType.CONTROL_LIST</p><p></p><p>myList.Space = 1</p><p></p><p>For Each candidate As tvCandidate In getTitlesToApprove()</p><p></p><p>myList.Add(candidate.toGuiListItem)</p><p></p><p>Next</p><p></p><p>errors += If(errors.Length > 0, "\n", "")</p><p></p><p>lblText.Label = errors + "found:" + myList.Count.ToString + " records"</p><p></p><p>MyBase.OnPageLoad()</p><p></p><p>End Sub</p><p></p><p>Public Sub New()</p><p></p><p>MyBase.New</p><p></p><p>End Sub</p><p></p><p>Public Function PluginName() As String Implements ISetupForm.PluginName</p><p></p><p>Return "TvApprove"</p><p></p><p>End Function</p><p></p><p>Public Function Description() As String Implements ISetupForm.Description</p><p></p><p>Return "TvApprove - Approve selected TVshows for recording."</p><p></p><p>End Function</p><p></p><p>Public Function Author() As String Implements ISetupForm.Author</p><p></p><p>Return "Guy Nash"</p><p></p><p>End Function</p><p></p><p>Public Sub ShowPlugin() Implements ISetupForm.ShowPlugin</p><p></p><p>MessageBox.Show("Nothing to configure, this is just an example")</p><p></p><p>End Sub</p><p></p><p>Public Function CanEnable() As Boolean Implements ISetupForm.CanEnable</p><p></p><p>Return True</p><p></p><p>End Function</p><p></p><p>' Get Windows-ID</p><p></p><p>Public Function GetWindowId() As Integer Implements ISetupForm.GetWindowId</p><p></p><p>Return _windowID</p><p></p><p>End Function</p><p></p><p>Public Function DefaultEnabled() As Boolean Implements ISetupForm.DefaultEnabled</p><p></p><p>Return True</p><p></p><p>End Function</p><p></p><p>Public Function HasSetup() As Boolean Implements ISetupForm.HasSetup</p><p></p><p>Return False</p><p></p><p>End Function</p><p></p><p>''' <summary></p><p></p><p>''' If the plugin should have it's own button on the main menu of MediaPortal then it</p><p></p><p>''' should return true to this method, otherwise if it should not be on home</p><p></p><p>''' it should return false</p><p></p><p>''' </summary></p><p></p><p>''' <param name="strButtonText">text the button should have</param></p><p></p><p>''' <param name="strButtonImage">image for the button, or empty for default</param></p><p></p><p>''' <param name="strButtonImageFocus">image for the button, or empty for default</param></p><p></p><p>''' <param name="strPictureImage">subpicture for the button or empty for none</param></p><p></p><p>''' <returns>true : plugin needs it's own button on home</p><p></p><p>''' false : plugin does not need it's own button on home</returns></p><p></p><p>Public Function GetHome(ByRef strButtonText As String, ByRef strButtonImage As String, ByRef strButtonImageFocus As String, ByRef strPictureImage As String) As Boolean Implements ISetupForm.GetHome</p><p></p><p>strButtonText = PluginName()</p><p></p><p>strButtonImage = "c:\\programdata\\team mediaportal\\mediaportal\\skin\\Titan\\Media\\hover_my tv.png"</p><p></p><p>strButtonImageFocus = [String].Empty</p><p></p><p>strPictureImage = [String].Empty</p><p></p><p>Return True</p><p></p><p>End Function</p><p></p><p>Public Overrides Function OnMessage(ByVal message As GUIMessage) As Boolean</p><p></p><p>Select Case message.Message</p><p></p><p>Case GUIMessage.MessageType.GUI_MSG_CLICKED</p><p></p><p>If message.SenderControlId = myList.GetID Then</p><p></p><p>If CType(MediaPortal.GUI.Library.Action.ActionType.ACTION_SELECT_ITEM, Integer) = message.Param1 Then</p><p></p><p>Dim item As GUIListItem = myList.SelectedListItem</p><p></p><p>'MessageBox.Show("msg:" + item.IconImage)</p><p></p><p>item.Selected = item.IconImage.ToLower.EndsWith("checkmark_unchecked.png")</p><p></p><p>item.IconImage = If(item.Selected, "c:\\programdata\\Team MediaPortal\\MediaPortal\\skin\\Titan\\Media\\checkmark_checked.png", "c:\\programdata\\Team MediaPortal\\MediaPortal\\skin\\Titan\\Media\\checkmark_unchecked.png")</p><p></p><p>Return True</p><p></p><p>End If</p><p></p><p>End If</p><p></p><p>Case Else</p><p></p><p>End Select</p><p></p><p>Return MyBase.OnMessage(message)</p><p></p><p>End Function</p><p></p><p>Protected Overrides Sub OnClicked(ByVal controlId As Integer, ByVal control As GUIControl, ByVal actionType As MediaPortal.GUI.Library.Action.ActionType)</p><p></p><p>Select Case controlId</p><p></p><p>Case buttonOne.GetID</p><p></p><p>OnButtonOne()</p><p></p><p>Case myList.GetID</p><p></p><p>Dim item As GUIListItem = myList.SelectedListItem</p><p></p><p>'MessageBox.Show(item.IconImage)</p><p></p><p>item.Selected = item.IconImage.ToLower.EndsWith("checkmark_unchecked.png")</p><p></p><p>item.IconImage = If(item.Selected, "c:\\programdata\\Team MediaPortal\\MediaPortal\\skin\\Titan\\Media\\checkmark_checked.png", "c:\\programdata\\Team MediaPortal\\MediaPortal\\skin\\Titan\\Media\\checkmark_unchecked.png")</p><p></p><p>Case Else</p><p></p><p>End Select</p><p></p><p>MyBase.OnClicked(controlId, control, actionType)</p><p></p><p>End Sub</p><p></p><p>Private Sub OnButtonOne()</p><p></p><p>myList.Clear()</p><p></p><p>myList.SetTextOffsets(100, 0, 1090, 0, 1100, 0)</p><p></p><p>myList.IconOffsetX = 0</p><p></p><p>myList.IconOffsetY = 0</p><p></p><p>myList.Space = 1</p><p></p><p>For Each candidate As tvCandidate In getTitlesToApprove()</p><p></p><p>myList.Add(candidate.toGuiListItem)</p><p></p><p>Next</p><p></p><p>errors += If(errors.Length > 0, "\r", "")</p><p></p><p>lblText.Label = errors + "found:" + myList.Count.ToString + " records"</p><p></p><p>End Sub</p><p></p><p>Function getTitlesToApprove() As List(Of tvCandidate)</p><p></p><p>Dim result As List(Of tvCandidate) = New List(Of tvCandidate)</p><p></p><p>errors = String.Empty</p><p></p><p>Try</p><p></p><p>Using c0 As SqlClient.SqlConnection = New SqlClient.SqlConnection("server=mediaportalserv;user id=xx;password=xxxxxxxx;database=mptvdb;")</p><p></p><p>c0.Open()</p><p></p><p>Using c1 As SqlClient.SqlCommand = New SqlClient.SqlCommand("select idprogram,series,episode,season,episodenumber,dbchannelid,channel,channeldisplayname,starttime,endtime from tvshowcandidates where starttime > getdate() order by starttime,series,channel desc", c0)</p><p></p><p>Using c2 As SqlClient.SqlDataReader = c1.ExecuteReader</p><p></p><p>If c2.HasRows Then</p><p></p><p>While c2.Read</p><p></p><p>result.Add(New tvCandidate(c2))</p><p></p><p>End While</p><p></p><p>End If</p><p></p><p>End Using</p><p></p><p>End Using</p><p></p><p>c0.Close()</p><p></p><p>End Using</p><p></p><p>Catch ex As Exception</p><p></p><p>Dim a As tvCandidate = New tvCandidate</p><p></p><p>a.series = ex.Message</p><p></p><p>result.Add(a)</p><p></p><p>errors += "\r" + ex.Message</p><p></p><p>End Try</p><p></p><p>Return result</p><p></p><p>End Function</p><p></p><p>End Class</p><p></p><p>End Namespace</p><p>[/code]</p><p></p><p>[code]</p><p>Imports MediaPortal.GUI.Library</p><p></p><p>Imports MediaPortal.Dialogs</p><p></p><p>Public Class tvCandidate</p><p></p><p>Public idprogram As Integer</p><p></p><p>Public series As String</p><p></p><p>Public episode As String</p><p></p><p>Public season As String</p><p></p><p>Public episodenumber As String</p><p></p><p>Public dbchannelid As Integer</p><p></p><p>Public channel As String</p><p></p><p>Public channeldisplayname As String</p><p></p><p>Public starttime As DateTime</p><p></p><p>Public endtime As DateTime</p><p></p><p>Public Sub New()</p><p></p><p>End Sub</p><p></p><p>Public Sub New(ByVal i() As Object)</p><p></p><p>idprogram = i(0)</p><p></p><p>series = i(1)</p><p></p><p>episode = i(2)</p><p></p><p>season = i(3)</p><p></p><p>episodenumber = i(4)</p><p></p><p>dbchannelid = i(5)</p><p></p><p>channel = i(6)</p><p></p><p>channeldisplayname = i(7)</p><p></p><p>starttime = i(8)</p><p></p><p>endtime = i(9)</p><p></p><p>End Sub</p><p></p><p>Public Sub New(ByVal i0 As Integer, ByVal i1 As String, ByVal i2 As String, ByVal i3 As String, ByVal i4 As String, ByVal i5 As Integer, ByVal i6 As String, ByVal i7 As String, ByVal i8 As DateTime, ByVal i9 As DateTime)</p><p></p><p>Me.New({i0, i1, i2, i3, i4, i5, i6, i7, i8, i9})</p><p></p><p>End Sub</p><p></p><p>Public Sub New(ByVal sqlrdr As SqlClient.SqlDataReader)</p><p></p><p>Dim i() As Object = {New Object, New Object, New Object, New Object, New Object, New Object, New Object, New Object, New Object, New Object, New Object}</p><p></p><p>Dim mydefault() As Object = {-1, String.Empty, String.Empty, String.Empty, String.Empty, -1, String.Empty, String.Empty, Date.MinValue, Date.MinValue}</p><p></p><p>For j = 0 To 9</p><p></p><p>i(j) = getSQLvalue(sqlrdr, j, mydefault(j))</p><p></p><p>Next</p><p></p><p>idprogram = i(0)</p><p></p><p>series = i(1)</p><p></p><p>episode = i(2)</p><p></p><p>season = i(3)</p><p></p><p>episodenumber = i(4)</p><p></p><p>dbchannelid = i(5)</p><p></p><p>channel = i(6)</p><p></p><p>channeldisplayname = i(7)</p><p></p><p>starttime = i(8)</p><p></p><p>endtime = i(9)</p><p></p><p>End Sub</p><p></p><p>Private Function getSQLvalue(ByVal r As SqlClient.SqlDataReader, ByVal c As Integer, ByVal empty As Object) As Object</p><p></p><p>Dim result As Object = empty</p><p></p><p>If r.IsDBNull(c) Then</p><p></p><p>Else</p><p></p><p>result = r.GetValue(c)</p><p></p><p>End If</p><p></p><p>Return result</p><p></p><p>End Function</p><p></p><p>Public Function toGuiListItem() As GUIListItem</p><p></p><p>Dim result As GUIListItem = New GUIListItem(starttime.ToString("MM/dd/yyyy hh:mm tt"))</p><p></p><p>result.Label += StrDup(6 - channel.Length, "_") + channel + " " + channeldisplayname</p><p></p><p>result.IconImage = "c:\\programdata\\Team MediaPortal\\MediaPortal\\skin\\Titan\\Media\\checkmark_unchecked.png"</p><p></p><p>result.Label2 = series</p><p></p><p>result.Label3 = season + "." + episodenumber + " " + episode</p><p></p><p>'AddHandler result.OnItemSelected, New GUIListItem.ItemSelectedHandler(AddressOf myOnItemselected)</p><p></p><p>Return result</p><p></p><p>End Function</p><p></p><p>End Class</p><p>[/code]</p></blockquote><p></p>
[QUOTE="gpnash, post: 1201243, member: 151666"] Guess I just don't get it.... but then again the windows 10 universal windows code baffles me too. windows forms... that I understand. Thanks for the last straw.. Here's the working vb example.... [code] <window> <id>10001</id> <defaultcontrol>3</defaultcontrol> <allowoverlay>yes</allowoverlay> <controls> <control> <id>0</id> <type>image</type> <posX>66</posX> <posY>34</posY> <width>61</width> <height>57</height> <texture>icon_tv.png</texture> <animation effect="fade" time="250">WindowOpen</animation> <animation effect="fade" time="250">WindowClose</animation> </control> <import>common.time.xml</import> <control> <description>Refresh</description> <type>button</type> <id>3</id> <posX>100</posX> <posY>175</posY> <height>60</height> <onleft>3</onleft> <onright>3</onright> <onup>3</onup> <ondown>4</ondown> <label>Refresh</label> </control> <control> <description>text label</description> <type>label</type> <id>2</id> <posX>100</posX> <posY>240</posY> <label></label> <font>font16</font> <align>left</align> <textcolor>ffffffff</textcolor> </control> <control> <description>GuiList</description> <type>listcontrol</type> <id>4</id> <posX>100</posX> <posY>305</posY> <scrollOffset>2</scrollOffset> <font>font10</font> <align>left</align> <onleft>3</onleft> <onright>3</onright> <textcolor>ffffffff</textcolor> <unfocusedAlpha>160</unfocusedAlpha> </control> </controls> </window> [/code] [code] Imports System Imports System.Windows.Forms Imports MediaPortal.GUI.Library Imports MediaPortal.Dialogs Namespace MPtvApprove ' http://wiki.team-mediaportal.com/1_MEDIAPORTAL_1/18_Contribute/6_Plugins/Plugin_Developer's_Guide/1_Develop_a_Plugin/Visual_Basic Public Class TvApprove Inherits GUIWindow Implements ISetupForm <SkinControlAttribute(2)> Protected lblText As GUILabelControl = Nothing <SkinControlAttribute(3)> Protected buttonOne As GUIButtonControl = Nothing <SkinControlAttribute(4)> Protected myList As GUIListControl = Nothing Private _windowID As Integer = 10001 Private errors As String = String.Empty ' With GetID it will be an window-plugin / otherwise a process-plugin ' Enter the id number here again Public Overrides Property GetID As Integer Get Return _windowID End Get Set(value As Integer) _windowID = value End Set End Property Public Overrides Function Init() As Boolean Dim result As Boolean = Load(GUIGraphicsContext.Skin + "\MPtvapprove.xml") Return result End Function Protected Overrides Sub OnPageLoad() GUIPropertyManager.SetProperty("#header.label", "TV Approve for Recording") myList.Clear() errors = String.Empty myList.SetTextOffsets(100, 0, 1090, 0, 1100, 0) myList.IconOffsetX = 0 myList.IconOffsetY = 0 myList.TypeOfList = GUIListControl.ListType.CONTROL_LIST myList.Space = 1 For Each candidate As tvCandidate In getTitlesToApprove() myList.Add(candidate.toGuiListItem) Next errors += If(errors.Length > 0, "\n", "") lblText.Label = errors + "found:" + myList.Count.ToString + " records" MyBase.OnPageLoad() End Sub Public Sub New() MyBase.New End Sub Public Function PluginName() As String Implements ISetupForm.PluginName Return "TvApprove" End Function Public Function Description() As String Implements ISetupForm.Description Return "TvApprove - Approve selected TVshows for recording." End Function Public Function Author() As String Implements ISetupForm.Author Return "Guy Nash" End Function Public Sub ShowPlugin() Implements ISetupForm.ShowPlugin MessageBox.Show("Nothing to configure, this is just an example") End Sub Public Function CanEnable() As Boolean Implements ISetupForm.CanEnable Return True End Function ' Get Windows-ID Public Function GetWindowId() As Integer Implements ISetupForm.GetWindowId Return _windowID End Function Public Function DefaultEnabled() As Boolean Implements ISetupForm.DefaultEnabled Return True End Function Public Function HasSetup() As Boolean Implements ISetupForm.HasSetup Return False End Function ''' <summary> ''' If the plugin should have it's own button on the main menu of MediaPortal then it ''' should return true to this method, otherwise if it should not be on home ''' it should return false ''' </summary> ''' <param name="strButtonText">text the button should have</param> ''' <param name="strButtonImage">image for the button, or empty for default</param> ''' <param name="strButtonImageFocus">image for the button, or empty for default</param> ''' <param name="strPictureImage">subpicture for the button or empty for none</param> ''' <returns>true : plugin needs it's own button on home ''' false : plugin does not need it's own button on home</returns> Public Function GetHome(ByRef strButtonText As String, ByRef strButtonImage As String, ByRef strButtonImageFocus As String, ByRef strPictureImage As String) As Boolean Implements ISetupForm.GetHome strButtonText = PluginName() strButtonImage = "c:\\programdata\\team mediaportal\\mediaportal\\skin\\Titan\\Media\\hover_my tv.png" strButtonImageFocus = [String].Empty strPictureImage = [String].Empty Return True End Function Public Overrides Function OnMessage(ByVal message As GUIMessage) As Boolean Select Case message.Message Case GUIMessage.MessageType.GUI_MSG_CLICKED If message.SenderControlId = myList.GetID Then If CType(MediaPortal.GUI.Library.Action.ActionType.ACTION_SELECT_ITEM, Integer) = message.Param1 Then Dim item As GUIListItem = myList.SelectedListItem 'MessageBox.Show("msg:" + item.IconImage) item.Selected = item.IconImage.ToLower.EndsWith("checkmark_unchecked.png") item.IconImage = If(item.Selected, "c:\\programdata\\Team MediaPortal\\MediaPortal\\skin\\Titan\\Media\\checkmark_checked.png", "c:\\programdata\\Team MediaPortal\\MediaPortal\\skin\\Titan\\Media\\checkmark_unchecked.png") Return True End If End If Case Else End Select Return MyBase.OnMessage(message) End Function Protected Overrides Sub OnClicked(ByVal controlId As Integer, ByVal control As GUIControl, ByVal actionType As MediaPortal.GUI.Library.Action.ActionType) Select Case controlId Case buttonOne.GetID OnButtonOne() Case myList.GetID Dim item As GUIListItem = myList.SelectedListItem 'MessageBox.Show(item.IconImage) item.Selected = item.IconImage.ToLower.EndsWith("checkmark_unchecked.png") item.IconImage = If(item.Selected, "c:\\programdata\\Team MediaPortal\\MediaPortal\\skin\\Titan\\Media\\checkmark_checked.png", "c:\\programdata\\Team MediaPortal\\MediaPortal\\skin\\Titan\\Media\\checkmark_unchecked.png") Case Else End Select MyBase.OnClicked(controlId, control, actionType) End Sub Private Sub OnButtonOne() myList.Clear() myList.SetTextOffsets(100, 0, 1090, 0, 1100, 0) myList.IconOffsetX = 0 myList.IconOffsetY = 0 myList.Space = 1 For Each candidate As tvCandidate In getTitlesToApprove() myList.Add(candidate.toGuiListItem) Next errors += If(errors.Length > 0, "\r", "") lblText.Label = errors + "found:" + myList.Count.ToString + " records" End Sub Function getTitlesToApprove() As List(Of tvCandidate) Dim result As List(Of tvCandidate) = New List(Of tvCandidate) errors = String.Empty Try Using c0 As SqlClient.SqlConnection = New SqlClient.SqlConnection("server=mediaportalserv;user id=xx;password=xxxxxxxx;database=mptvdb;") c0.Open() Using c1 As SqlClient.SqlCommand = New SqlClient.SqlCommand("select idprogram,series,episode,season,episodenumber,dbchannelid,channel,channeldisplayname,starttime,endtime from tvshowcandidates where starttime > getdate() order by starttime,series,channel desc", c0) Using c2 As SqlClient.SqlDataReader = c1.ExecuteReader If c2.HasRows Then While c2.Read result.Add(New tvCandidate(c2)) End While End If End Using End Using c0.Close() End Using Catch ex As Exception Dim a As tvCandidate = New tvCandidate a.series = ex.Message result.Add(a) errors += "\r" + ex.Message End Try Return result End Function End Class End Namespace [/code] [code] Imports MediaPortal.GUI.Library Imports MediaPortal.Dialogs Public Class tvCandidate Public idprogram As Integer Public series As String Public episode As String Public season As String Public episodenumber As String Public dbchannelid As Integer Public channel As String Public channeldisplayname As String Public starttime As DateTime Public endtime As DateTime Public Sub New() End Sub Public Sub New(ByVal i() As Object) idprogram = i(0) series = i(1) episode = i(2) season = i(3) episodenumber = i(4) dbchannelid = i(5) channel = i(6) channeldisplayname = i(7) starttime = i(8) endtime = i(9) End Sub Public Sub New(ByVal i0 As Integer, ByVal i1 As String, ByVal i2 As String, ByVal i3 As String, ByVal i4 As String, ByVal i5 As Integer, ByVal i6 As String, ByVal i7 As String, ByVal i8 As DateTime, ByVal i9 As DateTime) Me.New({i0, i1, i2, i3, i4, i5, i6, i7, i8, i9}) End Sub Public Sub New(ByVal sqlrdr As SqlClient.SqlDataReader) Dim i() As Object = {New Object, New Object, New Object, New Object, New Object, New Object, New Object, New Object, New Object, New Object, New Object} Dim mydefault() As Object = {-1, String.Empty, String.Empty, String.Empty, String.Empty, -1, String.Empty, String.Empty, Date.MinValue, Date.MinValue} For j = 0 To 9 i(j) = getSQLvalue(sqlrdr, j, mydefault(j)) Next idprogram = i(0) series = i(1) episode = i(2) season = i(3) episodenumber = i(4) dbchannelid = i(5) channel = i(6) channeldisplayname = i(7) starttime = i(8) endtime = i(9) End Sub Private Function getSQLvalue(ByVal r As SqlClient.SqlDataReader, ByVal c As Integer, ByVal empty As Object) As Object Dim result As Object = empty If r.IsDBNull(c) Then Else result = r.GetValue(c) End If Return result End Function Public Function toGuiListItem() As GUIListItem Dim result As GUIListItem = New GUIListItem(starttime.ToString("MM/dd/yyyy hh:mm tt")) result.Label += StrDup(6 - channel.Length, "_") + channel + " " + channeldisplayname result.IconImage = "c:\\programdata\\Team MediaPortal\\MediaPortal\\skin\\Titan\\Media\\checkmark_unchecked.png" result.Label2 = series result.Label3 = season + "." + episodenumber + " " + episode 'AddHandler result.OnItemSelected, New GUIListItem.ItemSelectedHandler(AddressOf myOnItemselected) Return result End Function End Class [/code] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Talk
Guicontrolsdemo ? come out, come out, whereever you are?
Contact us
RSS
Top
Bottom