/// <summary> /// Set a widget to an item /// </summary> public void SetWidget(DashboardWidget widget) { _widget = widget; WidgetGUID = _widget.GUID; if (string.IsNullOrEmpty(Name)) { Name = _widget.Name; } if (string.IsNullOrEmpty(Icon)) { Icon = _widget.Icon; } if (string.IsNullOrEmpty(Color)) { Color = _widget.Color; } if (Width == -1) { Width = _widget.Width; } if (Height == -1) { Height = _widget.Height; } if (Dynamic == null) { Dynamic = _widget.Dynamic; } if (Refresh == -2) { Refresh = _widget.Refresh; } }
/// <summary> /// True if the widget can be selected /// </summary> public bool CanSelectWidget(DashboardWidget item) { return(!ForbiddenWidgets.Exists(i => (string.IsNullOrEmpty(i.ReportName) || i.ReportName == item.ReportName) && (string.IsNullOrEmpty(i.Tag) || i.Tag == item.Tag) && (string.IsNullOrEmpty(i.Name) || i.Name == item.Name) )); }