Ejemplo n.º 1
0
        private async void Save()
        {
            if (ValidateRecipe())
            {
                try
                {
                    UserDialogs.Instance.ShowLoading("Saving");
                    ThisRecipe             = new Recipes();
                    ThisRecipe.Title       = RecipeTitle;
                    ThisRecipe.Text        = Instructions;
                    ThisRecipe.Tags        = Tags;
                    ThisRecipe.Ingredients = Ingredients;
                    ThisRecipe.CreatedDate = DateTime.Now;
                    ThisRecipe.UpdatedDate = DateTime.Now;
                    var recp = DataRepository.Instance.Save <Recipes>(ThisRecipe);

                    if (IngredientsBlob != null && IngredientsBlob.Length > 0)
                    {
                        Pictures pic = new Pictures()
                        {
                            Blob      = IngredientsBlob,
                            RecipeeId = recp.PKId,
                            Type      = 1
                        };
                        DataRepository.Instance.Save <Pictures>(pic);
                    }

                    if (InstructionsBlob != null && InstructionsBlob.Length > 0)
                    {
                        Pictures pic = new Pictures()
                        {
                            Blob      = InstructionsBlob,
                            RecipeeId = recp.PKId,
                            Type      = 2,
                        };
                        DataRepository.Instance.Save <Pictures>(pic);
                    }

                    UserDialogs.Instance.HideLoading();
                    UserDialogs.Instance.Toast("Recipe Added");
                    App.RecipesViewModel.OnNavigatedTo();
                    await Navi.PopModal();
                }
                catch (Exception ex)
                {
                    UserDialogs.Instance.HideLoading();
                    UserDialogs.Instance.Alert(ex.Message);
                }
            }
            else
            {
                await UserDialogs.Instance.AlertAsync(ErrorMessage);
            }
        }
Ejemplo n.º 2
0
        public async void Scan()
        {
            var scanPage = new ZXingScannerPage();

            scanPage.OnScanResult += (result) => {
                // Stop scanning
                scanPage.IsScanning = false;

                // Pop the page and show the result
                Device.BeginInvokeOnMainThread(() => {
                    Navi.PopModal();
                    App.UserDialogService.AlertAsync(result.Text, "Scanned Barcode", "OK");
                });
            };

            // Navigate to our scanner page
            await Navi.PushPage(scanPage);
        }
Ejemplo n.º 3
0
        async void SignUp()
        {
            if (IsInternetConnection())
            {
                App.UserDialogService.ShowLoading("Signing up...");
                if (await CreateUser())
                {
                    if (Settings.IsFirstRun)
                    {
                        Settings.IsFirstRun = false;
                        await Navi.PopModal();

                        await Navi.PushModal(PageFac.GetPage(Pages.Guide));
                    }
                    else
                    {
                        await Navi.PopModal();
                    }
                }
                App.UserDialogService.HideLoading();
            }
        }
Ejemplo n.º 4
0
        public async void AddEvent()
        {
            App.UserDialogService.ShowLoading("Adding Event...");

            Event evt = new Event();

            evt.Name      = EventName;
            evt.StartDate = StartDateTime;
            evt.Location  = Location;
            evt.Places    = int.Parse(Places);
            evt.ProfileId = App.ThisUser.Profile.ProfileId;
            evt.IsActive  = true;


            await Evnt.AddEvent(evt);

            ResetForm();
            await Navi.PopModal();

            App.UserDialogService.HideLoading();

            App.UserDialogService.Toast("Event Added");
        }
Ejemplo n.º 5
0
        async void Login()
        {
            App.UserDialogService.ShowLoading("Signing in...");
            await Task.Delay(3000);

            User u = new User();

            u.Email    = UserName;
            u.Password = Password;
            bool success = await Acc.LoginAsync(UserName, Password);

            if (success)
            {
                App.UserDialogService.HideLoading();
                if (Settings.IsFirstRun)
                {
                    Settings.IsFirstRun = false;
                    UserName            = string.Empty;
                    Password            = string.Empty;
                    OnPropertyChanged("UserName");
                    OnPropertyChanged("Password");
                    await Navi.PopModal();

                    await Navi.PushModal(PageFac.GetPage(Pages.Guide));
                }
                else
                {
                    await Navi.PopModal();
                }
            }
            else
            {
                App.UserDialogService.HideLoading();
                await App.UserDialogService.AlertAsync("We could not log you in at this time, please try again");
            }
        }
Ejemplo n.º 6
0
 private async void Back()
 {
     await Navi.PopModal();
 }
Ejemplo n.º 7
0
 public async void Back()
 {
     ResetForm();
     await Navi.PopModal();
 }
Ejemplo n.º 8
0
 private void Close()
 {
     Navi.PopModal();
 }