public WorkoutsPage()
 {
     _parent        = Shell.Current.BindingContext as MainPageViewModel;
     _viewModel     = new WorkoutsViewModel(_parent);
     BindingContext = _viewModel;
     InitializeComponent();
 }
        public WorkoutsPage()
        {
            WorkoutsViewModel wm = new WorkoutsViewModel();

            base.Appearing += (o, e) => wm.OnAppearing(o, e);
            wm.Navigation   = Navigation;
            BindingContext  = wm;
            InitializeComponent();
        }
Exemple #3
0
 public ActionResult CreateWorkout(WorkoutsViewModel workoutsViewModel)
 {
     try
     {
         string id = User.Identity.GetUserId();
         //Peak_Performance.Models.Workout myworkout = new Workout();
         Peak_Performance.Models.Workout myworkout = workoutsViewModel.createWorkout();
         int wid = myworkout.ID;
         return(Json(new { newUrl = Url.Action("WorkoutCreated", "Workouts", new { id = wid }) }));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #4
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-Us");
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard XAML initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Language display initialization
            InitializeLanguage();

            // Show graphics profiling information while debugging.
            if (Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are handed off to GPU with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Prevent the screen from turning off while under the debugger by disabling
                // the application's idle detection.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }

            //define the database data context
            db = new ObjectDataContext(DBConnectionString);

            //create the database if it does not exists
            if (!db.DatabaseExists())
            {
                //create the local database
                db.CreateDatabase();
                InitializeNewDatabase(db);

                //save workouts to the database
                db.SubmitChanges();
            }

            //Create the exercises ViewModel
            _exercisesViewModel = new ExercisesViewModel(db);
            //Query the local database and load observable collections.
            _exercisesViewModel.LoadData();

            //Create the workouts ViewModel
            _workoutsViewModel = new WorkoutsViewModel(db);
            //Query the local database and load observable collections.
            _workoutsViewModel.LoadData();

            //Create the healthy food ViewModel
            _healthyFoodViewModel = new HealthyFoodViewModel(db);
            //Query the local database and load observable collections.
            _healthyFoodViewModel.LoadData();

            //Create the avoidable foods ViewModel
            _avoidableFoodViewModel = new AvoidableFoodViewModel(db);
            //Query the local database and load observable collections.
            _avoidableFoodViewModel.LoadData();
        }
Exemple #5
0
        public WorkoutsPage()
        {
            InitializeComponent();

            BindingContext = viewModel = new WorkoutsViewModel();
        }