コード例 #1
0
 private void GiveToComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (this.GiveToComboBox.SelectedIndex >= 0)
     {
         CurrencyGiveToTypeEnum giveTo = EnumHelper.GetEnumValueFromString <CurrencyGiveToTypeEnum>((string)this.GiveToComboBox.SelectedItem);
         this.CurrencyUsernameTextBox.IsEnabled = (giveTo == CurrencyGiveToTypeEnum.SpecificUser);
     }
 }
コード例 #2
0
        public override ActionBase GetAction()
        {
            if (this.CurrencyTypeComboBox.SelectedIndex >= 0 && !string.IsNullOrEmpty(this.CurrencyAmountTextBox.Text) && this.GiveToComboBox.SelectedIndex >= 0)
            {
                CurrencyGiveToTypeEnum giveTo = EnumHelper.GetEnumValueFromString <CurrencyGiveToTypeEnum>((string)this.GiveToComboBox.SelectedItem);
                if (giveTo == CurrencyGiveToTypeEnum.SpecificUser)
                {
                    if (string.IsNullOrEmpty(this.CurrencyUsernameTextBox.Text))
                    {
                        return(null);
                    }
                }
                else
                {
                    this.CurrencyUsernameTextBox.Text = null;
                }

                UserCurrencyViewModel currency = (UserCurrencyViewModel)this.CurrencyTypeComboBox.SelectedItem;
                return(new CurrencyAction(currency, this.CurrencyUsernameTextBox.Text, (giveTo == CurrencyGiveToTypeEnum.AllChatUsers), this.CurrencyAmountTextBox.Text,
                                          this.DeductFromUserToggleButton.IsChecked.GetValueOrDefault(), this.CurrencyMessageTextBox.Text, this.CurrencyWhisperToggleButton.IsChecked.GetValueOrDefault()));
            }
            return(null);
        }