상속: INotifyPropertyChanged
예제 #1
0
        public void lvGiveaways_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Giveaway selected = colGiveaways.FirstOrDefault(x => x.GiveawayName == ((Giveaway)lvGiveaways.SelectedItem).GiveawayName);

            tbGwName.Text           = selected.GiveawayName;
            tbTimeToEnter.Text      = selected.GiveawayTime.TotalSeconds.ToString();
            tbKeyword.Text          = selected.Keyword;
            tbPrice.Text            = selected.Price.ToString();
            cbNeedsFollow.IsChecked = selected.NeedsFollow;
            slSubLuck.Value         = selected.SubscriberLuck;
            tbResponseTime.Text     = selected.ResponseTime.TotalSeconds.ToString();
            if (selected.Winner != null)
            {
                btnDrawWinner.IsEnabled = true;
            }
            else
            {
                btnDrawWinner.IsEnabled = false;
            }
        }
예제 #2
0
        public void btnAddEditGw_Click(object sender, RoutedEventArgs e)
        {
            Giveaway search = colGiveaways.FirstOrDefault(x => x.GiveawayName == tbGwName.Text);

            if (search == null)
            {
                search = new Giveaway(tbGwName.Text, new TimeSpan(0, 0, int.Parse(tbTimeToEnter.Text)), tbKeyword.Text, int.Parse(tbPrice.Text), cbNeedsFollow.IsChecked.Value, byte.Parse(slSubLuck.Value.ToString()), new TimeSpan(0, 0, int.Parse(tbResponseTime.Text)));
                search.ViewerEntered += DefaultGiveawayViewerEntered;
                search.WinnerChosen  += DefaultGiveawayWinnerChosen;
                colGiveaways.Add(search);
            }
            else
            {
                search.GiveawayName   = tbGwName.Text;
                search.GiveawayTime   = new TimeSpan(0, 0, int.Parse(tbTimeToEnter.Text));
                search.Keyword        = tbKeyword.Text;
                search.Price          = int.Parse(tbPrice.Text);
                search.NeedsFollow    = cbNeedsFollow.IsChecked.Value;
                search.SubscriberLuck = byte.Parse(slSubLuck.Value.ToString());
                search.ResponseTime   = new TimeSpan(0, 0, int.Parse(tbResponseTime.Text));
            }
        }
예제 #3
0
        public void btnDrawWinner_Click(object sender, RoutedEventArgs e)
        {
            Giveaway selected = colGiveaways.FirstOrDefault(x => x.GiveawayName == ((Giveaway)lvGiveaways.SelectedItem).GiveawayName);

            selected.DrawWinner();
        }
예제 #4
0
 public WindowGiveawayViewers(Giveaway gw)
 {
     InitializeComponent();
     lbViewers.ItemsSource = gw.Entries;
 }