Table of Contents

Class CountWidgetBase

Namespace
Dynamicweb.Dashboard.Widgets
Assembly
Dynamicweb.Core.dll

The class CountWidget provides base counter dashboard widget

public abstract class CountWidgetBase : DashboardWidget, IParameterOptions
Inheritance
CountWidgetBase
Implements
Derived
Inherited Members

Examples

using Dynamicweb.Dashboard.Widgets;
using Dynamicweb.Extensibility.AddIns;
using System.Diagnostics;

namespace Dynamicweb.Dashboard.Examples;

[AddInName("Application memory usage")]
[AddInDescription("Show current process memory usage information")]
[AddInIcon(Core.UI.Icons.KnownIcon.Dehaze)]
public sealed class MemoryUsageCounter : CountWidgetBase
{
    public MemoryUsageCounter()
    {
        Title = "Memory usage";
        Columns = 2;
    }

    public override string GetCounterNumber()
    {
        Process currentProcess = Process.GetCurrentProcess();
        long totalBytesOfMemoryUsed = currentProcess.WorkingSet64;
        Helper.HumanizeByteSize(totalBytesOfMemoryUsed, out double count, out string subtitle);
        Subtitle = subtitle;

        return string.Format("{0:0.##}", count);
    }
}

Constructors

CountWidgetBase()

The counter widget default constructor

public CountWidgetBase()

Properties

BackgroundColor

Gets or sets counter background color

public WidgetColor BackgroundColor { get; set; }

Property Value

WidgetColor

DefaultBackgroundColor

Gets or sets counter default background color

[AddInLabel("Color")]
[AddInParameter("ColorParameterEditor")]
[AddInParameterEditor(typeof(DropDownParameterEditor), "")]
public virtual WidgetColor DefaultBackgroundColor { get; set; }

Property Value

WidgetColor

Subtitle

Gets or sets counter sub title

public virtual string Subtitle { get; set; }

Property Value

string

Methods

GetCounterNumber()

Gets or sets counter number

public abstract string GetCounterNumber()

Returns

string

GetParameterOptions(string)

Gets parameteroptions

public override IEnumerable<ParameterOption> GetParameterOptions(string parameterName)

Parameters

parameterName string

Returns

IEnumerable<ParameterOption>
To top