예제 #1
0
        private void InitPlayerScreenMode()
        {
            switch (CurrentExercise.Mode)
            {
            case Exercise.ExerciseMode.Demo:
                SetUIInDemoMode();
                ExerciseVideo.Play();
                inPlayMode = true;
                break;

            case Exercise.ExerciseMode.NonTraceable:
                OpenNotTrackablePopUp();
                StartNonTraceableMode();
                //SetUIInNoTrackableMode();
                break;

            case Exercise.ExerciseMode.NonTraceableDuplicate:
                //SetUIInNoTrackableMode();
                StartNonTraceableMode();
                ExerciseVideo.Play();
                inPlayMode = true;

                break;

            case Exercise.ExerciseMode.Traceable:
                StartTraceableMode();
                break;

            case Exercise.ExerciseMode.TraceableDuplicate:
                StartTraceableMode();
                break;
            }
        }
예제 #2
0
 private void ChangeUIToPlayMode()
 {
     ExerciseVideo.Play();
     inPlayMode            = true;
     PlayPauseVideo.Source = new BitmapImage(new Uri("Images\\pause.png", UriKind.RelativeOrAbsolute));
     PlayPauseVideo.Margin = new Thickness(0, 0, 0, 0);
 }
예제 #3
0
        public ActionResult Create(ExerciseViewModel exerciseViewModel)
        {
            if (ModelState.IsValid)
            {
                Exercise ex = new Exercise();
                ex.ExerciseRegionID = exerciseViewModel.ExerciseRegionID;
                ex.ExerciseTypeID   = exerciseViewModel.ExerciseTypeID;
                ex.Name             = exerciseViewModel.Exercise;
                ex.Description      = exerciseViewModel.ExerciseDescription;
                db.Exercises.Add(ex);
                db.SaveChanges();

                ExerciseVideo ev = new ExerciseVideo();
                ev.ExerciseID = ex.ExerciseID;
                ev.VideoURL   = exerciseViewModel.VideoURL;
                db.ExerciseVideos.Add(ev);
                db.SaveChanges();

                ExerciseImage eI = new ExerciseImage();
                eI.ExerciseID = ex.ExerciseID;
                eI.ImageURL   = exerciseViewModel.ImageURL;
                db.ExerciseImages.Add(eI);
                db.SaveChanges();
                TempData["Message"] = "Successfully created exercise - " + ex.Name;
                return(RedirectToAction("Index", "ExerciseViewModel"));
            }
            return(RedirectToAction("Index", "Home"));
        }
예제 #4
0
        // GET: PatientViewAssignment
        public ActionResult Index()
        {
            string  username    = System.Web.HttpContext.Current.User.Identity.Name;
            Patient findPatient = db.Patients.SingleOrDefault(p => p.Patient_Email == username);
            int     patientID   = findPatient.PatientID;

            Assignment assignment = db.Assignments.SingleOrDefault(a => a.PatientID == patientID);

            Therapist           therapist = db.Therapists.SingleOrDefault(t => t.TherapistID == assignment.TherapistID);
            ExerciseInstruction eI        = db.ExerciseInstructions.SingleOrDefault(e => e.AssignmentID == assignment.AssignmentID);

            AssignedVideo  aV       = db.AssignedVideos.SingleOrDefault(a => a.ExerciseInstructionID == eI.ExerciseInstructionID);
            ExerciseVideo  eV       = db.ExerciseVideos.SingleOrDefault(e => e.ExerciseVideoID == aV.ExerciseVideoID);
            Exercise       exercise = db.Exercises.SingleOrDefault(e => e.ExerciseID == eV.ExerciseID);
            ExerciseRegion region   = db.ExerciseRegions.SingleOrDefault(c => c.ExerciseRegionID == exercise.ExerciseRegionID);

            ViewBag.assignment        = assignment.AssignmentID;
            ViewBag.therapist         = therapist.Name;
            ViewBag.Number_Of_Reps    = eI.Number_Of_Reps;
            ViewBag.Frequency_Per_Day = eI.Frequency_Per_Day;
            ViewBag.Remark            = eI.Remark;
            ViewBag.eV           = eV.VideoURL;
            ViewBag.exerciseName = exercise.Name;
            ViewBag.cat          = region.Name;

            return(View());
        }
