Esempio n. 1
0
        /// <summary>
        /// Konstruktor
        /// </summary>
        /// <param name="nav"></param>
        /// <param name="events"></param>
        /// <param name="sync"></param>
        public BettrFitDataSource()
        {
            _sync = new SyncDataViewModel();
            Server = "https://www.bettrfit.com";
            UserData = new UserVM();
            UserGoals = new ObservableCollection<UserGoalVM>();
            Auth = new WebAccess.ServiceReference.AuthData();
            UserDaily = new ObservableCollection<UserDailyVM>();
            NutritionPlanFavorites = new ObservableCollection<NutritionPlanFavoriteVM>();
            NutritionPlanLeb = new ObservableCollection<LebensmittelVM>();
            SummaryConsumedDaytime = new WebAccess.ServiceReference.SummaryData();
            SummaryConsumedDay = new WebAccess.ServiceReference.SummaryData();

            _messenger = Mvx.Resolve<IMvxMessenger>();
            _mapper = new InitMapper();

            _messenger.Subscribe<NetworkEvent>(m => IsNetworkAvailable = m.IsAvailable);

            LoadAll();

            CheckLogin();
            //if (ret == 0)
            //{
            //    _EventAggregator = Container.Resolve<IEventAggregator>();
            //    _EventAggregator.GetEvent<LoggedInEvent>().Publish(true);
            //    _ds._loggedIn = true;
            //}
        }
Esempio n. 2
0
        public RegisterViewModel()
        {
            _ds = BettrFitDataSource.Instance;
            _sync = BettrFitDataSource.Instance._sync;

            RegisterCommand = new MvxCommand(()=>registerNewUser());

            Selected = new UserGoalVM();
            Selected.Goal_Muscle = 8;
            Selected.Goal_FatLoss = 5;
            Selected.Goal_Endurance = 2;
            Selected.WorkoutDays = 3;
            Selected.WorkoutMinutes = 45;
            _goal_Endurance = _selected.Goal_Endurance;
            _goal_FatLoss = _selected.Goal_FatLoss;
            _goal_Muscle = _selected.Goal_Muscle;
            OnPropertyChanged("Goal_Muscle");
            OnPropertyChanged("Goal_Endurance");
            OnPropertyChanged("Goal_FatLoss"); ;

            _userdata.PropertyChanged += (a, b) =>
            {                
                RaisePropertyChanged("IsValid");
            };
            _messenger = Mvx.Resolve<IMvxMessenger>();
        }