Пример #1
0
        /// <summary>
        ///     Creates a stack panel containing the content for the family place section
        /// </summary>
        /// <returns></returns>
        private StackPanel familyPlaceContent()
        {
            //Create the stack panel
            StackPanel contentStackPanel = new StackPanel();

            // Create the map
            map = new Map();
            map.Mode = new AerialMode(true);
            map.CredentialsProvider = Util.MapProvider;
            map.HorizontalAlignment = HorizontalAlignment.Stretch;
            map.VerticalAlignment = VerticalAlignment.Stretch;
            map.Center = new Location(-41, 174);
            map.ZoomLevel = 6.0;
            map.Height = 550;

            //create the pushpins
            auckMOPin = new Pushpin();
            chchPin = new Pushpin();
            dunPin = new Pushpin();
            taurPin = new Pushpin();
            hBPin = new Pushpin();
            wellPin = new Pushpin();

            //Set the locations of the pins
            auckMOPin.Location = new Location(-36.857897, 174.769401);
            chchPin.Location = new Location(-43.501951, 172.544112);
            dunPin.Location = new Location(-45.868512, 170.50574);
            taurPin.Location = new Location(-37.699713, 176.156457);
            hBPin.Location = new Location(-39.628639, 176.822171);
            wellPin.Location = new Location(-41.307915, 174.77836);

            //Add the pushpins to the map
            map.Children.Add(auckMOPin);
            map.Children.Add(chchPin);
            map.Children.Add(dunPin);
            map.Children.Add(taurPin);
            map.Children.Add(hBPin);
            map.Children.Add(wellPin);

            //Add handlers for both mouse and touch events so that when the user touches a pushpin, it can be handled
            map.AddHandler(TouchDownEvent, new EventHandler<TouchEventArgs>(MapWithPushpins_TouchDown), true);
            map.AddHandler(MouseDownEvent, new MouseButtonEventHandler(MapWithPushpins_MouseDown), true);

            //Create a scroll viewer to display place details
            familyPlaceScroll = new SurfaceScrollViewer();
            familyPlaceScroll.Style = FindResource("SurfaceScrollViewerStyle1") as Style;
            familyPlaceScroll.Height = 300;
            familyPlaceScroll.Background = new SolidColorBrush((Color) ColorConverter.ConvertFromString("#00000000"));

            //Set the initial content of  the scroll viewer to prompt the user to click on a pushpin
            TextBlock prompt = Util.TextBlockFactory();
            prompt.TextAlignment = TextAlignment.Center;
            prompt.Inlines.Add(new Run("Click on the pins to see their contact information\n"));
            familyPlaceScroll.Content = prompt;

            //Add the elements to the family place stackpanel
            contentStackPanel.Children.Add(map);
            contentStackPanel.Children.Add(familyPlaceScroll);

            //only allow vertical scrolling if necessary
            familyPlaceScroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
            familyPlaceScroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;

            //Set the content of the button back to family places after the content has finished loading
            _fmlPlcs.Content = "Family Places";

            return contentStackPanel;
        }
Пример #2
0
        /// <summary>
        ///     the helper method to generate the content when "contact list" has been clicked
        /// </summary>
        /// <returns></returns>
        private StackPanel cListContent()
        {
            //Set content to on going donation
            StackPanel contentStackPanel = new StackPanel();

            // Set up the Bing map control
            map = new Map();
            map.Mode = new AerialMode(true);
            map.CredentialsProvider = Util.MapProvider;
            map.HorizontalAlignment = HorizontalAlignment.Stretch;
            map.VerticalAlignment = VerticalAlignment.Stretch;
            map.Center = new Location(-41, 174);
            map.ZoomLevel = 6.0;
            map.Height = 550;

            // The pushpin to add to the map.
            aucklandPin = new Pushpin();
            aucklandPin.Location = new Location(-36.843880, 174.767746);

            // Add the pushpin to the map.
            map.Children.Add(aucklandPin);

            // The pushpin to add to the map.
            christchurchPin = new Pushpin();
            christchurchPin.Location = new Location(-43.531010, 172.637787);

            // Add the pushpin to the map.
            map.Children.Add(christchurchPin);

            // The pushpin to add to the map.
            dunedinPin = new Pushpin();
            dunedinPin.Location = new Location(-45.873489, 170.503967);

            // Add the pushpin to the map.
            map.Children.Add(dunedinPin);
            // The pushpin to add to the map.
            wellingtonPin = new Pushpin();
            wellingtonPin.Location = new Location(-41.288940, 174.776276);

            // Add the pushpin to the map.
            map.Children.Add(wellingtonPin);

            //Create handlers to handle when the map is clicked
            map.AddHandler(TouchDownEvent, new EventHandler<TouchEventArgs>(MapWithPushpins_TouchDown), true);
            map.AddHandler(MouseDownEvent, new MouseButtonEventHandler(MapWithPushpins_MouseDown), true);

            //Create a scroll viewer to show pin details
            mscroll = new SurfaceScrollViewer();
            mscroll.Style = FindResource("SurfaceScrollViewerStyle1") as Style;
            mscroll.Height = 300;
            mscroll.Background = new SolidColorBrush((Color) ColorConverter.ConvertFromString("#00000000"));
            mscroll.ScrollChanged += mscroll_ScrollChanged;

            //set the initial content of the scroll viewer to be a prompt
            TextBlock prompt = Util.TextBlockFactory();
            prompt.TextAlignment = TextAlignment.Center;
            prompt.Inlines.Add(new Run("Click on the pins to see their contact information\n"));
            mscroll.Content = prompt;

            //Add the map and scrollviewer to the stack panel
            contentStackPanel.Children.Add(map);
            contentStackPanel.Children.Add(mscroll);

            //Set only the vertical bar to be visible when necessary
            mscroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
            mscroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;

            return contentStackPanel;
        }