private void changeSelected(object sender, SelectionChangedEventArgs e) { Template template = (Template)this.cmbTemplates.SelectedItem; if (template != null) { List <Poll> pollList = pollService.queryList(template.Id); settingListViewBindingList = new BindingList <Poll>(pollList); this.settingListView.ItemsSource = settingListViewBindingList; foreach (Template item in bindingList) { item.IsLasted = false; } template.IsLasted = true; } }
private void loadWindow() { Template template = templateService.getDefaultTemplate(); if (template == null) { template = new Template(); template.Id = templateService.GenerateId(); template.Name = "default"; template.Is_used = "1"; templateService.insert(template); } pollService = new PollService(); List <Poll> polls = pollService.queryList(template.Id); for (int i = 0; i < polls.Count; i++) { Label label = FindName("pollName" + (i + 1)) as Label; label.Content = polls[i].Name; Button roll_button = FindName("rollName" + (i + 1)) as Button; Button setting_button = FindName("settingName" + (i + 1)) as Button; Button reset_button = FindName("resetName" + (i + 1)) as Button; TextBox textBox = FindName("tagName" + (i + 1)) as TextBox; textBox.FontSize = 20; this.mainTitle.Content = "整活挑战(" + template.Name + ")"; textBox.Foreground = new SolidColorBrush(Colors.DarkRed); roll_button.Tag = polls[i].Id; setting_button.Tag = polls[i].Id; reset_button.Tag = polls[i].Id; textBox.Text = "待Roll"; if (!polls[i].IsVisibility) { roll_button.IsEnabled = false; roll_button.Content = "停止使用"; } else { roll_button.IsEnabled = true; roll_button.Content = "待Roll"; } } }