private void RollTag(object sender, RoutedEventArgs e) { Button button = sender as Button; int index = Int32.Parse(button.Name.Replace("rollName", "")); TextBox textBox = FindName("tagName" + (index)) as TextBox; long poll_id = Convert.ToInt64(button.Tag); Poll poll = pollService.getPoll(poll_id); List <Tag> tagList = tagService.queryList(poll_id, poll.IsRepeat); textBox.Tag = poll_id; if (!indexs.ContainsKey(poll_id) && tagList.Count > 0) { indexs.Add(poll_id, 0); DispatcherTimer _timer = new DispatcherTimer(); TimeSpan timeSpan = new TimeSpan(0, 0, 0, 0, 30); _timer.Tick += new EventHandler(updateRoll); _timer.Interval = timeSpan; _timer.Tag = textBox; _timer.Start(); } else { if (tagList.Count <= 0) { MessageBox.Show(Application.Current.MainWindow, "池中没有标签", "提示", MessageBoxButton.OK, MessageBoxImage.Information); return; } MessageBox.Show(Application.Current.MainWindow, "Roll滚动中...", "提示", MessageBoxButton.OK, MessageBoxImage.Information); } }
public TagSetting(long id) { InitializeComponent(); Label title = FindName("poll_title") as Label; title.Content = id; poll_id = id; tagService = new TagService(); pollService = new PollService(); Poll poll = pollService.getPoll(poll_id); this.poll_title.Content = poll.Name + " 列表池"; tagList = new BindingList <Tag>(tagService.queryAllList(id)); this.tagListView.ItemsSource = tagList; }