Centrafuse Logo Flux Logo


HelloWorld.vb

See the Getting Started section for a detailed description of this example.

Imports System
Imports System.Collections
Imports System.Diagnostics
Imports System.Drawing
Imports System.IO
Imports System.Windows.Forms
Imports System.Xml
Imports centrafuse.Plugins

Namespace HelloWorld

    Public Class HelloWorld
        Inherits CFPlugin

#Region "Constants"
        Private Const PluginName As String = "HelloWorld"
        Private Const PluginPath As String = "plugins\" + PluginName + "\"
        Private Const PluginPathSkins As String = PluginPath + "Skins\"
        Private Const PluginPathLanguages As String = PluginPath + "Languages\"
        Private Const PluginPathIcons As String = PluginPath + "Icons\"
        Private Const ConfigurationFile As String = "config.xml"
        Private Const ConfigSection As String = "/APPCONFIG/"
        Private Const LanguageSection As String = "/APPLANG/HELLOWORLD/"
        Private Const LogFile As String = "helloworld.log"
#End Region

#Region "Variables"
        ' we write the log to the appropriate users local appdata directory in the Plugins subfolder...
        Public LogFilePath As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\Plugins\\" + PluginName + "\\" + LogFile

        Private Const ImageFolderIndex As Integer = 0
        Private Const ImageEmptyIndex As Integer = 1

        Private language As String = Nothing
        Private atLevel As Integer = 0
        Private listImages As ArrayList
#End Region

#Region "Construction"
        ''' <summary>
        ''' Default constructor (creates the plugin and sets its properties).
        ''' </summary>
        Public Sub New()

            ' When set to true all system audio will be paused when the plugin is shown.  The main title,
            ' position,and status labels will be cleared and can be populated by the plugin.
            Me.CF_pluginPauseAudioFlag = False

            ' The plugin name should have a matching section in the skin.xml file.
            Me.CF_pluginName = "HELLOWORLD"

            ' Sets the plugin to be a GUI plugin.  Only GUI plugins are available button actions.
            Me.CF_pluginIsGUI = True

            ' Set Settings flags, show in basic settings and advanced settings
            Me.CF_pluginHasSettings = True
            Me.CF_pluginHasBasicSettings = True

            ' Create XML Configuration if not exists
            AddConfigXml()

        End Sub

        ''' <summary>
        ''' Creates the config.xml file if it doesnt exist
        ''' </summary>
        Private Sub AddConfigXml()
            Try
                Dim configXmlPath As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile
                ' Create applicationdata folder if doesn't exist
                If Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\Plugins\\" + PluginName) = False Then
                    Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\Plugins\\" + PluginName)
                End If
                ' Create config.xml file if doesn't exist
                If File.Exists(configXmlPath) = False Then
                    Dim fs As FileStream = New FileStream(configXmlPath, FileMode.Create, FileAccess.Write, FileShare.Write)
                    fs.Close()
                    Dim sw As StreamWriter = New StreamWriter(configXmlPath, False, System.Text.Encoding.ASCII)
                    sw.Write("<APPCONFIG>" + vbCrLf + "    <SKIN>Aura</SKIN>" + vbCrLf + "    <APPLANG>English</APPLANG>" + vbCrLf + "    <LOGEVENTS>False</LOGEVENTS>" + vbCrLf + "</APPCONFIG>" + vbCrLf)
                    sw.Close()
                End If
            Catch errmsg As Exception
                CFTools.writeError(errmsg.Message, errmsg.StackTrace)
            End Try
            Return
        End Sub

#End Region

        Private Sub WriteLog(ByVal msg As String)
            Try
                If (Boolean.Parse(Me.pluginConfig.readPluginField("/APPCONFIG/LOGEVENTS"))) Then
                    CFTools.writeModuleLog(msg, LogFilePath)
                End If
            Catch
            End Try
        End Sub

