Esempio n. 1
0
        /// <summary>
        /// Fin de la calibration, quand la position est idéale
        /// </summary>
        private void StopCalibration()
        {
            if (this.game != null)
            {
                this.game.StopGame();
                this.game        = null;
                this.gameStarted = false;
                this.StopCalibrationCommand.RaiseCanExecuteChanged();

                XDocument doc;

                if (File.Exists(this.pathPatient + "/InfoPatient.xml"))
                {
                    doc = XDocument.Load(this.pathPatient + "/InfoPatient.xml");

                    if (Singleton.UniBi == true && Singleton.MainGaucheX == true)
                    {
                        doc.Root.Element("Uni_Gauche").Element("CalibrX").ReplaceNodes(this.calibrX / 100.0);
                        doc.Root.Element("Uni_Gauche").Element("CalibrY").ReplaceNodes(this.calibrY / 100.0);
                    }
                    else if (Singleton.UniBi == true && Singleton.MainGaucheX == false)
                    {
                        doc.Root.Element("Uni_Droit").Element("CalibrX").ReplaceNodes(this.calibrX / 100.0);
                        doc.Root.Element("Uni_Droit").Element("CalibrY").ReplaceNodes(this.calibrY / 100.0);
                    }
                    else if (Singleton.UniBi == false && Singleton.MainGaucheX == true)
                    {
                        doc.Root.Element("Bi_Gauche").Element("CalibrX").ReplaceNodes(this.calibrX / 100.0);
                        doc.Root.Element("Bi_Gauche").Element("CalibrY").ReplaceNodes(this.calibrY / 100.0);
                    }
                    else if (Singleton.UniBi == false && Singleton.MainGaucheX == false)
                    {
                        doc.Root.Element("Bi_Droit").Element("CalibrX").ReplaceNodes(this.calibrX / 100.0);
                        doc.Root.Element("Bi_Droit").Element("CalibrY").ReplaceNodes(this.calibrY / 100.0);
                    }


                    doc.Save(this.pathPatient + "/InfoPatient.xml");

                    Singleton.CalibrX = this.calibrX / 100.0;
                    Singleton.CalibrY = this.calibrY / 100.0;
                }
            }

            this.pss.Pss.SendCommandFrame(CommandCodes.STOPnv);
            this.pss.Pss.PositionDataReceived  -= new AxCommunication.onPositionDataReceived(Pss_PositionDataReceived);
            this.pss.Pss.Position2DataReceived -= new AxCommunication.onPosition2DataReceived(Pss_Position2DataReceived);

            this.canNext = true;
            NextViewModelCommand.RaiseCanExecuteChanged();
        }
Esempio n. 2
0
        /// <summary>
        /// Gestion de la préslection des options si ce n'est pas la première fois que le patient fait l'exercice
        /// </summary>
        private void GetPreselection()
        {
            if (File.Exists(this.pathPatient + "/InfoPatient.xml"))
            {
                // Si le fichier existe c'est que l'exercice à déjà été réalisé et qu'une préselection est possible
                XDocument doc = XDocument.Load(this.pathPatient + "/InfoPatient.xml");
                if (doc != null)
                {
                    foreach (var elem in doc.Root.Elements())
                    {
                        if (elem.Name == "Uni_Gauche" && Singleton.UniBi == true && Singleton.MainGaucheX == true)
                        {
                            if (elem.Element("CalibrX").Value != string.Empty)
                            {
                                this.calibrX = Convert.ToDouble(elem.Element("CalibrX").Value.Replace('.', ','));
                            }
                            if (elem.Element("CalibrY").Value != string.Empty)
                            {
                                this.calibrY = Convert.ToDouble(elem.Element("CalibrY").Value.Replace('.', ','));
                            }
                        }
                        else if (elem.Name == "Uni_Droit" && Singleton.UniBi == true && Singleton.MainGaucheX == false)
                        {
                            if (elem.Element("CalibrX").Value != string.Empty)
                            {
                                this.calibrX = Convert.ToDouble(elem.Element("CalibrX").Value.Replace('.', ','));
                            }
                            if (elem.Element("CalibrY").Value != string.Empty)
                            {
                                this.calibrY = Convert.ToDouble(elem.Element("CalibrY").Value.Replace('.', ','));
                            }
                        }
                        else if (elem.Name == "Bi_Gauche" && Singleton.UniBi == false && Singleton.MainGaucheX == true)
                        {
                            if (elem.Element("CalibrX").Value != string.Empty)
                            {
                                this.calibrX = Convert.ToDouble(elem.Element("CalibrX").Value.Replace('.', ','));
                            }
                            if (elem.Element("CalibrY").Value != string.Empty)
                            {
                                this.calibrY = Convert.ToDouble(elem.Element("CalibrY").Value.Replace('.', ','));
                            }
                        }
                        else if (elem.Name == "Bi_Droit" && Singleton.UniBi == false && Singleton.MainGaucheX == false)
                        {
                            if (elem.Element("CalibrX").Value != string.Empty)
                            {
                                this.calibrX = Convert.ToDouble(elem.Element("CalibrX").Value.Replace('.', ','));
                            }
                            if (elem.Element("CalibrY").Value != string.Empty)
                            {
                                this.calibrY = Convert.ToDouble(elem.Element("CalibrY").Value.Replace('.', ','));
                            }
                        }
                    }

                    if (this.calibrX != 0.0 && this.calibrY != 0.0)
                    {
                        Singleton.CalibrX = this.calibrX;
                        Singleton.CalibrY = this.calibrY;
                        this.canNext      = true;
                        NextViewModelCommand.RaiseCanExecuteChanged();
                    }
                }
            }
        }