Exemplo n.º 1
0
        private void StartSearch()
        {
            bool found = false;

            AllowTimersTick = false;
            RefreshMapTimer.Start();

            List <Location> locations = new List <Location>();

            EPL_WS.GET_Suspensions_FullDetailed_Result item = new EPL_WS.GET_Suspensions_FullDetailed_Result();

            foreach (Pushpin pushpin in m_PushpinLayer.Children)
            {
                string tag   = pushpin.Tag.ToString();
                int    index = tag.IndexOf("_");

                string ID_Suspension = tag.Substring(0, index);
                string ID_Ramal      = tag.Substring(index + 1, tag.Length - index - 1);

                if (ID_Suspension.Equals(TB_Search.Text))
                {
                    pushpin.RenderTransform = new ScaleTransform
                    {
                        CenterX = pushpin.Width / 2,
                        CenterY = pushpin.Height / 2,
                        ScaleX  = 1.5,
                        ScaleY  = 1.5
                    };

                    Canvas.SetZIndex(pushpin, 1000);

                    locations.Add(pushpin.Location);

                    if (!found)
                    {
                        item            = PinsArray.Where(e => e.ID.ToString().Equals(ID_Suspension)).ElementAt(0);
                        SelectedPushpin = pushpin;
                        found           = true;
                    }
                }
                else
                {
                    pushpin.RenderTransform = new ScaleTransform
                    {
                        CenterX = pushpin.Width / 2,
                        CenterY = pushpin.Height / 2,
                        ScaleX  = 0.75,
                        ScaleY  = 0.75
                    };

                    Canvas.SetZIndex(pushpin, 0);
                }
            }

            if (found)
            {
                MiraMap.SetView(new LocationRect(locations));
                ShowSuspensionDetail(SelectedPushpin, item);
            }
        }
Exemplo n.º 2
0
        private void ShowSuspensionDetail(Pushpin pushPin, EPL_WS.GET_Suspensions_FullDetailed_Result item)
        {
            if (item != null)
            {
                IsZoomed        = true;
                AllowTimersTick = false;
                ShowAllPins     = true;
                m_ControlLayer.Children.Clear();

                pushPin.Visibility = Visibility.Visible;

                Suspension_Detail detail = new Suspension_Detail
                {
                    Margin    = new Thickness(27, 75, 0, 0),
                    ID        = item.ID.ToString(),
                    ID_Ramal  = item.ID_Ramal,
                    ID_Status = item.StatDesc,

                    Date_Prev_Begin = String.Format("{0:ddd, dd-MM-yyyy HH:mm}", item.Date_Pred_Begin),
                    Date_Prev_End   = String.Format("{0:ddd, dd-MM-yyyy HH:mm}", item.Date_Pred_End),
                    Date_Real_Begin = String.Format("{0:ddd, dd-MM-yyyy HH:mm}", item.Date_Real_Begin),
                    Date_Real_End   = String.Format("{0:ddd, dd-MM-yyyy HH:mm}", item.Date_Real_End),

                    Observations = item.Description,
                    Description  = item.Label
                };

                detail.CloseWindow += new Suspension_Detail.CloseWindowHandler(detail_CloseWindow);

                m_ControlLayer.AddChild(detail, new Location(pushPin.Location.Latitude, pushPin.Location.Longitude), PositionOrigin.CenterLeft);
                MiraMap.Center = pushPin.Location;

                MiraMap.ZoomLevel = Math.Max(13, MiraMap.ZoomLevel);
            }
            else
            {
                m_ControlLayer.Children.Clear();
            }
        }