#Region "CFPlugin methods"
        ''' <summary>
        ''' Initializes the plugin.  This is called from the main application
        ''' when the plugin is first loaded.
        ''' </summary>
        Public Overrides Sub CF_pluginInit()

            Try
                ' loads Settings
                LoadSettings()

                ' Note CF_loadConfig() must be called before WriteLog() can be used
                WriteLog("CF_pluginInit")

                ' add event handlers for keyboard and power mode change
                AddHandler Me.CF_Event_powerModeChanged, AddressOf HelloWorld_CF_Event_powerModeChanged
                AddHandler Me.KeyDown, AddressOf HelloWorld_KeyDown

            Catch errmsg As Exception
                WriteLog(errmsg.ToString())
            End Try
        End Sub

        ''' <summary>
        ''' This is called to setup the skin.  This will usually be called
        ''' in CF_pluginInit.  It will also called by the system when
        ''' the resolution has been changed.
        ''' </summary>
        Public Overrides Sub CF_localskinsetup()

            WriteLog("CF_localskinsetup")
            Try
                ' Clears all control arrays.  Should always be in
                ' CF_localskinsetup so the plugin will properly
                ' reset when the resolution changes.
                Me.CF_clearControls()

                ' Initializes the skin with the specified skin file path, if it exists.
                ' Otherwise load the default skin.
                Dim path As String = PluginPathSkins + Me.currentSkin
                Me.CF_initSkin(path + "\skin.xml")

                ' Loads the skin images.
                Me.CF_loadImages(path + "\HelloWorld_off.png", path + "\HelloWorld_down.png")
                ScalePlugin()

                ' create labels 
                Me.CF_createLabel("LBLHEADER")
                Me.CF_updateText("LBLHEADER", Me.pluginLang.readPluginField("/APPLANG/HELLOWORLD/LBLHEADER"))
                Me.CF_createLabel("LBLTEXT")
                Me.CF_updateText("LBLTEXT", Me.pluginLang.readPluginField("/APPLANG/HELLOWORLD/LBLTEXT1"))

                ' create buttons
                Me.CF_createButton("BTN1", Me.pluginLang.readPluginField("/APPLANG/HELLOWORLD/BTN1"), AddressOf BTN1_Click)
                Me.CF_createButton("BTN2", Me.pluginLang.readPluginField("/APPLANG/HELLOWORLD/BTN2"), AddressOf BTN2_Click)
                Me.CF_createButton("BTN3", Me.pluginLang.readPluginField("/APPLANG/HELLOWORLD/BTN3"), AddressOf BTN3_Click)
                Me.CF_createButton("BTN4", Me.pluginLang.readPluginField("/APPLANG/HELLOWORLD/BTN4"), AddressOf BTN4_Click)
                Me.CF_createButton("BTN5", Me.pluginLang.readPluginField("/APPLANG/HELLOWORLD/BTN5"), AddressOf BTN5_Click)
                Me.CF_createButton("BTN6", Me.pluginLang.readPluginField("/APPLANG/HELLOWORLD/BTN6"), AddressOf BTN6_Click)

            Catch errmsg As Exception
                WriteLog(errmsg.ToString())
            End Try
        End Sub

        ''' <summary>
        ''' This is called by the system when it exits
        ''' or the plugin has been deleted.
        ''' </summary>
        Public Overrides Sub CF_pluginClose()

            WriteLog("CF_pluginClose")
            ' disposes the plugin.
            Me.Dispose()
        End Sub

        ''' <summary>
        ''' This is called by the system when a button
        ''' with this plugin action has been clicked.
        ''' </summary>
        Public Overrides Sub CF_pluginShow()

            WriteLog("CF_pluginShow")

            ' Shows the plugin and selects the listbox.
            Me.Visible = True

            ' If your plugin has a listbos, it's a good idea to give the focus to it when
            ' the plugin shows up. To do so, remove the comment and replace the $LISTBOX-NAME$
            ' with the name of your listbox.
            '$LISTBOX-NAME$.Focus()
        End Sub

        ''' <summary>
        ''' This is called by the system when the
        ''' language has changed.
        ''' </summary>
        ''' <param name="lang">The new language to set.</param>
        ''' <param name="skin">The new skin to set.</param>
        Public Overrides Sub CF_pluginUpdateLanguageSkin(ByVal lang As String, ByVal skin As String)

            WriteLog("CF_pluginUpdateLanguageSkin")
            Me.language = lang

            ' Update plugin config with global cf language
            If File.Exists(PluginPathLanguages + language + ".xml") Then
                Dim configxml As XmlDocument = New XmlDocument()
                configxml.Load(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile)
                configxml.SelectSingleNode("/APPCONFIG/APPLANG").InnerText = System.Web.HttpUtility.HtmlEncode(language)
                configxml.Save(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile)
            End If

            ' Update plugin config with global cf skin
            If Directory.Exists(PluginPathSkins + skin) Then
                Dim configxml As XmlDocument = New XmlDocument()
                configxml.Load(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile)
                configxml.SelectSingleNode("/APPCONFIG/SKIN").InnerText = System.Web.HttpUtility.HtmlEncode(skin)
                configxml.Save(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile)
            End If

            LoadSettings()
        End Sub

        ''' <summary>
        ''' This is called by the system when the
        ''' plugin setup is clicked.
        ''' </summary>
        ''' <returns>Returns the dialog result.</returns>
        Public Overrides Function CF_pluginShowSetup() As DialogResult

            WriteLog("CF_pluginShowSetup")

            ' Return DialogResult.OK for the main application
            ' to update from plugin changes.
            Dim returnvalue As DialogResult = DialogResult.Cancel

            Try

                ' Creates a new plugin setup instance. If you create a CFDialog or CFSetup you must
                ' set its MainForm property to the main plugins MainForm property.
                Dim setup As Setup = New Setup()
                setup.MainForm = Me.MainForm
                setup.SetupSection()
                returnvalue = setup.ShowDialog()
                If returnvalue = DialogResult.OK Then

                    ' add code here for saving the modified settings

                    LoadSettings() ' reload settings
                End If
                setup.Close()
                setup = Nothing
            Catch errmsg As Exception
                WriteLog(errmsg.ToString())
            End Try

            Return returnvalue
        End Function

        ''' <summary>
        ''' This method is called by the system when it
        ''' pauses all audio.
        ''' </summary>
        Public Overrides Sub CF_pluginPause()

            WriteLog("CF_pluginPause")
        End Sub

        ''' <summary>
        ''' This is called by the system when it
        ''' resumes all audio.
        ''' </summary>
        Public Overrides Sub CF_pluginResume()

            WriteLog("CF_pluginResume")
        End Sub

        ''' <summary>
        ''' Used for plugin to plugin communication.
        ''' Parameters can be passed into CF_Main_systemCommands
        ''' with CF_Actions.PLUGIN, plugin name, plugin command,
        ''' and a command parameter.
        ''' </summary>
        ''' <param name="command">The command to execute.</param>
        ''' <param name="param1">The first parameter.</param>
        ''' <param name="param2">The second parameter.</param>
        Public Overrides Sub CF_pluginCommand(ByVal command As String, ByVal param1 As String, ByVal param2 As String)

            WriteLog("CF_pluginCommand: " + command + " " + param1 + ", " + param2)
        End Sub

        ''' <summary>
        ''' Used for retrieving information from plugins.
        ''' You can run CF_getPluginData with a plugin name,
        '''     command, and parameter to retrieve information
        '''     from other plugins running on the system.
        ''' </summary>
        ''' <param name="command">The command to execute.</param>
        ''' <param name="param">The parameter.</param>
        ''' <returns>Returns whatever is appropriate.</returns>
        Public Overrides Function CF_pluginData(ByVal command As String, ByVal param As String) As String

            WriteLog("CF_pluginData: " + command + " " + param)
            Dim returnValue As String = ""
            Return returnValue
        End Function

