private void BtnDialogOk_Click(object sender, RoutedEventArgs e)
        {
            VideoModel video = (VideoModel)DataContext;

            video.Filename      = lbFilename.Content.ToString();
            video.Power         = Int32.Parse(txtAnswer.Text);
            video.IsCalibration = (bool)chkCalibration.IsChecked;
            this.DialogResult   = true;
        }
Beispiel #2
0
        /// <summary>
        /// Adds a new video to VideoList.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnAddVideo_Click(object sender, RoutedEventArgs e)
        {
            VideoModel       vm      = new VideoModel();
            SessionViewModel session = (SessionViewModel)this.DataContext;
            VideoInputDialog input   = new VideoInputDialog();

            input.DataContext = vm;

            if (input.ShowDialog() == true)
            {
                vm = (VideoModel)input.DataContext;

                if (vm.Filename.Length > 0 && vm.Power > 0)
                {
                    session.VideoList.Add(vm);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Loads Xml data of a specific node into SessionModel instance.
        /// </summary>
        /// <param name="node">XMLNode to be loaded int SessionModel instance</param>
        /// <returns></returns>
        public SessionModel LoadSession(XmlNode node)
        {
            SessionModel s = new SessionModel();

            s.SessionId   = Int32.Parse(node.Attributes["Id"].Value);
            s.SessionName = node.Attributes["Name"].Value;
            s.ThighLength = Double.Parse(node.Attributes["Thigh"].Value);
            s.ShankLength = Double.Parse(node.Attributes["Shank"].Value);
            s.SessionDate = node.Attributes["Date"].Value;
            s.Modality    = node.Attributes["Modality"].Value;
            s.SessionType = node.Attributes["Type"].Value;
            s.VideoList   = new ObservableCollection <VideoModel>();

            foreach (XmlNode child in node)
            {
                // Has to check if child is not Calibration
                if (child.Name == "Video")
                {
                    VideoModel video = new VideoModel();

                    video.Sequence = Int32.Parse(child.Attributes["Sequence"].Value);
                    video.Power    = Int32.Parse(child.Attributes["Power"].Value);

                    if (child.Attributes["Calibration"].Value == "True")
                    {
                        video.IsCalibration = true;
                    }
                    else
                    {
                        video.IsCalibration = false;
                    }

                    video.Filename = child.InnerText;

                    s.VideoList.Add(video);
                }
                else if (child.Name == "Calibration")
                {
                    if (s.Calibration == null)
                    {
                        s.Calibration = new CalibrationModel();
                    }
                    s.Calibration.CalSessionId = s.SessionId;
                    s.Calibration.NumFrames    = Int32.Parse(child.Attributes["NumFrames"].Value);
                    s.Calibration.JointType    = (JointType)Int32.Parse(child.Attributes["JointType"].Value);

                    s.Calibration.InitialTime = Int64.Parse(child.Attributes["InitialTime"].Value);

                    // Gets calibration information
                    float x, y, z;
                    x = float.Parse(child.Attributes["X"].Value);
                    y = float.Parse(child.Attributes["Y"].Value);
                    z = float.Parse(child.Attributes["Z"].Value);
                    s.Calibration.Position = new Vector3(x, y, z);

                    // Gets threshold information
                    x = float.Parse(child.Attributes["TX"].Value);
                    y = float.Parse(child.Attributes["TY"].Value);
                    z = float.Parse(child.Attributes["TZ"].Value);
                    s.Calibration.Threshold = new Vector3(x, y, z);

                    // Gets standard deviation information
                    x = float.Parse(child.Attributes["SDX"].Value);
                    y = float.Parse(child.Attributes["SDY"].Value);
                    z = float.Parse(child.Attributes["SDZ"].Value);
                    s.Calibration.SD = new Vector3(x, y, z);

                    // Gets estimated initial joint position information
                    x = float.Parse(child.Attributes["EX"].Value);
                    y = float.Parse(child.Attributes["EY"].Value);
                    z = float.Parse(child.Attributes["EZ"].Value);
                    s.Calibration.Estimated = new Vector3(x, y, z);

                    // Gets segments lengths
                    s.Calibration.LeftShankLength  = double.Parse(child.Attributes["LShank"].Value);
                    s.Calibration.LeftThighLength  = double.Parse(child.Attributes["LThigh"].Value);
                    s.Calibration.RightShankLength = double.Parse(child.Attributes["RShank"].Value);
                    s.Calibration.RightThighLength = double.Parse(child.Attributes["RThigh"].Value);
                }
            }
            return(s);
        }