public async void Login()
        {
            if (string.IsNullOrEmpty(Usuario.Senha) || string.IsNullOrEmpty(Usuario.Login))
            {
                await Dialog.AlertAsync("Atenção", "Preencha todos os campos!", "Ok");

                return;
            }

            try
            {
                var usu = repositorioUsuario.GetFirstBySpcification <Usuario>(c => c.Login == Usuario.Login && c.Senha == Usuario.Senha);

                if (usu != null)
                {
                    HomePage home = new HomePage();
                    await PushAsync(home);
                }
                else
                {
                    throw new Exception();
                }
            }
            catch
            {
                await Dialog.AlertAsync("Atenção", "Usuário e/ou senha inválido(s)", "Ok");
            }
        }
Пример #2
0
        private async void SellClick(object sender, RoutedEventArgs e)
        {
            VisualStateManager.GoToState(this, Selling.Name, true);

            try
            {
                this.item.Name        = this.name.Text;
                this.item.Description = this.GetTextDescription(this.description);
                this.item.Price       = decimal.Parse(this.price.Text);

                this.itemImagePath = await this.CopyStorageFile(this.storageFile);

                await SaleItemDataService.Instance.AddItemAsync(this.item, this.itemImagePath);

                this.GoBack();
            }
            catch
            {
                await Dialog.AlertAsync("An error ocurred");
            }
            finally
            {
                Dialog.HideLoading();
            }
        }
        public async void Media(Xamarin.Forms.Image Image1)
        {
            await CrossMedia.Current.Initialize();

            if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
            {
                await Dialog.AlertAsync("No Camera", ":( No camera available.", "OK");

                return;
            }

            var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
            {
                Directory = "Sample",
                Name      = "icon.png"
            });

            if (file == null)
            {
                return;
            }

            await Dialog.AlertAsync("File Location", file.Path, "OK");

            Image1.Source = ImageSource.FromStream(() =>
            {
                var stream = file.GetStream();
                file.Dispose();
                return(stream);
            });
        }
Пример #4
0
 public async void EditarCliente()
 {
     try
     {
         EditarClientePage edita = new EditarClientePage(Cliente);
         await PushModalAsync(edita);
     }
     catch (Exception ex)
     {
         await Dialog.AlertAsync(ex.Message, "Erro", "Ok");
     }
 }
Пример #5
0
 public async void DisplayPosts()
 {
     try
     {
         PostPage page = new PostPage(AlbumVM);
         await PushAsync(page);
     }
     catch (Exception ex)
     {
         await Dialog.AlertAsync(ex.Message, "Erro", "Ok");
     }
 }
Пример #6
0
 public async void DisplayComments()
 {
     try
     {
         CommentPage page = new CommentPage(PostVM);
         await PushAsync(page);
     }
     catch (Exception ex)
     {
         await Dialog.AlertAsync(ex.Message, "Erro", "Ok");
     }
 }
Пример #7
0
        public async void EditarCliente()
        {
            try
            {
                repositorio.Update <Cliente>(Cliente);

                PopModalAsync();
            }
            catch (Exception ex)
            {
                await Dialog.AlertAsync(ex.Message, "Erro", "Ok");
            }
        }
Пример #8
0
        public async void CadastrarCliente()
        {
            try
            {
                repositorioCliente.Insert <Cliente>(Cliente);

                await Dialog.AlertAsync("Alerta", "Cadastro efetuado com sucesso!", "Ok");

                Atualizar();
            }
            catch
            {
                await Dialog.AlertAsync("Atenção", "Usuário e/ou senha inválido(s)", "Ok");
            }
        }
Пример #9
0
        public async void Cadastro()
        {
            if (Validar())
            {
                repositorioUsuario.Insert <Usuario>(Usuario);

                await Dialog.AlertAsync("Alerta", "Cadastro efetuado com sucesso!", "Ok");

                await PopAsync();

                LoginPage login = new LoginPage();
                await PushAsync(login);
            }
            else
            {
                await Dialog.AlertAsync("Alerta", "Erro ao efetuar o cadastro!", "Ok");
            }
        }
Пример #10
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            this.capturedImage.Source = null;

            VisualStateManager.GoToState(this, ProcessingState.Name, true);

            this.processedControl.Blink();

            var photoStream = await this.mediaCaptureHelper.TakePhotoAsync();

            photoStream = await this.mediaCaptureHelper.RotatePhoto(photoStream);

            await this.SetCapturedImage(photoStream);

            var emotionService = new EmotionService();

            var detectedEmotions = await emotionService.RecognizeAsync(photoStream.AsStream());

            Emotion emotion = detectedEmotions.FirstOrDefault();

            if (emotion != null)
            {
                var texts = emotionService.GetTextsFor(emotion.Scores.Happiness);
                this.TextState.Text             = texts.Top;
                this.processedControl.Happiness = emotion.Scores.Happiness;
                this.processedControl.Text      = texts.Message;
                VisualStateManager.GoToState(this, RateState.Name, true);
            }
            else
            {
                await Dialog.AlertAsync("No face detected. Please, try again.");

                Dialog.HideLoading();
                VisualStateManager.GoToState(this, CaptureState.Name, true);
            }
        }