public CommuteOverviewControl()
        {
            InitializeComponent();
            // remove the navigation visibility.
            // This control is redundant with the multi-touch capabilities of the phone.
            // removes the copyright note
            this.BingMap.CopyrightVisibility = System.Windows.Visibility.Collapsed;
            // removes the Bing logo
            this.BingMap.LogoVisibility = System.Windows.Visibility.Visible;
            this.BingMap.ScaleVisibility = System.Windows.Visibility.Collapsed;
            this.BingMap.Mode = new Microsoft.Phone.Controls.Maps.RoadMode();

            this.BingMap.MapZoom += new EventHandler<Microsoft.Phone.Controls.Maps.MapZoomEventArgs>(BingMap_MapZoom);
            this.BingMap.MapPan += new EventHandler<Microsoft.Phone.Controls.Maps.MapDragEventArgs>(BingMap_MapPan);
            this.BingMap.ManipulationStarted += new EventHandler<ManipulationStartedEventArgs>(BingMap_ManipulationStarted);
            this.BingMap.IsEnabled = false;

            this.BingMap.Mode.AnimationLevel = Microsoft.Phone.Controls.Maps.AnimationLevel.None;
            this.BingMap.AnimationLevel = Microsoft.Phone.Controls.Maps.AnimationLevel.None;

            _routeLayer = new Microsoft.Phone.Controls.Maps.MapLayer();
            this.BingMap.Children.Insert(0, _routeLayer);

            this.BingMap.Visibility = System.Windows.Visibility.Collapsed;
        }
        public CommuteOverviewControl()
        {
            InitializeComponent();
            // remove the navigation visibility.
            // This control is redundant with the multi-touch capabilities of the phone.
            // removes the copyright note
            this.BingMap.CopyrightVisibility = System.Windows.Visibility.Collapsed;
            // removes the Bing logo
            this.BingMap.LogoVisibility  = System.Windows.Visibility.Visible;
            this.BingMap.ScaleVisibility = System.Windows.Visibility.Collapsed;
            this.BingMap.Mode            = new Microsoft.Phone.Controls.Maps.RoadMode();

            this.BingMap.MapZoom             += new EventHandler <Microsoft.Phone.Controls.Maps.MapZoomEventArgs>(BingMap_MapZoom);
            this.BingMap.MapPan              += new EventHandler <Microsoft.Phone.Controls.Maps.MapDragEventArgs>(BingMap_MapPan);
            this.BingMap.ManipulationStarted += new EventHandler <ManipulationStartedEventArgs>(BingMap_ManipulationStarted);
            this.BingMap.IsEnabled            = false;

            this.BingMap.Mode.AnimationLevel = Microsoft.Phone.Controls.Maps.AnimationLevel.None;
            this.BingMap.AnimationLevel      = Microsoft.Phone.Controls.Maps.AnimationLevel.None;

            _routeLayer = new Microsoft.Phone.Controls.Maps.MapLayer();
            this.BingMap.Children.Insert(0, _routeLayer);

            this.BingMap.Visibility = System.Windows.Visibility.Collapsed;
        }
Beispiel #3
0
        public RouteEditor()
        {
            // remove the navigation visibility.
            // This control is redundant with the multi-touch capabilities of the phone.
            //this.BingMap.NavigationVisibility = System.Windows.Visibility.Collapsed;
            // removes the copyright note
            this.BingMap.CopyrightVisibility = System.Windows.Visibility.Collapsed;
            // removes the Bing logo
            this.BingMap.LogoVisibility = System.Windows.Visibility.Collapsed;
            //this.BingMap.NavigationVisibility = System.Windows.Visibility.Collapsed;

            this.BingMap.Mode = new Microsoft.Phone.Controls.Maps.RoadMode();
            //this.BingMap.MouseDoubleClick += new EventHandler<Microsoft.Phone.Controls.Maps.MapMouseEventArgs>(BingMap_MouseDoubleClick);
               // this.BingMap.MousePan += new EventHandler<Microsoft.Phone.Controls.Maps.MapMouseDragEventArgs>(BingMap_MousePan);
            //this.BingMap.MapZoom += new EventHandler<Microsoft.Phone.Controls.Maps.MapZoomEventArgs>(BingMap_MapZoom);
            //this.BingMap.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(BingMap_MouseLeftButtonUp);

            layer = new Microsoft.Phone.Controls.Maps.MapLayer();
            this.BingMap.Children.Add(layer);

            List<RouteAvoidPair> avoids = new List<RouteAvoidPair>();

            int i = 0;
            int selectedIndex = 0;
            while (Enum.IsDefined(typeof(MobileSrc.Commuter.Shared.RouteServices.Rest.RouteAvoid), i))
            {
                if ((int)DataContextManager.SelectedRoute.AvoidanceMeasures == i)
                {
                    selectedIndex = i;
                }
                avoids.Add(new RouteAvoidPair((MobileSrc.Commuter.Shared.RouteServices.Rest.RouteAvoid)i));
                i++;
            }

            highwayToggle.ItemsSource = avoids;
            highwayToggle.SelectedIndex = selectedIndex;

            Binding highwayBinding = new Binding();
            highwayBinding.Source = DataContextManager.SelectedRoute;
            highwayBinding.Path = new PropertyPath("AvoidanceMeasures");
            highwayBinding.Mode = BindingMode.TwoWay;

            highwayToggle.SelectionChanged += new SelectionChangedEventHandler(highwayToggle_SelectionChanged);

            if (DataContextManager.SelectedRoute.RoutePoints.Count > 0)
            {
                RenderRoute();
            }
            else
            {
                // We have a new route
                PerformRouting(true);
            }

            if (DataContextManager.SelectedRoute.Name == null)
            {
                DataContextManager.SelectedRoute.Name = "untitled";
                this.Loaded += new RoutedEventHandler(RouteEditor_Loaded);
            }

            wayPointList.ItemsSource = DataContextManager.SelectedRoute.WayPoints;
            nameTextBox.Text = DataContextManager.SelectedRoute.Name;

            menu = new ContextMenu();
            MenuItem routeMenu = new MenuItem();
            routeMenu.Header = "Route through here...";
            routeMenu.Click += new RoutedEventHandler(routeMenu_Click);

            MenuItem headerMenu = new MenuItem();
            headerMenu.Header = "Route through...";
            headerMenu.FontSize = 20;
            headerMenu.IsEnabled = false;
            headerMenu.FontStretch = FontStretches.UltraExpanded;

            MenuItem customMenu = new MenuItem();
            customMenu.Header = "Specify Custom Address...";
            customMenu.IsEnabled = true;
            customMenu.Click += new RoutedEventHandler(customMenu_Click);

            menu.Items.Add(headerMenu);
            menu.Items.Add(new Separator());
            menu.Items.Add(routeMenu);
            menu.Items.Add(customMenu);

            GestureListener listener = GestureService.GetGestureListener(this.BingMap);
            listener.Hold += new EventHandler<GestureEventArgs>(listener_Hold);
        }
