コード例 #1
0
        /// <summary>
        /// Handle the event of the view selection in the ContextPopup.
        /// </summary>
        /// <param name="sender">Specifies the sender object</param>
        /// <param name="e">Specifies the occured event</param>
        private void ViewPageSelected(object sender, EventArgs e)
        {
            // Remove the used data
            ClearData();

            if (((ContextPopupItem)sender).Text == "Map")
            {
                // Hide the label for the end position
                toLabel.Hide();
                // Set the viewpage
                view = ViewPage.MAP;
            }
            else if (((ContextPopupItem)sender).Text == "POI")
            {
                // Hide the label for the end position
                toLabel.Hide();
                // Set the viewpage
                view = ViewPage.POI;

                // Create the ContextPopup for the category selection
                categoryCtxPopup = new ContextPopup(window)
                {
                    // Set the AutoHide value
                    AutoHide = true,
                };

                // Get the categories of the here provider
                foreach (string category in HereCategory)
                {
                    // Append items for the ContextPopup and add event handlers
                    (categoryCtxPopup.Append(category)).Selected += CategorySelected;
                }

                // Move the ContextPopup
                categoryCtxPopup.Move(0, window.ScreenSize.Height);
                // Show the ContextPopup
                categoryCtxPopup.Show();
            }
            else if (((ContextPopupItem)sender).Text == "Route")
            {
                // Show the label for the end position
                toLabel.Show();
                // Set the viewpage
                view = ViewPage.ROUTE;
            }

            if (viewCtxPopup != null)
            {
                // Dismiss the ContextPopup object
                viewCtxPopup.Dismiss();
                viewCtxPopup = null;
            }
        }
コード例 #2
0
        /// <summary>
        /// Create a base UI.
        /// </summary>
        void Initialize()
        {
            // Create the window
            window = new Window("MapApp");
            window.KeyGrab(EvasKeyEventArgs.PlatformBackButtonName, false);
            window.KeyUp += (s, e) =>
            {
                if (e.KeyName == EvasKeyEventArgs.PlatformBackButtonName)
                {
                    // Close the map if the back key is selected
                    CloseApp();
                }
                else if (e.KeyName == EvasKeyEventArgs.PlatformMenuButtonName)
                {
                    // Create the ContextPopup for the ViewPage selection
                    viewCtxPopup = new ContextPopup(window)
                    {
                        // Set the AutoHide value
                        AutoHide = true,
                    };
                    // Append items for the ContextPopup and add event handlers
                    (viewCtxPopup.Append("Map")).Selected   += ViewPageSelected;
                    (viewCtxPopup.Append("POI")).Selected   += ViewPageSelected;
                    (viewCtxPopup.Append("Route")).Selected += ViewPageSelected;
                    // Move the ContextPopup
                    viewCtxPopup.Move(0, window.ScreenSize.Height);
                    // Show the ContextPopup
                    viewCtxPopup.Show();
                }
            };
            // Show the window
            window.Show();

            var box = new Box(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };

            box.Show();

            var bg = new Background(window)
            {
                Color = Color.White
            };

            bg.SetContent(box);

            var conformant = new Conformant(window);

            conformant.Show();
            conformant.SetContent(bg);

            // Create the MapView
            s_mapview = new MapView(window, s_maps);
            // Move the MapView
            s_mapview.Move(0, 0);
            // Resize the MapView
            s_mapview.Resize(window.ScreenSize.Width, window.ScreenSize.Height);
            // Show the MapView
            s_mapview.Show();
            // Set the latitude and longitude for the center position of the MapView
            //s_mapview.Center = new Geocoordinates(SEOUL_LAT, SEOUL_LON);
            s_mapview.Center = new Geocoordinates(DEFAULT_LAT, DEFAULT_LON);
            // Set the zoom level
            s_mapview.ZoomLevel = 9;
            // Add the handler for the longpress event on MapView
            s_mapview.LongPressed += MapViewLongPressed;

            CreateLabel();
        }