public async Task EnableWidget(OverlayWidgetModel widget) { if (widget != null && !widget.IsEnabled) { await widget.Initialize(); } }
protected override async Task PerformInternal(UserViewModel user, IEnumerable <string> arguments) { if (this.WidgetID != Guid.Empty) { OverlayWidgetModel widget = ChannelSession.Settings.OverlayWidgets.FirstOrDefault(w => w.Item.ID.Equals(this.WidgetID)); if (widget != null) { if (this.ShowWidget) { await widget.Initialize(user, arguments, this.extraSpecialIdentifiers); } else { await widget.Disable(); } } } else { #pragma warning disable CS0612 // Type or member is obsolete if (this.Item != null) { StoreCommandUpgrader.RestructureNewerOverlayActions(new List <ActionBase>() { this }); } #pragma warning restore CS0612 // Type or member is obsolete string overlayName = (string.IsNullOrEmpty(this.OverlayName)) ? ChannelSession.Services.OverlayServers.DefaultOverlayName : this.OverlayName; IOverlayService overlay = ChannelSession.Services.OverlayServers.GetOverlay(overlayName); if (overlay != null) { await overlay.ShowItem(this.OverlayItem, user, arguments, this.extraSpecialIdentifiers); } } }