Esempio n. 1
0
        private async Task CreateTie(EventArgs arg)
        {
            if (string.IsNullOrEmpty(Name))
            {
                await ShowDialog("Aviso", "O nome do laço não pode ficar em branco!");
            }
            else if (string.IsNullOrEmpty(Description))
            {
                await ShowDialog("Aviso", "A descrição do laço não pode ficar em branco!");
            }
            else if (Image == null)
            {
                await ShowDialog("Aviso", "A imagem do laço não pode ficar em branco!");
            }
            else
            {
                using (var context = new TiesContext())
                {
                    var tie = new Tie
                    {
                        Name        = Name,
                        Description = Description,
                        Image       = Image
                    };

                    await context.Ties.AddAsync(tie);

                    await context.SaveChangesAsync();
                }

                await ShowDialog("Sucesso", "O laço foi cadastrado com sucesso!");

                await Navigation.PopAsync();
            }
        }
Esempio n. 2
0
        private async Task Initialize(EventArgs arg)
        {
            var darkColor  = (Color)Application.Current.Resources["SecondaryDarkMainColor"];
            var lightColor = (Color)Application.Current.Resources["SecondaryLightMainColor"];

            StatusBar.SetStatusBarColor(Application.Current.RequestedTheme == OSAppTheme.Dark ? darkColor : lightColor);

            await Task.Delay(100);

            State = SplashState.LoadingDatabase;

            using (var context = new TiesContext())
                await context.Initialize();

            await Task.Delay(100);

            State = SplashState.LoadingResources;
            await Task.Delay(100);

            State = SplashState.Loaded;
            await Task.Delay(200);
        }