/Source Code/Plugins/TestProjectionPlugin/TestProjectionPlugin.vb
Visual Basic | 103 lines | 54 code | 21 blank | 28 comment | 0 complexity | f139dbc406ed2c65d370c0eb813a729b MD5 | raw file
- Imports PluginSupport
- Imports System.Drawing
-
- ''' <summary>
- ''' Test Projection plugin.
- ''' </summary>
- Public Class TestProjectionPlugin
- Implements PluginSupport.IPlugin
-
- Private FContext As PluginContextBase = Nothing
- Private FMenuItem As System.Windows.Forms.ToolStripItem = Nothing
- Private FTicksLeft As Integer = -1
-
- #Region " Plugin Interface Methods "
-
- ''' <summary>
- ''' Returns the name of the plugin.
- ''' </summary>
- Public ReadOnly Property Name() As String Implements IPlugin.Name
- Get
- Return "Test Projection Plug In"
- End Get
- End Property
-
- Public ReadOnly Property Description() As String Implements PluginSupport.IPlugin.Description
- Get
- Return "Shows a changing screen that allows users to test whether or not projection is working."
- End Get
- End Property
-
- ''' <summary>
- ''' Returns the name of the author of the plugin.
- ''' </summary>
- Public ReadOnly Property Author() As String Implements IPlugin.Author
- Get
- Return "Nicholas Hill"
- End Get
- End Property
-
- ''' <summary>
- ''' Called when the plugin is initialised.
- ''' Use this method to store the given context so that it can be used later.
- ''' </summary>
- ''' <param name="context">An object by which communication is possible to PowerSong.</param>
- Public Sub Initialise(ByVal context As PluginSupport.PluginContextBase) Implements IPlugin.Initialise
- FContext = context
- End Sub
-
- ''' <summary>
- ''' Called when the plugin is installed into a database.
- ''' </summary>
- Public Sub Install() Implements IPlugin.Install
- End Sub
-
- ''' <summary>
- ''' Called when the plugin is uninstalled from a database.
- ''' </summary>
- Public Sub Uninstall() Implements IPlugin.Uninstall
- End Sub
-
- ''' <summary>
- ''' Called when the PowerSong program opens the database containing the plugin.
- ''' </summary>
- ''' <remarks></remarks>
- Public Sub Start() Implements PluginSupport.IPlugin.Start
- FMenuItem = FContext.AddSubMenuItem(PluginContextBase.EMainMenuItem.Tools, "&Stop Projection Test", New EventHandler(AddressOf StopColourCycling_Click))
- End Sub
-
- ''' <summary>
- ''' Called when the PowerSong program closes the database containing the plugin.
- ''' </summary>
- ''' <remarks></remarks>
- Public Sub [Stop]() Implements PluginSupport.IPlugin.Stop
- If FMenuItem IsNot Nothing Then FMenuItem.Dispose()
- End Sub
-
- #End Region
-
- Private Sub StopColourCycling_Click()
- FTicksLeft = 60
- End Sub
-
- Private FTick As Integer = -1
-
- Public Sub Project(ByVal graphics As System.Drawing.Graphics, ByVal width As Integer, ByVal height As Integer) Implements PluginSupport.IPlugin.Project
-
- If FTicksLeft = 0 Then Exit Sub
-
- FTick += 1
- If FTicksLeft > 0 Then FTicksLeft -= 1
-
- Dim A As Double = 1
- If FTicksLeft > 0 Then A = FTicksLeft / 60
- Dim R As Double = Math.Sin(FTick / 100)
- Dim G As Double = Math.Cos(FTick / 70)
- Dim B As Double = Math.Sin(FTick / 50)
-
- Dim C As Color = Color.FromArgb(255 * A, 255 * ((R + 1) / 2), 255 * ((G + 1) / 2), 255 * ((B + 1) / 2))
- graphics.FillRectangle(New SolidBrush(C), 0, 0, width, height)
-
- End Sub
-
- End Class