public CurrencyAction(UserCurrencyViewModel currency, CurrencyActionTypeEnum currencyActionType, string amount, string username, bool deductFromUser) : this() { this.CurrencyID = currency.ID; this.CurrencyActionType = currencyActionType; this.Amount = amount; this.Username = username; this.DeductFromUser = deductFromUser; }
private void CurrencyActionTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (this.CurrencyActionTypeComboBox.SelectedIndex >= 0) { CurrencyActionTypeEnum actionType = EnumHelper.GetEnumValueFromString <CurrencyActionTypeEnum>((string)this.CurrencyActionTypeComboBox.SelectedItem); this.GiveToGrid.Visibility = (actionType == CurrencyActionTypeEnum.GiveToSpecificUser || actionType == CurrencyActionTypeEnum.GiveToAllChatUsers) ? Visibility.Visible : Visibility.Collapsed; this.CurrencyUsernameTextBox.Visibility = (actionType == CurrencyActionTypeEnum.GiveToSpecificUser) ? Visibility.Visible : Visibility.Collapsed; } }
public override ActionBase GetAction() { if (this.CurrencyTypeComboBox.SelectedIndex >= 0 && this.CurrencyActionTypeComboBox.SelectedIndex >= 0) { CurrencyModel currency = this.GetSelectedCurrency(); InventoryModel inventory = this.GetSelectedInventory(); StreamPassModel streamPass = this.GetSelectedStreamPass(); CurrencyActionTypeEnum actionType = (CurrencyActionTypeEnum)this.CurrencyActionTypeComboBox.SelectedItem; if (actionType == CurrencyActionTypeEnum.ResetForAllUsers || actionType == CurrencyActionTypeEnum.ResetForUser || !string.IsNullOrEmpty(this.CurrencyAmountTextBox.Text)) { if (actionType == CurrencyActionTypeEnum.AddToSpecificUser) { if (string.IsNullOrEmpty(this.CurrencyUsernameTextBox.Text)) { return(null); } } UserRoleEnum roleRequirement = UserRoleEnum.User; if (actionType == CurrencyActionTypeEnum.AddToAllChatUsers || actionType == CurrencyActionTypeEnum.SubtractFromAllChatUsers) { if (this.CurrencyPermissionsAllowedComboBox.SelectedIndex < 0) { return(null); } roleRequirement = (UserRoleEnum)this.CurrencyPermissionsAllowedComboBox.SelectedItem; } if (currency != null) { return(new CurrencyAction(currency, actionType, this.CurrencyAmountTextBox.Text, username: this.CurrencyUsernameTextBox.Text, roleRequirement: roleRequirement, deductFromUser: this.DeductFromUserToggleButton.IsChecked.GetValueOrDefault())); } else if (inventory != null) { if (actionType == CurrencyActionTypeEnum.ResetForAllUsers || actionType == CurrencyActionTypeEnum.ResetForUser) { return(new CurrencyAction(inventory, actionType)); } else if (!string.IsNullOrEmpty(this.InventoryItemNameComboBox.Text)) { return(new CurrencyAction(inventory, actionType, this.InventoryItemNameComboBox.Text, this.CurrencyAmountTextBox.Text, username: this.CurrencyUsernameTextBox.Text, roleRequirement: roleRequirement, deductFromUser: this.DeductFromUserToggleButton.IsChecked.GetValueOrDefault())); } } else if (streamPass != null) { return(new CurrencyAction(streamPass, actionType, this.CurrencyAmountTextBox.Text, username: this.CurrencyUsernameTextBox.Text, roleRequirement: roleRequirement, deductFromUser: this.DeductFromUserToggleButton.IsChecked.GetValueOrDefault())); } } } return(null); }
public CurrencyAction(UserCurrencyViewModel currency, CurrencyActionTypeEnum currencyActionType, string amount, string username = null, MixerRoleEnum roleRequirement = MixerRoleEnum.User, bool deductFromUser = false) : this() { this.CurrencyID = currency.ID; this.CurrencyActionType = currencyActionType; this.Amount = amount; this.Username = username; this.RoleRequirement = roleRequirement; this.DeductFromUser = deductFromUser; }
public CurrencyAction(StreamPassModel streamPass, CurrencyActionTypeEnum currencyActionType, string amount, string username = null, UserRoleEnum roleRequirement = UserRoleEnum.User, bool deductFromUser = false) : this() { this.StreamPassID = streamPass.ID; this.CurrencyActionType = currencyActionType; this.Amount = amount; this.Username = username; this.RoleRequirement = roleRequirement; this.DeductFromUser = deductFromUser; }
public CurrencyAction(UserInventoryViewModel inventory, CurrencyActionTypeEnum currencyActionType, string itemName = null, string amount = null, string username = null, MixerRoleEnum roleRequirement = MixerRoleEnum.User, bool deductFromUser = false) : this() { this.InventoryID = inventory.ID; this.CurrencyActionType = currencyActionType; this.ItemName = itemName; this.Amount = amount; this.Username = username; this.RoleRequirement = roleRequirement; this.DeductFromUser = deductFromUser; }
public override ActionBase GetAction() { if (this.CurrencyTypeComboBox.SelectedIndex >= 0 && this.CurrencyActionTypeComboBox.SelectedIndex >= 0 && !string.IsNullOrEmpty(this.CurrencyAmountTextBox.Text)) { UserCurrencyViewModel currency = (UserCurrencyViewModel)this.CurrencyTypeComboBox.SelectedItem; CurrencyActionTypeEnum actionType = EnumHelper.GetEnumValueFromString <CurrencyActionTypeEnum>((string)this.CurrencyActionTypeComboBox.SelectedItem); if (actionType == CurrencyActionTypeEnum.GiveToSpecificUser) { if (string.IsNullOrEmpty(this.CurrencyUsernameTextBox.Text)) { return(null); } } return(new CurrencyAction(currency, actionType, this.CurrencyAmountTextBox.Text, this.CurrencyUsernameTextBox.Text, this.DeductFromUserToggleButton.IsChecked.GetValueOrDefault())); } return(null); }
private void CurrencyActionTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (this.CurrencyActionTypeComboBox.SelectedIndex >= 0) { CurrencyActionTypeEnum actionType = (CurrencyActionTypeEnum)this.CurrencyActionTypeComboBox.SelectedItem; this.GiveToGrid.Visibility = (actionType == CurrencyActionTypeEnum.AddToSpecificUser || actionType == CurrencyActionTypeEnum.AddToAllChatUsers || actionType == CurrencyActionTypeEnum.SubtractFromSpecificUser || actionType == CurrencyActionTypeEnum.SubtractFromAllChatUsers) ? Visibility.Visible : Visibility.Collapsed; this.CurrencyUsernameTextBox.Visibility = (actionType == CurrencyActionTypeEnum.AddToSpecificUser || actionType == CurrencyActionTypeEnum.SubtractFromSpecificUser) ? Visibility.Visible : Visibility.Collapsed; this.CurrencyPermissionsAllowedComboBox.Visibility = (actionType == CurrencyActionTypeEnum.AddToAllChatUsers || actionType == CurrencyActionTypeEnum.SubtractFromAllChatUsers) ? Visibility.Visible : Visibility.Collapsed; this.DeductFromUserTextBlock.IsEnabled = this.DeductFromUserToggleButton.IsEnabled = (actionType == CurrencyActionTypeEnum.AddToSpecificUser || actionType == CurrencyActionTypeEnum.AddToAllChatUsers) ? true : false; this.InventoryItemNameComboBox.IsEnabled = (actionType != CurrencyActionTypeEnum.ResetForAllUsers && actionType != CurrencyActionTypeEnum.ResetForUser); this.CurrencyAmountTextBox.IsEnabled = (actionType != CurrencyActionTypeEnum.ResetForAllUsers && actionType != CurrencyActionTypeEnum.ResetForUser); } }