#End Region

#Region "System Functions"
        ''' <summary>
        ''' Reloads the plugin settings.
        ''' </summary>
        Public Sub LoadSettings()

            ' Loads the plugin configuration from the specified path. 
            Me.CF_loadConfig(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile)

            ' Call writeModuleLog() with the string startup() to keep only last 2 runtimes...
            ' Note CF_loadConfig() must be called before WriteLog() can be used
            WriteLog("startup")
            WriteLog("Loading settings for: HelloWorld")

            ' Check if the skin matches the main application.  If it does not match and it does exist then change
            ' the skin to matcht he main application.
            If Me.CF_getConfigSetting(CF_ConfigSettings.Skin).Trim().ToUpper() <> Me.pluginConfig.readPluginField("/APPCONFIG/SKIN").Trim().ToUpper() Then
                If Directory.Exists(PluginPathSkins + Me.CF_getConfigSetting(CF_ConfigSettings.Skin)) Then
                    Dim configxml As XmlDocument = New XmlDocument()
                    configxml.Load(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile)
                    configxml.SelectSingleNode("/APPCONFIG/SKIN").InnerText = System.Web.HttpUtility.HtmlEncode(Me.CF_getConfigSetting(CF_ConfigSettings.Skin))
                    configxml.Save(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile)
                ElseIf Directory.Exists(PluginPathSkins + Me.pluginConfig.readPluginField("/APPCONFIG/SKIN")) = False Then
                    Dim configxml As XmlDocument = New XmlDocument()
                    configxml.Load(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile)
                    configxml.SelectSingleNode("/APPCONFIG/SKIN").InnerText = System.Web.HttpUtility.HtmlEncode("Onyx WS Night")
                    configxml.Save(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile)
                End If

                Me.CF_loadConfig(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile)

            ElseIf Directory.Exists(PluginPathSkins + Me.pluginConfig.readPluginField("/APPCONFIG/SKIN")) = False Then
                Dim configxml As XmlDocument = New XmlDocument()
                configxml.Load(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile)
                configxml.SelectSingleNode("/APPCONFIG/SKIN").InnerText = System.Web.HttpUtility.HtmlEncode("Onyx WS Night")
                configxml.Save(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile)

                Me.CF_loadConfig(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile)
            End If

            Me.currentSkin = Me.pluginConfig.readPluginField("/APPCONFIG/SKIN")

            ' Loads the plugin language file from the specified path. This is loaded using the language specified 
            ' in the configuration file.
            If Me.CF_getConfigSetting(CF_ConfigSettings.Language).Trim().ToUpper() <> Me.pluginConfig.readPluginField("/APPCONFIG/APPLANG").Trim().ToUpper() Then
                If File.Exists(PluginPathLanguages + Me.CF_getConfigSetting(CF_ConfigSettings.Language) + ".xml") Then
                    Dim configxml As XmlDocument = New XmlDocument()
                    configxml.Load(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile)
                    configxml.SelectSingleNode("/APPCONFIG/APPLANG").InnerText = System.Web.HttpUtility.HtmlEncode(Me.CF_getConfigSetting(CF_ConfigSettings.Language))
                    configxml.Save(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile)
                ElseIf File.Exists(PluginPathLanguages + Me.pluginConfig.readPluginField("/APPCONFIG/APPLANG") + ".xml") = False Then
                    Dim configxml As XmlDocument = New XmlDocument()
                    configxml.Load(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile)
                    configxml.SelectSingleNode("/APPCONFIG/APPLANG").InnerText = System.Web.HttpUtility.HtmlEncode("English")
                    configxml.Save(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile)
                End If

                Me.CF_loadConfig(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile)
            ElseIf File.Exists(PluginPathLanguages + Me.pluginConfig.readPluginField("/APPCONFIG/APPLANG") + ".xml") = False Then
                Dim configxml As XmlDocument = New XmlDocument()
                configxml.Load(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile)
                configxml.SelectSingleNode("/APPCONFIG/APPLANG").InnerText = System.Web.HttpUtility.HtmlEncode("English")
                configxml.Save(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile)

                Me.CF_loadConfig(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Centrafuse\\" + PluginPath + ConfigurationFile)
            End If

            Me.CF_loadLang(PluginPathLanguages + Me.pluginConfig.readPluginField("/APPCONFIG/APPLANG") + ".xml")

            ' The display name is shown in the application to represent
            ' the plugin.  This sets the display name from the configuration file.
            Me.CF_pluginDisplayName = TranslateText("DISPLAYNAME")

            ' All controls should be created or Setup in CF_localskinsetup.
            ' This method is also called when the resolution or skin has changed.
            Me.CF_localskinsetup()
        End Sub

        ''' <summary>
        ''' Reads a text from the plugin specific language file.
        ''' </summary>
        ''' <param name="text">The text (tag) to be read.</param>
        ''' <returns>Returns the text (reformated) if found or the tag name by default.</returns>
        Private Function TranslateText(ByVal text As String) As String

            Dim langread As String = Me.pluginLang.readPluginField(LanguageSection + text)

            If langread = "" Then
                Return text
            Else
                Return langread.Replace("\\n", "\n")
            End If
        End Function

        ''' <summary>
        ''' Scales the plugin according to the current CF size.
        ''' </summary>
        Private Sub ScalePlugin()

            WriteLog("ScalePlugin")
            Try
                Dim appWidth As Integer = Int32.Parse(pluginSkinReader.readPluginField(screenpath + "/WIDTH")) * pluginSkinReader.skinWidthRatio
                Dim appHeight As Integer = Int32.Parse(pluginSkinReader.readPluginField(screenpath + "/HEIGHT")) * pluginSkinReader.skinHeightRatio
                Dim cfWidth As Integer = Int32.Parse(Me.CF_getConfigSetting(CF_ConfigSettings.Width))
                Dim cfHeight As Integer = Int32.Parse(Me.CF_getConfigSetting(CF_ConfigSettings.Height))
                Dim cfXpos As Integer = Int32.Parse(Me.CF_getConfigSetting(CF_ConfigSettings.XPosition))
                Dim cfYpos As Integer = Int32.Parse(Me.CF_getConfigSetting(CF_ConfigSettings.YPosition))

                Dim x As Integer = (cfWidth - appWidth) / 2 + cfXpos + Screen.AllScreens(Me.pluginDisplay - 1).Bounds.X
                Dim y As Integer = (cfHeight - appHeight) / 2 + cfYpos + Screen.AllScreens(Me.pluginDisplay - 1).Bounds.Y

                Me.Bounds = New Rectangle(x, y, appWidth, appHeight)
            Catch errmsg As Exception
                WriteLog(errmsg.ToString())
            End Try
        End Sub

#End Region

#Region "Click Events"

        Private Sub BTN1_Click(ByVal sender As Object, ByVal e As MouseEventArgs)
            ' The Button #1 has been clicked...
            WriteLog("BTNHELLO clicked.")
            Try
                ' Update the text of the bottom on-screen label
                Me.CF_updateText("LBLTEXT", Me.pluginLang.readPluginField("/APPLANG/HELLOWORLD/LBLTEXT1"))
            Catch errmsg As Exception
                WriteLog(errmsg.ToString())
            End Try
        End Sub

        Private Sub BTN2_Click(ByVal sender As Object, ByVal e As MouseEventArgs)
            ' The Button #1 has been clicked...
            WriteLog("BTNHELLO clicked.")
            Try
                ' Update the text of the bottom on-screen label
                Me.CF_updateText("LBLTEXT", Me.pluginLang.readPluginField("/APPLANG/HELLOWORLD/LBLTEXT2"))
            Catch errmsg As Exception
                WriteLog(errmsg.ToString())
            End Try
        End Sub

        Private Sub BTN3_Click(ByVal sender As Object, ByVal e As MouseEventArgs)
            ' The Button #1 has been clicked...
            WriteLog("BTNHELLO clicked.")
            Try
                Dim song As String = ""
                ' Emit CF action to retrieve the name of the current song playing
                song = CF_systemGetText(CF_TextItems.CurrentTitle)
                ' You could also retrieve artist, album, etc...
                ' CF_getText(CF_TextItems.CurrentArtist) 
                ' CF_getText(CF_TextItems.CurrentAlbum)
                ' Update the text of the bottom on-screen label
                ' Update the text of the bottom on-screen label
                Me.CF_updateText("LBLTEXT", song)
            Catch errmsg As Exception
                WriteLog(errmsg.ToString())
            End Try
        End Sub

        Private Sub BTN4_Click(ByVal sender As Object, ByVal e As MouseEventArgs)
            ' The Button #1 has been clicked...
            WriteLog("BTNHELLO clicked.")
            Try
                ' Display an ok box that will make the user confirm a message
                Me.CF_systemDisplayDialog(CF_Dialogs.OkBox, "This is an OK box")
            Catch errmsg As Exception
                WriteLog(errmsg.ToString())
            End Try
        End Sub

        Private Sub BTN5_Click(ByVal sender As Object, ByVal e As MouseEventArgs)
            ' The Button #1 has been clicked...
            WriteLog("BTNHELLO clicked.")
            Try
                ' Update the text of the bottom on-screen label
                Me.CF_updateText("LBLTEXT", Me.pluginLang.readPluginField("/APPLANG/HELLOWORLD/LBLTEXT1"))
            Catch errmsg As Exception
                WriteLog(errmsg.ToString())
            End Try
        End Sub

        Private Sub BTN6_Click(ByVal sender As Object, ByVal e As MouseEventArgs)
            ' The Button #1 has been clicked...
            WriteLog("BTNHELLO clicked.")
            Try
                ' Update the text to what user enters in osk
                Dim tempobject As Object = New Object
                Dim resultvalue As String = "", resulttext As String = ""
                If (Me.CF_systemDisplayDialog(CF_Dialogs.OSK, Me.pluginLang.readPluginField("/APPLANG/HELLOWORLD/ENTERTEXT"), "", Nothing, resultvalue, resulttext, tempobject, Nothing, True, True, True, True, False, False, 1) = DialogResult.OK) Then
                    Me.CF_updateText("LBLTEXT", resultvalue)
                End If
            Catch errmsg As Exception
                WriteLog(errmsg.ToString())
            End Try
        End Sub

#End Region

#Region "Other events"
        Private Sub HelloWorld_CF_Event_powerModeChanged(ByVal sender As Object, ByVal e As Microsoft.Win32.PowerModeChangedEventArgs)

        End Sub

        ' If the plugin uses back/forward buttons, we need to catch the left/right keyboard commands too...
        Private Sub HelloWorld_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
            e.Handled = True

            If e.KeyCode = Keys.Left Then
                '---------------------------------------------------------------------------
                ' TODO: replace this if needed
                '--------------------------------------------------------------------------- 
                ' Me.back_Click(Me, New MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0))
            ElseIf e.KeyCode = Keys.Right Then
                '---------------------------------------------------------------------------
                ' TODO: replace this if needed
                '--------------------------------------------------------------------------- 
                ' Me.forward_Click(Me, New MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0))
            End If
        End Sub
#End Region

    End Class

End Namespace




Copyright © 2008 Flux Media, Inc. (U.S. Copyright Registration Number: TXu-1-239-794) Flux Logo