Inheritance: INotifyPropertyChanged
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 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));
            }
        }
Ejemplo n.º 3
0
        public void btnDrawWinner_Click(object sender, RoutedEventArgs e)
        {
            Giveaway selected = colGiveaways.FirstOrDefault(x => x.GiveawayName == ((Giveaway)lvGiveaways.SelectedItem).GiveawayName);

            selected.DrawWinner();
        }
Ejemplo n.º 4
0
 public WindowGiveawayViewers(Giveaway gw)
 {
     InitializeComponent();
     lbViewers.ItemsSource = gw.Entries;
 }