Exemple #1
0
    /// <summary>
    /// Fills assembly selector with data.
    /// </summary>
    private void FillAssemblySelector()
    {
        if (AllowEmpty)
        {
            drpAssemblyName.DropDownList.Items.Add(noneValue);
        }

        var classes = ClassHelper.GetClasses(ClassHelper.ASSEMBLY_APPCODE, Settings);

        if ((classes != null) && (classes.Count > 0))
        {
            drpAssemblyName.DropDownList.Items.Add(customClassString);
        }

        // Get assembly names filtered by given restriction settings
        var assemblies = ClassHelper.GetAssemblyNames(AssembliesFilter, Settings)
                         // Web site App_Code assembly are not supported. Custom class must be used instead
                         .Where(assemblyName => !assemblyName.StartsWith(APPCODE_PREFIX, StringComparison.OrdinalIgnoreCase));

        // Fill assemblies list
        foreach (string assemblyName in assemblies)
        {
            drpAssemblyName.DropDownList.Items.Add(assemblyName);
        }

        // Include macro value if specified
        if (!String.IsNullOrEmpty(AssemblyName) && MacroProcessor.ContainsMacro(AssemblyName))
        {
            drpAssemblyName.DropDownList.Items.Insert(0, AssemblyName);
        }

        // Clear selected value if drop down is empty
        if (drpAssemblyName.DropDownList.Items.Count == 0)
        {
            drpAssemblyName.SelectedValue = String.Empty;
        }
        else
        {
            // Select first item if nothing was selected
            if (drpAssemblyName.SelectedIndex < 0 && String.IsNullOrEmpty(drpAssemblyName.SelectedValue))
            {
                drpAssemblyName.SelectedIndex = 0;
            }
        }
    }
Exemple #2
0
    /// <summary>
    /// Fills assembly selector with data.
    /// </summary>
    private void FillAssemblySelector()
    {
        if (AllowEmpty)
        {
            drpAssemblyName.DropDownList.Items.Add(noneValue);
        }

        var classes = ClassHelper.GetClasses(ClassHelper.ASSEMBLY_APPCODE, Settings);

        if ((classes != null) && (classes.Count > 0))
        {
            drpAssemblyName.DropDownList.Items.Add(customClassString);
        }

        // Get assembly names filtered by given restriction settings
        var assemblies = ClassHelper.GetAssemblyNames(AssembliesFilter, Settings);

        // Fill assemblies list
        foreach (string assemblyName in assemblies)
        {
            drpAssemblyName.DropDownList.Items.Add(assemblyName);
        }

        // Include macro value if specified
        if (!String.IsNullOrEmpty(AssemblyName) && MacroProcessor.ContainsMacro(AssemblyName))
        {
            drpAssemblyName.DropDownList.Items.Insert(0, AssemblyName);
        }

        // Clear selected value if drop down is empty
        if (drpAssemblyName.DropDownList.Items.Count == 0)
        {
            drpAssemblyName.SelectedValue = String.Empty;
        }
        else
        {
            // Select first item if nothing was selected
            if (drpAssemblyName.SelectedIndex < 0 && String.IsNullOrEmpty(drpAssemblyName.SelectedValue))
            {
                drpAssemblyName.SelectedIndex = 0;
            }
        }
    }