public SaveTalentSpecDialog(TalentsBase spec, int tree1, int tree2, int tree3) { InitializeComponent(); #if !SILVERLIGHT this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner; this.WindowState = System.Windows.WindowState.Normal; #endif Talents = spec; Tree1 = tree1; Tree2 = tree2; Tree3 = tree3; SavedTalentSpecList saved = SavedTalentSpec.SpecsFor(spec.GetClass()); if (saved.Count > 0) { UpdateCombo.ItemsSource = saved; UpdateCombo.SelectedIndex = 0; } else { UpdateCombo.IsEnabled = false; } }
public SaveTalentSpecDialog(TalentsBase spec, int tree1, int tree2, int tree3) { InitializeComponent(); Talents = spec; Tree1 = tree1; Tree2 = tree2; Tree3 = tree3; SavedTalentSpecList saved = SavedTalentSpec.SpecsFor(spec.GetClass()); if (saved.Count > 0) { UpdateCombo.ItemsSource = saved; UpdateCombo.SelectedIndex = 0; } else { UpdateCombo.IsEnabled = false; } }
private void UpdateSavedSpecs() { SavedTalentSpecList savedSpecs = SavedTalentSpec.SpecsFor(Character.Class); SavedTalentSpec current = null; updating = true; foreach (SavedTalentSpec sts in savedSpecs) { if (sts.Equals(Character.CurrentTalents)) { current = sts; break; } } if (current != null) { HasCustomSpec = false; SavedCombo.ItemsSource = savedSpecs; SavedCombo.SelectedItem = current; SaveDeleteButton.Content = "Delete"; } else { HasCustomSpec = true; current = new SavedTalentSpec("Custom", Character.CurrentTalents, Tree1.Points(), Tree2.Points(), Tree3.Points()); SavedTalentSpecList currentList = new SavedTalentSpecList(); currentList.AddRange(savedSpecs); currentList.Add(current); SavedCombo.ItemsSource = null; SavedCombo.ItemsSource = currentList; SavedCombo.SelectedItem = current; SaveDeleteButton.Content = "Save"; } updating = false; }