Example #1
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.mapWindow = ((Milestone_2.MapWindow)(target));
                return;

            case 2:
                this.mapGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.map = ((Microsoft.Maps.MapControl.WPF.Map)(target));
                return;

            case 4:
                this.switchModesButton = ((System.Windows.Controls.Button)(target));

            #line 23 "..\..\MapWindow.xaml"
                this.switchModesButton.Click += new System.Windows.RoutedEventHandler(this.switchModesButton_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
        private void MapButton_Click(object sender, RoutedEventArgs e)
        {
            if (searchResultsDataGrid.Items.IsEmpty)
            {
                return;
            }
            MapWindow myMap = new MapWindow();

            if (searchResultsDataGrid.SelectedIndex > -1)
            {
                // DO method for 1 bidness.  // Zoom level 15-16
                Business business = (Business)searchResultsDataGrid.SelectedItem;
                myMap.AddPushPins(business.latitude, business.longitude, 16);
            }

            else if (!searchResultsDataGrid.Items.IsEmpty)
            {
                // Zoom level 9-11?
                foreach (Business business in searchResultsDataGrid.Items)
                {
                    myMap.AddPushPins(business.latitude, business.longitude, 10);
                }
            }
            myMap.Show();
        }