예제 #1
0
        private async Task ReposicionamentoDaImagemNoContainerAsync(FotoListContainerControl container)
        {
            // Definição de variáveis que auxiliarão no processo de exibição da imagem no local original
            var    image = container.Content as Image;
            var    currentScale = 1;
            var    width = container.Width;
            var    height = container.Height;
            double xOffset = 0, yOffset = 0;

            // Obtenção da posição X para centralizar a imagem
            if (image.Width * currentScale < width && width > height)
            {
                xOffset = (width - image.Width * currentScale) / 2 - container.Content.X;
            }
            else
            {
                xOffset = System.Math.Max(System.Math.Min(0, xOffset), -System.Math.Abs(image.Width * currentScale - width));
            }

            // Obtenção da posição Y para centralizar a imagem
            if (image.Height * currentScale < height && image.Height > width)
            {
                yOffset = (height - image.Height * currentScale) / 2 - container.Content.Y;
            }
            else
            {
                yOffset = System.Math.Max(System.Math.Min((image.Height - (height)) / 2, yOffset), -System.Math.Abs((image.Height * currentScale - height - (image.Height - height) / 2)));
            }
            await container.Content.TranslateTo(xOffset, yOffset, 500, Easing.BounceOut);
        }
예제 #2
0
        private void CriaFramesFotos()
        {
            var fotos = viewModel.FotosAtendimento.Where(f => !f.JaExibidaNaListagem).ToList();

            foreach (var f in fotos)
            {
                Frame frameFoto = new Frame();
                frameFoto.Margin        = 10;
                frameFoto.BorderColor   = Color.Black;
                frameFoto.CornerRadius  = 15;
                frameFoto.WidthRequest  = (width > height ? width * 0.85 : height * 0.85);
                frameFoto.HeightRequest = (height > width ? height * 0.50 : width * 0.50);

                var fotoContainer = new FotoListContainerControl(f);

                Label observacoes = new Label();
                observacoes.Text         = f.Observacoes;
                observacoes.WidthRequest = frameFoto.WidthRequest * 0.30;
                FlexLayout.SetAlignSelf(observacoes, FlexAlignSelf.Center);

                FlexLayout flexLayout = new FlexLayout();
                flexLayout.Direction      = FlexDirection.Row;
                flexLayout.JustifyContent = FlexJustify.SpaceAround;

                flexLayout.Children.Add(fotoContainer);
                flexLayout.Children.Add(observacoes);

                frameFoto.Content = flexLayout;

                f.JaExibidaNaListagem = true;

                flexLayoutFotos.Children.Add(frameFoto);
            }
        }
예제 #3
0
        private async Task RemoverContainerAsync(FotoListContainerControl container)
        {
            if (await DisplayAlert("Confirmação", $"Confirma remoção da foto?", "Yes", "No"))
            {
                await viewModel.EliminarFotoAsync(container.Foto);

                (container.Parent.Parent as Frame).IsVisible = false;
                await DisplayAlert("Informação", "Atendimento removido com sucesso", "Ok");
            }
            else
            {
                await ReposicionamentoDaImagemNoContainerAsync(container);
            }
            return;
        }