Imports System.IO Imports System.Text Imports BVSoftware.BVC.Core Public Class AdminProductMenu Inherits System.Web.UI.UserControl #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. Private Sub InitializeComponent() End Sub Protected WithEvents litPlugins As System.Web.UI.WebControls.Literal 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not Page.IsPostBack Then LoadPlugins() End If End Sub Private Sub LoadPlugins() Try Dim physicalPath As String = Request.PhysicalApplicationPath Dim fullPath As String = Path.Combine(physicalPath, "plugins\admin\catalog\") If Directory.Exists(fullPath) = True Then Dim names() As String = Directory.GetFiles(fullPath, "*.ascx") If names.Length > 0 Then AddHeader() For i As Integer = 0 To names.Length - 1 If i Mod 2 = 0 Then AddPlugin(Path.GetFileName(names(i)), False) Else AddPlugin(Path.GetFileName(names(i)), True) End If Next End If End If Catch ex As Exception EventLog.LogEvent(ex) End Try End Sub Private Sub AddHeader() Me.litPlugins.Text = "
" End Sub Private Sub AddPlugin(ByVal moduleName As String, ByVal odd As Boolean) Dim sb As New StringBuilder sb.Append("") If odd = True Then sb.Append("") Else sb.Append("") End If sb.Append("") sb.Append(Path.GetFileNameWithoutExtension(moduleName).Replace("_", " ")) sb.Append("") Me.litPlugins.Text += sb.ToString() End Sub End Class