예제 #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            ExerciseVideo exerciseVideo = db.ExerciseVideos.Find(id);

            db.ExerciseVideos.Remove(exerciseVideo);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #6
0
        private void CloseAllComponents()
        {
            ExerciseVideo.Stop();

            //clearing the view
            KinectShilloute.Source = null;
            KinectSkeleton.Source  = null;

            Dispose();
        }
예제 #7
0
        private void UpdateExerciseUI()
        {
            PlayerControl.Visibility           = Visibility.Visible;
            ExerciseStatus.DataContext         = CurrentExercise.CurrentRound;
            RoundIndexText.DataContext         = CurrentExercise.CurrentRound;
            RoundMotionQualityGrid.DataContext = CurrentExercise.CurrentRound;

            Binding videoBinding = new Binding("VideoPath");

            ExerciseVideo.SetBinding(MediaElement.SourceProperty, videoBinding);
        }
예제 #8
0
 public ActionResult Edit([Bind(Include = "ExerciseVideoID,VideoURL,ExerciseID")] ExerciseVideo exerciseVideo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(exerciseVideo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ExerciseID = new SelectList(db.Exercises, "ExerciseID", "Name", exerciseVideo.ExerciseID);
     return(View(exerciseVideo));
 }
예제 #9
0
        public ActionResult Create([Bind(Include = "ExerciseVideoID,VideoURL,ExerciseID")] ExerciseVideo exerciseVideo)
        {
            if (ModelState.IsValid)
            {
                db.ExerciseVideos.Add(exerciseVideo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ExerciseID = new SelectList(db.Exercises, "ExerciseID", "Name", exerciseVideo.ExerciseID);
            return(View(exerciseVideo));
        }
예제 #10
0
        public void CloseNotTrackablePopUp()
        {
            if (ExerciseWindow.Children.Contains(noTrackingPopUp))
            {
                ExerciseWindow.Children.Remove(noTrackingPopUp);
                noTrackingPopUp.StopTimer();
            }


            ExerciseVideo.Play();
            inPlayMode = true;
        }
예제 #11
0
        public ActionResult Edit(int?ExerciseViewModelID)
        {
            if (ExerciseViewModelID == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            List <ExerciseViewModel> evmLIst = new List <ExerciseViewModel>();
            int             a        = 0;
            List <Exercise> exercise = db.Exercises.ToList();

            foreach (var item in exercise)
            {
                ExerciseViewModel evm = new ExerciseViewModel();
                a = a + 1;
                evm.ExerciseViewModelID = a;
                evm.ExerciseRegion      = db.ExerciseRegions.Find(item.ExerciseRegionID);
                evm.ExerciseDescription = item.Description;
                evm.ExerciseType        = db.ExerciseTypes.Find(item.ExerciseTypeID);
                evm.ExerciseID          = item.ExerciseID;
                int           ExerciseID = item.ExerciseID;
                ExerciseVideo ev         = db.ExerciseVideos.Where(m => m.ExerciseID == item.ExerciseID).SingleOrDefault();
                evm.VideoURL = ev.VideoURL;
                evm.ImageURL = "";
                evm.Exercise = item.Name;
                evmLIst.Add(evm);
            }
            ExerciseViewModel ex = new ExerciseViewModel();
            Exercise          e  = new Exercise();

            foreach (var item in evmLIst)
            {
                int exID = item.ExerciseViewModelID;
                if (exID == ExerciseViewModelID)
                {
                    ex.ExerciseRegion      = db.ExerciseRegions.Find(item.ExerciseRegion.ExerciseRegionID);
                    ex.ExerciseRegionID    = ex.ExerciseRegion.ExerciseRegionID;
                    ex.ExerciseDescription = item.ExerciseDescription;
                    ex.ExerciseType        = db.ExerciseTypes.Find(item.ExerciseType.ExerciseTypeID);
                    ex.ExerciseTypeID      = ex.ExerciseType.ExerciseTypeID;
                    ex.ExerciseID          = item.ExerciseID;
                    e = db.Exercises.Where(m => m.Name == item.Exercise).Single();
                    ExerciseVideo ev = db.ExerciseVideos.Where(m => m.ExerciseID == e.ExerciseID).SingleOrDefault();
                    ex.VideoURL = ev.VideoURL;
                    ex.ImageURL = "";
                    ex.Exercise = item.Exercise;
                }
            }
            ViewBag.ExerciseRegion = db.ExerciseRegions.ToList();
            ViewBag.ExerciseType   = db.ExerciseTypes.ToList();
            return(View(ex));
        }
예제 #12
0
        // GET: ExerciseVideos/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ExerciseVideo exerciseVideo = db.ExerciseVideos.Find(id);

            if (exerciseVideo == null)
            {
                return(HttpNotFound());
            }
            return(View(exerciseVideo));
        }
예제 #13
0
        // GET: ExerciseVideos/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ExerciseVideo exerciseVideo = db.ExerciseVideos.Find(id);

            if (exerciseVideo == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ExerciseID = new SelectList(db.Exercises, "ExerciseID", "Name", exerciseVideo.ExerciseID);
            return(View(exerciseVideo));
        }
예제 #14
0
        private void ExerciseView_Loaded(object sender, RoutedEventArgs e)
        {
            CreatePopUps();

            CreatePauseTimer();

            UserProfile.DataContext = CurrentPatient;

            RemoveUpperLayer();

            ExerciseVideo.Source = new Uri(VT_Intro);
            ExerciseVideo.Play();

            //CurrentExercise = CurrentTraining.GetNextExercise();
            //UpdatePlayerAfterExerciseChange();
        }
예제 #15
0
        private void OpenNotTrackablePopUp()
        {
            ExerciseVideo.Stop();

            noTrackingPopUp = new NoTrackingPopUp();
            int width  = (int)(ActualWidth * 0.45);
            int height = (int)(ActualHeight * 0.65);

            noTrackingPopUp.SetSize(height, width);
            noTrackingPopUp.ExerciseView = this;

            if (!ExerciseWindow.Children.Contains(noTrackingPopUp))
            {
                ExerciseWindow.Children.Add(noTrackingPopUp);
                noTrackingPopUp.StartTimer();
            }
        }
예제 #16
0
        public ActionResult Edit(ExerciseViewModel exerciseViewModel)
        {
            if (ModelState.IsValid)
            {
                Exercise exercise = db.Exercises.SingleOrDefault(p => p.ExerciseID == exerciseViewModel.ExerciseID);

                exercise.Name             = exerciseViewModel.Exercise;
                exercise.ExerciseRegionID = exerciseViewModel.ExerciseRegionID;
                exercise.ExerciseTypeID   = exerciseViewModel.ExerciseTypeID;
                db.Entry(exercise).State  = EntityState.Modified;
                db.SaveChanges();

                ExerciseVideo exVid = db.ExerciseVideos.SingleOrDefault(p => p.ExerciseID == exerciseViewModel.ExerciseID);
                db.Entry(exVid).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(RedirectToAction("Index"));
        }
예제 #17
0
        public ActionResult AssignExercisesViewModel(List <AssignExercisesViewModel> aE, int pID)
        {
            if (ModelState.IsValid)
            {
                foreach (var i in aE)
                {
                    //create assignment
                    Assignment assignment = new Assignment();
                    assignment.Date_Assigned = DateTime.Now;
                    assignment.PatientID     = pID;
                    Patient   patient   = db.Patients.Find(pID);
                    string    email     = User.Identity.GetUserName();
                    Therapist therapist = db.Therapists.SingleOrDefault(T => T.Email == email);
                    assignment.TherapistID = therapist.TherapistID;
                    db.Assignments.Add(assignment);
                    db.SaveChanges();


                    //create Exercise Instruction
                    ExerciseInstruction exerciseInstruction = new ExerciseInstruction();
                    exerciseInstruction.Number_Of_Reps    = i.Number_Of_Reps;
                    exerciseInstruction.Frequency_Per_Day = i.Frequency_Per_Day;
                    exerciseInstruction.Remark            = i.Remark;
                    exerciseInstruction.Reps_Completed    = 0;
                    exerciseInstruction.AssignmentID      = assignment.AssignmentID;
                    db.ExerciseInstructions.Add(exerciseInstruction);
                    db.SaveChanges();

                    //create assignedVideo
                    AssignedVideo assignedVideo = new AssignedVideo();
                    assignedVideo.ExerciseInstructionID = exerciseInstruction.ExerciseInstructionID;
                    ExerciseVideo eV = db.ExerciseVideos.SingleOrDefault(e => e.ExerciseID == i.ExerciseID);
                    assignedVideo.ExerciseVideoID = eV.ExerciseVideoID;
                    db.AssignedVideos.Add(assignedVideo);
                    db.SaveChanges();
                    return(RedirectToAction("Index", "AssignExercisesViewModel"));
                }
            }
            return(View(aE));
        }
예제 #18
0
        public ActionResult retrieveBySelected(int exerciseRegionID, int exerciseTypeID)
        {
            ExerciseVideo   exerciseVideo = new ExerciseVideo();
            List <Exercise> list          = db.Exercises.ToList();
            PublicModule    publicmod     = new PublicModule();

            foreach (Exercise e in list)
            {
                if (e.ExerciseTypeID == exerciseTypeID && e.ExerciseRegionID == exerciseRegionID)
                {
                    exerciseVideo = db.ExerciseVideos.Where(m => m.ExerciseID == e.ExerciseID).SingleOrDefault();
                    Exercise       exercise       = db.Exercises.Find(exerciseVideo.ExerciseID);
                    ExerciseType   exerciseType   = db.ExerciseTypes.Find(exercise.ExerciseTypeID);
                    ExerciseRegion exerciseRegion = db.ExerciseRegions.Find(exercise.ExerciseRegionID);
                    publicmod.VideoURL       = exerciseVideo.VideoURL;
                    publicmod.ExerciseName   = exercise.Name;
                    publicmod.ExerciseRegion = exerciseRegion.Name;
                    publicmod.ExerciseType   = exerciseType.Name;
                }
            }
            return(Json(publicmod, JsonRequestBehavior.AllowGet));
        }
예제 #19
0
        // GET: ExerciseViewModel
        public ActionResult Index()
        {
            List <ExerciseViewModel> evmLIst = new List <ExerciseViewModel>();
            int             a        = 0;
            List <Exercise> exercise = db.Exercises.ToList();

            foreach (var item in exercise)
            {
                ExerciseViewModel evm = new ExerciseViewModel();
                a = a + 1;
                evm.ExerciseViewModelID = a;
                evm.ExerciseRegion      = db.ExerciseRegions.Find(item.ExerciseRegionID);
                evm.ExerciseDescription = item.Description;
                evm.ExerciseType        = db.ExerciseTypes.Find(item.ExerciseTypeID);
                int           ExerciseID = item.ExerciseID;
                ExerciseVideo ev         = db.ExerciseVideos.Where(m => m.ExerciseID == ExerciseID).SingleOrDefault();
                evm.VideoURL = ev.VideoURL;
                evm.ImageURL = "";
                evm.Exercise = item.Name;
                evmLIst.Add(evm);
            }
            return(View(evmLIst));
        }
예제 #20
0
        private void StartTraceableMode()
        {
            SetUIInTrackingMode();

            //ExerciseVideo.Play();

            _sensor = KinectSensor.GetDefault();

            //todo - check, not working
            if (_sensor != null)
            {
                _sensor.Open();

                // 2) Initialize the background removal tool.
                _backgroundRemovalTool = new BackgroundRemovalTool(_sensor.CoordinateMapper);
                _drawSkeleton          = new DrawSkeleton(_sensor, (int)(KinectSkeleton.Width), (int)(KinectSkeleton.Height));

                _reader = _sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth | FrameSourceTypes.BodyIndex | FrameSourceTypes.Body);
                _reader.MultiSourceFrameArrived += Reader_MultiSourceFrameArrived;

                //Gesture detection
                Exercise tempExercise = CurrentExercise;

                _gestureAnalysis = new GestureAnalysis(ref tempExercise);
                _gestureDetector = new GestureDetector(_sensor, _gestureAnalysis, CurrentExercise);

                _gestureAnalysis.startGestureDeteced += _gestureAnalysis_startGestureDeteced;

                CurrentExercise.CreateRounds();

                //_timer.Start();
            }

            ExerciseVideo.Play();
            inPlayMode = true;
        }