public Statistic(PackTracker.History History) { InitializeComponent(); Dictionary <int, View.Statistic> _statistics = new Dictionary <int, View.Statistic>(); dd_Packs.SelectionChanged += (sender, e) => { if (e.AddedItems.Count == 1) { int selection = (int)e.AddedItems[0]; if (!_statistics.ContainsKey(selection)) { _statistics.Add(selection, new View.Statistic(selection, History)); } dp_Statistic.DataContext = _statistics[selection]; } else { dp_Statistic.DataContext = null; } }; Loaded += (sender, e) => dd_Packs.DataContext = History; dd_Packs.Focus(); }
public Statistic(PackTracker.History History, PackTracker.Settings settings) { this.InitializeComponent(); var _statistics = new Dictionary <int, View.Statistic>(); this.dd_Packs.SelectionChanged += (sender, e) => { if (e.AddedItems.Count == 1) { var selection = (int)e.AddedItems[0]; if (!_statistics.ContainsKey(selection)) { _statistics.Add(selection, new View.Statistic(selection, History)); } this.dp_Statistic.DataContext = _statistics[selection]; } else { this.dp_Statistic.DataContext = null; } }; this.dd_Packs.ShowUntracked = settings.ShowUntracked; Loaded += (sender, e) => this.dd_Packs.DataContext = History; this.dd_Packs.Focus(); }
private void dd_Packs_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { _dropDown.Clear(); if (e.NewValue is PackTracker.History) { PackTracker.History History = (PackTracker.History)e.NewValue; _dropDown = new ObservableCollection <int>(History.Select(x => x.Id).Distinct().OrderBy(x => x)); dd_Packs.ItemsSource = _dropDown; History.CollectionChanged += DropDown_NewEntry; } if (e.OldValue is PackTracker.History) { ((PackTracker.History)e.OldValue).CollectionChanged -= DropDown_NewEntry; } if (_dropDown.Count > 0) { dd_Packs.SelectedIndex = -1; if (e.NewValue is PackTracker.History) { dd_Packs.SelectedItem = ((PackTracker.History)e.NewValue).Last().Id; } else { dd_Packs.SelectedIndex = 0; } } }
public Search(PackTracker.History History) { this.InitializeComponent(); this._index = new IndexRepository(History); this.txt_Search.Focus(); }
private void InitializeCalender(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add && e.NewItems.Count > 0 && sender is PackTracker.History) { PackTracker.History History = (PackTracker.History)sender; InitializeCalender(History); History.CollectionChanged -= InitializeCalender; } }
public Log(PackTracker.History History) { InitializeComponent(); Legendary = (SolidColorBrush)FindResource("Legendary"); Epic = (SolidColorBrush)FindResource("Epic"); Rare = (SolidColorBrush)FindResource("Rare"); Loaded += (sender, e) => AddLogs(History); History.CollectionChanged += (sender, e) => { if(e.Action == NotifyCollectionChangedAction.Add) { AddLogs(e.NewItems.Cast<Pack>()); } }; }
private void InitializeCalender(PackTracker.History History) { Entity.Pack FirstPack = History.First(); dp_DatePicker.DisplayDateStart = FirstPack.Time; dp_DatePicker.SelectedDate = History.Last().Time.Date; IEnumerable <DateTime> HistoryDates = History.Select(x => x.Time.Date).Distinct(); for (DateTime i = FirstPack.Time.Date; i.Date < DateTime.Today; i = i.AddDays(1)) { if (!HistoryDates.Contains(i)) { dp_DatePicker.BlackoutDates.Add(new CalendarDateRange(i)); } } }
public PityTimer(PackTracker.History History, PityTimerRepository PityTimers) { InitializeComponent(); _pityTimers = PityTimers; dd_Packs.SelectionChanged += (sender, e) => { if (e.AddedItems.Count == 1) { Ep_Prev.DataContext = Ep_Label.DataContext = _pityTimers.GetPityTimer((int)e.AddedItems[0], Rarity.EPIC, false, true); Leg_Prev.DataContext = Leg_Label.DataContext = _pityTimers.GetPityTimer((int)e.AddedItems[0], Rarity.LEGENDARY, false, true); } }; Loaded += (sender, e) => dd_Packs.DataContext = History; }
private void InitializeCalender(PackTracker.History History) { var FirstPack = History.First(); this.dp_DatePicker.DisplayDateStart = FirstPack.Time; this.dp_DatePicker.SelectedDate = History.Last().Time.Date; var HistoryDates = History.Select(x => x.Time.Date).Distinct(); for (var i = FirstPack.Time.Date; i.Date < DateTime.Today; i = i.AddDays(1)) { if (!HistoryDates.Contains(i)) { this.dp_DatePicker.BlackoutDates.Add(new CalendarDateRange(i)); } } }
public PityTimer(PackTracker.History History, PityTimerRepository PityTimers, PackTracker.Settings settings) { this.InitializeComponent(); this._pityTimers = PityTimers; this.dd_Packs.SelectionChanged += (sender, e) => { if (e.AddedItems.Count == 1) { this.Ep_Prev.DataContext = this.Ep_Label.DataContext = this._pityTimers.GetPityTimer((int)e.AddedItems[0], Rarity.EPIC, false, true); this.Leg_Prev.DataContext = this.Leg_Label.DataContext = this._pityTimers.GetPityTimer((int)e.AddedItems[0], Rarity.LEGENDARY, false, true); } }; this.dd_Packs.ShowUntracked = settings.ShowUntracked; Loaded += (sender, e) => this.dd_Packs.DataContext = History; }
public PityTimerOverlay(PackTracker.History History, PityTimerRepository PityTimers) { InitializeComponent(); DataContext = this; if (History.Count > 0) { _packId = History.Last().Id; Chart_Epic.DataContext = PityTimers.GetPityTimer((int)_packId, Rarity.EPIC, false, true); Chart_Leg.DataContext = PityTimers.GetPityTimer((int)_packId, Rarity.LEGENDARY, false, true); } History.CollectionChanged += (sender, e) => { foreach (Pack Pack in e.NewItems) { Chart_Epic.DataContext = PityTimers.GetPityTimer(Pack.Id, Rarity.EPIC, false, true); Chart_Leg.DataContext = PityTimers.GetPityTimer(Pack.Id, Rarity.LEGENDARY, false, true); _packId = Pack.Id; } OnPropertyChanged("PackId"); }; }
public ManualPackInsert(PackTracker.History History) { this.DataContext = new View.ManualPackInsert(History); this.InitializeComponent(); }
public HistoryDatePicker(PackTracker.History History) { this.InitializeComponent(); this._history = History; if (History.Count > 0) { this.InitializeCalender(History); } else { this.dp_DatePicker.DisplayDateStart = DateTime.Today; History.CollectionChanged += this.InitializeCalender; } this.dp_DatePicker.SelectedDateChanged += (sender, e) => this.OnPropertyChanged("AssociatedPack"); History.CollectionChanged += (sender, e) => { if (e.Action == NotifyCollectionChangedAction.Add) { foreach (var Pack in e.NewItems) { if (Pack is Entity.Pack NewPack) { if (this._associatedPacks.ContainsKey(NewPack.Time.Date)) { this._associatedPacks[NewPack.Time.Date].Add(NewPack); } if (this.dp_DatePicker.SelectedDate != NewPack.Time.Date) { this.dp_DatePicker.SelectedDate = NewPack.Time.Date; } } } } }; this.dp_DatePicker.MouseWheel += (sender, e) => { if (this.dp_DatePicker.SelectedDate == null) { return; } var day = e.Delta < 0 ? -1 : 1; var Date = (DateTime)this.dp_DatePicker.SelectedDate; var First = History.First().Time.Date; var Last = History.Last().Time.Date; do { Date = Date.AddDays(day); if (day == 1) { if (Date > Last) { return; } if (Date < First) { this.dp_DatePicker.SelectedDate = First; return; } } else { if (Date < First) { return; } if (Date > Last) { this.dp_DatePicker.SelectedDate = Last; return; } } } while (this.dp_DatePicker.BlackoutDates.Contains(Date)); this.dp_DatePicker.SelectedDate = Date; }; }
public History(PackTracker.History History, HistoryDatePicker DatePicker) { this.InitializeComponent(); this.ic_Cards.DataContext = DatePicker; this.uc_Date.Content = DatePicker; }