Esempio n. 1
0
        async Task ExecuteStreamCommand()
        {
            if (!IsBusy)
            {
                try
                {
                    IsBusy  = true;
                    Servico = new CVService(key, urlStream);
                    if (_imagemStream == null)
                    {
                        await DisplayAlert("Erro", "Nenhuma imagem selecionada", "Ok");
                    }
                    Model = await Servico.CVSStreamAsync(_imagemStream);

                    ExibirLista(Model);
                }
                catch (System.Exception ex)
                {
                    await DisplayAlert("Erro!", $"Erro:{ex.Message}", "Ok");
                }

                finally
                {
                    IsBusy = false;
                }
            }

            return;
        }
Esempio n. 2
0
        async void ExecuteServicoCommand()
        {
            if (!IsBusy)
            {
                try
                {
                    IsBusy  = true;
                    Servico = new CVService(key, url);
                    Model   = await Servico.CVSUrlAsync(Url);

                    ExibirLista(Model);
                }
                catch (System.Exception ex)
                {
                    await DisplayAlert("Erro!", $"Erro:{ex.Message}", "Ok");
                }

                finally
                {
                    IsBusy = false;
                }
            }

            return;
        }
Esempio n. 3
0
        public PrincipalViewModel()
        {
            ServicoCommand = new Command(ExecuteServicoCommand, () => !IsBusy);
            StreamCommand  = new Command(async() => await ExecuteStreamCommand(), () => !IsBusy);
            TirarCommand   = new Command(async() => await ExecuteTirarCommand(), () => !IsBusy);
            AbrirCommand   = new Command(async() => await ExecuteAbrirCommand(), () => !IsBusy);

            Model        = new CVSModel();
            MyPrediction = new ObservableCollection <Prediction>();
        }
Esempio n. 4
0
        private void ExibirLista(CVSModel Model)
        {
            MyPrediction.Clear();

            foreach (var item in Model.Predictions)
            {
                MyPrediction.Add(new Prediction
                {
                    Tag         = item.Tag,
                    TagId       = item.TagId,
                    Probability = item.Probability
                });
            }
        }