protected virtual void OnCustomerAdded(CustomerAddedEventArgs e)
 {
     if (CustomerAddedEventHandler != null)
     {
         CustomerAddedEventHandler(this, e);
     }
 }
        private void EnsureCustomerInMap(int customerId)
        {
            List<Bet> bets;
            if (!_customerIdToBetsMap.TryGetValue(customerId, out bets))
            {
                bets = new List<Bet>();
                _customerIdToBetsMap[customerId] = bets;

                var eventArgs = new CustomerAddedEventArgs(customerId);
                OnCustomerAdded(eventArgs);
            }
        }
        private void BetDataCacheOnCustomerAddedEventHandler(object sender, CustomerAddedEventArgs customerAddedEventArgs)
        {
            Debug.Assert(!_customerIdToCustomerLookup.ContainsKey(customerAddedEventArgs.CustomerId));

            var customerViewModel = new CustomerViewModel(customerAddedEventArgs.CustomerId);
            _customerIdToCustomerLookup[customerAddedEventArgs.CustomerId] = customerViewModel;

            // todo - don't do this
            Application.Current.Dispatcher.Invoke(() =>
            {
                CustomerViewModels.Add(customerViewModel);
            });
        }