public NutritionPlanOverviewViewModel()
        {
            _ds = BettrFitDataSource.Instance;

            _messenger = Mvx.Resolve<IMvxMessenger>();
            _synctoken = _messenger.Subscribe<SyncEvent>(a => RaisePropertyChanged("Sync"));
            CurrentDate = DateTime.Now;

            NutritionPlanCreateCommand = new MvxCommand(OnCreateNutritionPlan);
        }
Ejemplo n.º 2
0
        public FeedbackViewModel()
        {
            _ds = BettrFitDataSource.Instance;

            SendCommand = new MvxCommand(OnSend);

            _messenger = Mvx.Resolve<IMvxMessenger>();
            _synctoken = _messenger.Subscribe<SyncEvent>(a => RaisePropertyChanged("Sync"));

            //var client = WebService.Instance.WS;

            RaisePropertyChanged("Sync");
        }
Ejemplo n.º 3
0
        public MainViewModel()
        {
            _ds = BettrFitDataSource.Instance;
            _messenger = Mvx.Resolve<IMvxMessenger>();

            _mapNav = new Dictionary<string, Type>();
            _mapNav.Add(menuNutritionPlan, typeof(NutritionPlanOverviewViewModel));
            _mapNav.Add(menuNutritiondiary, typeof(NutritionPlanMainViewModel));
            _mapNav.Add(menuGoals, typeof(GoalOverviewViewModel));
            _mapNav.Add(menuNutrition, typeof(NutritionPlanMainViewModel));
            _mapNav.Add(menuWeight, typeof(DailyDataOverviewViewModel));

            _mapNav.Add("Login", typeof(LoginViewModel));
            _mapNav.Add("Login mit Facebook", typeof(FirstViewModel));
            _mapNav.Add(CultureHelper.GetLocalString("Register|Registrieren"), typeof(RegisterViewModel));

            NavCommands = new ObservableCollection<NavEntry>();

            NavCommand = new MvxCommand<string>(OnNavCommand);

            LogoffCommand = new MvxCommand(OnLogoffCommand);
            RefreshCommand = new MvxCommand(OnRefreshCommand);
            ShowInfoCommand = new MvxCommand(OnShowInfo);
            FeedbackCommand = new MvxCommand(OnFeedbackCommand);
            ShakeCommand = new MvxCommand(()=>_messenger.Publish(new ShakeEvent(this)));

            ShowAGBCommand = new MvxCommand(OnShowAGB);

            _logintoken = _messenger.Subscribe<LoggedInEvent>(a => LoginChanged(a.LoggedIn));
            _synctoken = _messenger.Subscribe<SyncEvent>(a => RaisePropertyChanged("Sync"));
            _nonetworktoken = _messenger.SubscribeOnMainThread<NetworkEvent>(m =>
            {
                IsNetworkAvailable = m.IsAvailable;
            });

            LoginChanged(_ds.IsLoggedIn());

            //var client = WebService.Instance.WS;

            RaisePropertyChanged("Sync");

            IsNotRefreshing = true;
        }
Ejemplo n.º 4
0
        public GoalOverviewViewModel()
        {
            //this.DefaultViewModel["Lebensmittel"] = ds.CurrentLebensmittel;
            //this.DefaultViewModel["Items"] = ds.LebensmittelConsumed;
            //this.DefaultViewModel["SelectedConsumed"] = ds.SelectedConsumed;
            //this.DefaultViewModel["Search"] = ds.LebensmittelResult;
            //this.DefaultViewModel["CurrentLebensmittel"] = ds.CurrentLebensmittel;
            //this.DefaultViewModel["SummaryConsumedDay"] = ds.SummaryConsumedDay;
            //this.DefaultViewModel["SummaryConsumedDaytime"] = ds.SummaryConsumedDaytime;

            ds = BettrFitDataSource.Instance;

            //SelectedConsumed = null;

            AddDailyCommand = new MvxCommand(AddDaily, canAddDaily);
            DeleteDailyCommand = new MvxCommand(DeleteDaily, canDeleteDaily);
            EditDailyCommand = new MvxCommand(EditDaily, ()=> CanEditDaily);

            MaxDate = DateTime.Today;
            MinDate = MaxDate - TimeSpan.FromDays(12 * 30);
        }
        public NutritionPlanCreateViewModel()
        {
            _ds = BettrFitDataSource.Instance;

            _messenger = Mvx.Resolve<IMvxMessenger>();
            _synctoken = _messenger.Subscribe<SyncEvent>(a => RaisePropertyChanged("Sync"));
            CurrentDate = DateTime.Now;

            NutritionPlanCreateCommand = new MvxCommand(OnCreateNutritionPlan);

            SelectedDate = DateTime.Now;
            
            PlanList = new ObservableCollection<string>();

            AllPlans = new ObservableCollection<NutritionPlanVM>();

            fillPlanlist();

            _ds.CalcBMR(_ds.UserData, ref _bmr, ref _act, ref _weight,ref _calcString);
            SelectedCalories = (int)(ACT*0.9d);
        }
Ejemplo n.º 6
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>();
        }