Beispiel #4
0
        public RouteEditor()
        {
            // remove the navigation visibility.
            // This control is redundant with the multi-touch capabilities of the phone.
            //this.BingMap.NavigationVisibility = System.Windows.Visibility.Collapsed;
            // removes the copyright note
            this.BingMap.CopyrightVisibility = System.Windows.Visibility.Collapsed;
            // removes the Bing logo
            this.BingMap.LogoVisibility = System.Windows.Visibility.Collapsed;
            //this.BingMap.NavigationVisibility = System.Windows.Visibility.Collapsed;

            this.BingMap.Mode = new Microsoft.Phone.Controls.Maps.RoadMode();
            //this.BingMap.MouseDoubleClick += new EventHandler<Microsoft.Phone.Controls.Maps.MapMouseEventArgs>(BingMap_MouseDoubleClick);
            // this.BingMap.MousePan += new EventHandler<Microsoft.Phone.Controls.Maps.MapMouseDragEventArgs>(BingMap_MousePan);
            //this.BingMap.MapZoom += new EventHandler<Microsoft.Phone.Controls.Maps.MapZoomEventArgs>(BingMap_MapZoom);
            //this.BingMap.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(BingMap_MouseLeftButtonUp);

            layer = new Microsoft.Phone.Controls.Maps.MapLayer();
            this.BingMap.Children.Add(layer);

            List <RouteAvoidPair> avoids = new List <RouteAvoidPair>();

            int i             = 0;
            int selectedIndex = 0;

            while (Enum.IsDefined(typeof(MobileSrc.Commuter.Shared.RouteServices.Rest.RouteAvoid), i))
            {
                if ((int)DataContextManager.SelectedRoute.AvoidanceMeasures == i)
                {
                    selectedIndex = i;
                }
                avoids.Add(new RouteAvoidPair((MobileSrc.Commuter.Shared.RouteServices.Rest.RouteAvoid)i));
                i++;
            }

            highwayToggle.ItemsSource   = avoids;
            highwayToggle.SelectedIndex = selectedIndex;

            Binding highwayBinding = new Binding();

            highwayBinding.Source = DataContextManager.SelectedRoute;
            highwayBinding.Path   = new PropertyPath("AvoidanceMeasures");
            highwayBinding.Mode   = BindingMode.TwoWay;

            highwayToggle.SelectionChanged += new SelectionChangedEventHandler(highwayToggle_SelectionChanged);

            if (DataContextManager.SelectedRoute.RoutePoints.Count > 0)
            {
                RenderRoute();
            }
            else
            {
                // We have a new route
                PerformRouting(true);
            }

            if (DataContextManager.SelectedRoute.Name == null)
            {
                DataContextManager.SelectedRoute.Name = "untitled";
                this.Loaded += new RoutedEventHandler(RouteEditor_Loaded);
            }

            wayPointList.ItemsSource = DataContextManager.SelectedRoute.WayPoints;
            nameTextBox.Text         = DataContextManager.SelectedRoute.Name;

            menu = new ContextMenu();
            MenuItem routeMenu = new MenuItem();

            routeMenu.Header = "Route through here...";
            routeMenu.Click += new RoutedEventHandler(routeMenu_Click);

            MenuItem headerMenu = new MenuItem();

            headerMenu.Header      = "Route through...";
            headerMenu.FontSize    = 20;
            headerMenu.IsEnabled   = false;
            headerMenu.FontStretch = FontStretches.UltraExpanded;

            MenuItem customMenu = new MenuItem();

            customMenu.Header    = "Specify Custom Address...";
            customMenu.IsEnabled = true;
            customMenu.Click    += new RoutedEventHandler(customMenu_Click);

            menu.Items.Add(headerMenu);
            menu.Items.Add(new Separator());
            menu.Items.Add(routeMenu);
            menu.Items.Add(customMenu);

            GestureListener listener = GestureService.GetGestureListener(this.BingMap);

            listener.Hold += new EventHandler <GestureEventArgs>(listener_Hold);
        }