コード例 #1
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Classes.Entidade ent = e.Parameter as Classes.Entidade;
            this.ent          = ent;
            NomeEnt.Text      = ent.Nome;
            MoradaEnt.Text    = ent.Morada;
            CodPostalEnt.Text = ent.Codigo_Postal;

            TeleEnt.Text  = ent.Telefone.ToString();
            EmailEnt.Text = ent.Email;

            if (ent.Fax.ToString() == "0")
            {
                FaxEnt.Text       = "Não Disponível";
                FaxEnt.Foreground = new SolidColorBrush(Colors.Gray);
            }
            else
            {
                FaxEnt.Text = ent.Fax.ToString();
            }

            ImageEnt.Source = new BitmapImage(new Uri(ConfigData.Iconpath + ent.Anexo, UriKind.Absolute));
            Translate();
            MapFrame.Navigate(typeof(Pages.Contactos), ent);
        }
コード例 #2
0
        private void listBoxobj_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Classes.Entidade m = new Classes.Entidade();
            m = listBoxobj.SelectedItem as Classes.Entidade;

            // If selected index is -1 (no selection) do nothing
            if (listBoxobj.SelectedIndex == -1)
            {
                return;
            }

            // Navigate to the new page
            Frame.Navigate(typeof(Pages.Detalhe_Entidade), m);

            // Reset selected index to -1 (no selection)
            listBoxobj.SelectedIndex = -1;
        }
コード例 #3
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            MainPage.instance.change_title("Contactos Úteis");
            Translate();

            if (e.Parameter == null)
            {
                ZoomCurrentLoc();
                entmode = false;
                MyLocationButton.Visibility = Visibility.Visible;
            }
            else
            {
                Classes.Entidade se = e.Parameter as Classes.Entidade;
                MyLocationButton.Visibility = Visibility.Collapsed;
                entmode = true;
                ZoomToEnt(se);
            }
            List <BasicGeoposition> positions = new List <BasicGeoposition>();
            DatabaseHelperClass     dbtemas   = new DatabaseHelperClass();
            ObservableCollection <Classes.Entidade> EntList = dbtemas.ReadEntidade();

            this.EntList = EntList;
            Point p = new Point()
            {
                X = 0.32, Y = 0.78
            };

            foreach (var E in EntList)
            {
                double lat = dbtemas.latitude(E.N_Vertice);
                double lon = dbtemas.longitude(E.N_Vertice);
                E.point_n = p;
                E.geo     = new Geopoint(new BasicGeoposition()
                {
                    Latitude = lat, Longitude = lon
                });
            }
            MapItems.ItemsSource = EntList;
        }
コード例 #4
0
        private async void ZoomToEnt(Classes.Entidade ent)
        {
            DatabaseHelperClass dbtemas = new DatabaseHelperClass();
            double lat = dbtemas.latitude(ent.N_Vertice);
            double lon = dbtemas.longitude(ent.N_Vertice);

            ent.geo = new Geopoint(new BasicGeoposition()
            {
                Latitude = lat, Longitude = lon
            });
            await map1.TrySetViewAsync(ent.geo, 16, 0, 0, MapAnimationKind.None);

            if (ent.dest)
            {
                Geoposition location = MainPage.instance.getPos();
                this.current = new Geopoint(new BasicGeoposition()
                {
                    Latitude = location.Coordinate.Point.Position.Latitude, Longitude = location.Coordinate.Point.Position.Longitude
                });
                ent.dest = false;
                Plan_Route(ent);
            }
        }