private void ImportMixPlayCommand_Click(object sender, RoutedEventArgs e) { if (this.viewModel.SelectedMixPlayCommand != null) { TwitchChannelPointsCommand command = new TwitchChannelPointsCommand(); command.Actions.AddRange(this.viewModel.SelectedMixPlayCommand.Actions); CommandWindow window = new CommandWindow(new TwitchChannelPointsCommandDetailsControl(command)); window.CommandSaveSuccessfully += Window_CommandSaveSuccessfully; window.Show(); } }
private void CommandButtons_EditClicked(object sender, RoutedEventArgs e) { CommandButtonsControl commandButtonsControl = (CommandButtonsControl)sender; TwitchChannelPointsCommand command = commandButtonsControl.GetCommandFromCommandButtons <TwitchChannelPointsCommand>(sender); if (command != null) { CommandWindow window = new CommandWindow(new TwitchChannelPointsCommandDetailsControl(command)); window.CommandSaveSuccessfully += Window_CommandSaveSuccessfully; window.Show(); } }
private async void CommandButtons_DeleteClicked(object sender, RoutedEventArgs e) { await this.Window.RunAsyncOperation(async() => { CommandButtonsControl commandButtonsControl = (CommandButtonsControl)sender; TwitchChannelPointsCommand command = commandButtonsControl.GetCommandFromCommandButtons <TwitchChannelPointsCommand>(sender); if (command != null) { ChannelSession.Settings.TwitchChannelPointsCommands.Remove(command); await ChannelSession.SaveSettings(); this.viewModel.Refresh(); } }); }
public override async Task <CommandBase> GetNewCommand() { if (await this.Validate()) { if (this.command == null || string.IsNullOrEmpty(this.command.Name)) { this.command = new TwitchChannelPointsCommand(this.NameTextBox.Text); ChannelSession.Settings.TwitchChannelPointsCommands.Add(this.command); } else { this.command.Name = this.NameTextBox.Text; } this.command.Unlocked = this.UnlockedControl.Unlocked; return(this.command); } return(null); }
private async void PubSub_OnChannelPointsRedeemed(object sender, PubSubChannelPointsRedemptionEventModel packet) { PubSubChannelPointsRedeemedEventModel redemption = packet.redemption; UserViewModel user = ChannelSession.Services.User.GetUserByTwitchID(redemption.user.id); if (user == null) { user = new UserViewModel(redemption.user); } List <string> arguments = null; Dictionary <string, string> specialIdentifiers = new Dictionary <string, string>(); specialIdentifiers["rewardname"] = redemption.reward.title; specialIdentifiers["rewardcost"] = redemption.reward.cost.ToString(); if (!string.IsNullOrEmpty(redemption.user_input)) { specialIdentifiers["message"] = redemption.user_input; arguments = new List <string>(redemption.user_input.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)); } EventTrigger trigger = new EventTrigger(EventTypeEnum.TwitchChannelPointsRedeemed, user, specialIdentifiers); trigger.Arguments = arguments; await ChannelSession.Services.Events.PerformEvent(trigger); TwitchChannelPointsCommand command = ChannelSession.Settings.TwitchChannelPointsCommands.FirstOrDefault(c => string.Equals(c.Name, redemption.reward.title, StringComparison.CurrentCultureIgnoreCase)); if (command != null) { await command.Perform(user, arguments : arguments, extraSpecialIdentifiers : specialIdentifiers); } await ChannelSession.Services.Alerts.AddAlert(new AlertChatMessageViewModel(StreamingPlatformTypeEnum.Twitch, user, string.Format("{0} Redeemed {1}", user.Username, redemption.reward.title), ChannelSession.Settings.AlertChannelPointsColor)); }
public TwitchChannelPointsCommandDetailsControl(TwitchChannelPointsCommand command) { this.command = command; InitializeComponent(); }