Click or drag to resize

DashboardBase Class

The class DashboardBase provides dashboard base functionality with database persistance
Inheritance Hierarchy
SystemObject
  Dynamicweb.DashboardsDashboardBase

Namespace:  Dynamicweb.Dashboards
Assembly:  Dynamicweb.Dashboards (in Dynamicweb.Dashboards.dll) Version: 2.9.4
Syntax
[PartNotDiscoverableAttribute]
public abstract class DashboardBase : IDashboard

The DashboardBase type exposes the following members.

Constructors
  NameDescription
Protected methodDashboardBase
Initializes a new instance of the DashboardBase class
Top
Properties
  NameDescription
Public propertyTitle
Gets or sets the Dashboard title
Public propertyWidgets
Gets or sets collection of widgets to show
Top
Methods
Extension Methods
  NameDescription
Public Extension MethodId
Return Id of the dashboard
(Defined by DashboardExtensions.)
Public Extension MethodIsDashboardReadOnly
Return true if dashboard is read only
(Defined by DashboardExtensions.)
Public Extension MethodIsVisibleOnInsightsPublisher
Return true if dashboard visible on Insights Publisher App
(Defined by DashboardExtensions.)
Top
Remarks
The customer should mark interface implementation with Export" attribute to specify dashboard unique Id. Customer can use Export attribute without parameters in this case class fully qualified name be used as dashboard id. After implementation user dashboard page will be available for backed user by URL:
[site]/Admin/Dashboard/[DashboardId]/View/[path*]
.
Examples
How to inherit DashboardBase
using Dynamicweb.Dashboards.Widgets;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;

namespace Dynamicweb.Dashboards.Examples
{
    [Export(DashboardSystemName)]
    public class SimpleDashboard : DashboardBase
    {
        private const string DashboardSystemName = "MySimple";
        private static readonly IEnumerable<Type> mySpecificWidgetsTypes = new Type[] { typeof(MemoryUsageCounter), typeof(FilesFolderSizes) };

        protected override DashboardConfiguration GetDefault(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                return new DashboardConfiguration()
                {
                    Widgets = new DashboardWidget[] {
                        new MemoryUsageCounter()
                    }
                };
            }
            return new DashboardConfiguration()
            {
                Widgets = new DashboardWidget[] { }
            };
        }

        public override IEnumerable<Type> GetAllAvailableWidgets(string path, IEnumerable<Type> allWidgets)
        {
            if (string.IsNullOrEmpty(path))
            {
                return base.GetAllAvailableWidgets(path, allWidgets);
            }
            return mySpecificWidgetsTypes;            
        }
    }
}
See Also