protected override async Task PerformInternal(CommandParametersModel parameters) { 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.Enable(parameters); } else { await widget.Disable(); } } } else { string overlayName = (string.IsNullOrEmpty(this.OverlayName)) ? ChannelSession.Services.Overlay.DefaultOverlayName : this.OverlayName; IOverlayEndpointService overlay = ChannelSession.Services.Overlay.GetOverlay(overlayName); if (overlay != null) { await overlay.ShowItem(this.OverlayItem, parameters); } } }
public async Task DisableWidget(OverlayWidgetModel widget) { if (widget != null && widget.IsEnabled) { await widget.Disable(); } }
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.Enable(user, arguments, this.extraSpecialIdentifiers); } else { await widget.Disable(); } } } else { string overlayName = (string.IsNullOrEmpty(this.OverlayName)) ? ChannelSession.Services.Overlay.DefaultOverlayName : this.OverlayName; IOverlayEndpointService overlay = ChannelSession.Services.Overlay.GetOverlay(overlayName); if (overlay != null) { await overlay.ShowItem(this.OverlayItem, user, arguments, this.extraSpecialIdentifiers, this.platform); } } }
public async Task DeleteWidget(OverlayWidgetModel widget) { if (widget != null) { await widget.Disable(); ChannelSession.Settings.OverlayWidgets.Remove(widget); await ChannelSession.SaveSettings(); } }
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); } } }