private void _game_NewHUDItemEvent(object sender, HUDItemEventArgs e) { if (this.NewHUDItem != null) { NewHUDItem(this, e); } }
private void _game_RemoveHUDItemEvent(object sender, HUDItemEventArgs e) { if (RemoveHUDItem != null) { RemoveHUDItem(this, e); } }
private void _game_UpdateHUDItemEvent(object sender, HUDItemEventArgs e) { if (this.UpdateHUDItem != null) { UpdateHUDItem(this, e); } }
void item_Changed(object sender, HUDItemEventArgs e) { HUDItem item = sender as HUDItem; if (UpdateHUDItemEvent != null) { UpdateHUDItemEvent(this, new HUDItemEventArgs() { Item = item }); } }
private void _engine_RemoveHUDItem(object sender, HUDItemEventArgs e) { this.Dispatcher.Invoke((Action)(() => { var hudItems = this.HUDGrid.Children; List <FrameworkElement> removeList = new List <FrameworkElement>(); foreach (FrameworkElement element in hudItems) { if (element.Name == e.Item.Name) { removeList.Add(element); } } removeList.ForEach(x => HUDGrid.Children.Remove(x)); })); }
void _hudItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (NewHUDItemEvent != null && e.NewItems != null) { var args = new HUDItemEventArgs(); foreach (HUDItem item in e.NewItems) { item.Changed += item_Changed; args.Item = item; NewHUDItemEvent(this, args); } } if (RemoveHUDItemEvent != null && e.OldItems != null) { var args = new HUDItemEventArgs(); foreach (HUDItem item in e.OldItems) { item.Changed -= item_Changed; args.Item = item; RemoveHUDItemEvent(this, args); } } }
private void _engine_UpdateHUDItem(object sender, HUDItemEventArgs e) { UpdateHUDItem(e.Item); }
private void _engine_NewHUDItem(object sender, HUDItemEventArgs e) { AddHUDItem(e.Item); }