private void SelectCustomer(object obj)
        {
            CustomerMonitoringViewModel customerViewModel = obj as CustomerMonitoringViewModel;

            if (customerViewModel != null)
            {
                var parameters = new NavigationParameters();
                parameters.Add("Customer", customerViewModel._customer);
                _shellService.ShowShell("Monitoring", parameters);
            }
        }
        private void InitializeData(object obj)
        {
            var map = obj as MapControl;

            if (map != null)
            {
                var principal              = Thread.CurrentPrincipal as SystemPrincipal;
                var agentId                = principal.Identity.Id;
                var customerList           = _customerService.GetCustomersBy(agentId);
                var customerMonitoringList = new List <CustomerMonitoringViewModel>();
                var customerMapMarkerList  = new List <MapMarker>();
                Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                {
                    foreach (var customer in customerList)
                    {
                        var customerViewModel = new CustomerMonitoringViewModel(_shellService, RegionManager, _monitoringDataService, customer);
                        var mapMarker         = new MapMarker(new PointLatLng(customerViewModel.Latitude, customerViewModel.Longitude));
                        mapMarker.Shape       = new CustomerMarker(customerViewModel);
                        customerMonitoringList.Add(customerViewModel);
                        customerMapMarkerList.Add(mapMarker);
                    }


                    CustomerMonitoringList.AddRange(customerMonitoringList);
                    map.Markers.AddRange(customerMapMarkerList);

                    CustomersView        = GetCustomerCollectionView(CustomerMonitoringList);
                    CustomersView.Filter = OnFilterCustomer;
                }));
            }

            var action = new Action(() =>
            {
                Thread.Sleep(1000);
                IsInitialShow = true;
            });

            action.BeginInvoke(null, null);
            //Application.Current.Dispatcher.BeginInvoke(new Action(() =>
            //{
            //    IsInitialShow = false;
            //}));
        }
 public CustomerMarker(CustomerMonitoringViewModel viewModel)
 {
     InitializeComponent();
     this.DataContext = viewModel;
 }