示例#1
0
        protected override void OnAppearing()
        {
            base.OnAppearing();
            App.Current.On <Xamarin.Forms.PlatformConfiguration.Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize);
            Task.Run(async() =>
            {
                viewModel.IsBusy = true;
                await viewModel.LoadData();
                viewModel.BindExistingData();
                Device.BeginInvokeOnMainThread(() =>
                {
                    if (viewModel.IsHot ?? false)
                    {
                        RadioButtonYes.IsChecked = true;
                    }
                    else
                    {
                        RadioButtonNo.IsChecked = true;
                    }
                });
                if (viewModel.ProductItemViewModel != null && viewModel.ProductItemViewModel.Lat.HasValue &&
                    viewModel.ProductItemViewModel.Long.HasValue)
                {
                    _currentPin = new Pin()
                    {
                        Type        = PinType.Place,
                        Icon        = BitmapDescriptorFactory.FromBundle("estate_pin.png"),
                        Label       = viewModel.ProductItemViewModel?.MainPinText,
                        Address     = viewModel.ProductItemViewModel?.Address,
                        Position    = new Position(viewModel.ProductItemViewModel.Lat.Value, viewModel.ProductItemViewModel.Long.Value),
                        Rotation    = 0f,
                        IsVisible   = true,
                        IsDraggable = true
                    };

                    map.Pins.Add(_currentPin);
                    map.MoveToRegion(MapSpan.FromCenterAndRadius(_currentPin.Position, Distance.FromMeters(500)));
                    map.UiSettings.MapToolbarEnabled = true;
                }
                viewModel.IsBusy = false;
            });
        }