private async void RunOpenHome(Type obj) { try{ var user = await myBl.GetUserByEmail(email); if (user == null) { await _myMessageDialog.ShowInfoDialogAsync("Invalid User Email Or Wrong Password!"); } else { var loginEmail = email.ToLower(); var userEmail = user.Email.ToLower(); if (user != null && loginEmail == userEmail && user.Password == password) { await myBl.SetCurrentUser(user.Email); _eventAggregator.GetEvent <OpenHomeEvent>().Publish(); } else if (loginEmail != userEmail || user.Password != password) { await _myMessageDialog.ShowInfoDialogAsync("Invalid User Email Or Wrong Password!"); } } } catch (Exception e) { await _myMessageDialog.ShowInfoDialogAsync(e.Message); } }
private async Task SaveGoal() { try { Goal temp = new Goal(); temp.Date = myGoal.Date; temp.Calories = myGoal.Calories; temp.Carbohydrate = myGoal.Carbohydrate; temp.Fat = myGoal.Fat; temp.Protein = myGoal.Protein; temp.Sodium = myGoal.Sodium; temp.Sugar = myGoal.Sugar; // myGoal = temp; await myBl.AddGoal(temp); await _myMessageDialog.ShowInfoDialogAsync("Goal Saved!"); OnPropertyChanged(); } catch (Exception ex) { updateMyGoal(); await _myMessageDialog.ShowInfoDialogAsync(ex.Message); } }
private async Task SaveBodyMeasurements() { try { BodyMeasurement temp = new BodyMeasurement(); temp.Date = myBodyMeasurements.Date; temp.Weight = myBodyMeasurements.Weight; temp.Height = myBodyMeasurements.Height; await myBl.AddBodyMeasurement(temp); await _myMessageDialog.ShowInfoDialogAsync("Body Measurement Saved!"); OnPropertyChanged(); } catch (Exception ex) { updateMyBodyMeasurements(); await _myMessageDialog.ShowInfoDialogAsync(ex.Message); } }
private async Task AddSelectedFood() { Meal tempMeal = new Meal(); FoodItem temp = new FoodItem(); temp.Id = Guid.NewGuid(); temp.ImageUrl = selectedSearchFood.ImageUrl; temp.Name = selectedSearchFood.Name; temp.Nutritions = selectedSearchFood.Nutritions; temp.TagId = selectedSearchFood.TagId; myMeal.FoodItems.Add(temp); tempMeal.Date = myMeal.Date; tempMeal.FoodItems.Add(temp); updateMyFoodToday(); await myBl.AddMeal(tempMeal); await _myMessageDialog.ShowInfoDialogAsync("Food Added!"); OnPropertyChanged(); }
private async void RunOpenHome(Type obj) { try { await myBl.AddUser(regUser); await myBl.SetCurrentUser(regUser.Email); _eventAggregator.GetEvent <OpenHomeEvent>().Publish(); } catch (Exception e) { await _myMessageDialog.ShowInfoDialogAsync(e.Message); } }
private async void OpenHome() { if (IsHamburgerMenuEnable == false) { IsHamburgerMenuEnable = true; } if (HomeView == null) { HomeView = new HomeView(); } SelectedView = HomeView; IsLogoutSelected = false; IsHomeSelected = true; if (!isLoginNow) { isLoginNow = true; var user = await myBl.GetCurrentUser(); await _myMessageDialog.ShowInfoDialogAsync("Welcome " + user.FirstName + " " + user.LastName + "!"); } }