/// <summary>
        /// Initializes a new instance of the MainPViewModel class.
        /// </summary>
        public MainPViewModel(ActionRobot _axrob, IMessageBoxService _mbs)
        {
            _messageBoxService = _mbs;
            _axrobot           = _axrob;

            FondUi = "Resources\\Image\\Background\\Axi_FondEcran_T.png";

            _positionUiBuffer  = new PositionDataModel();
            _position2UiBuffer = new PositionDataModel();

            this._mainLoop     = new System.Timers.Timer();
            _mainLoop          = new System.Timers.Timer(20);                                    // Create a timer with a twenty second interval. 50Hz
            _mainLoop.Elapsed += new System.Timers.ElapsedEventHandler(OnMainLoopSequenceEvent); // Hook up the Elapsed event for the timer.
            _mainLoop.Enabled  = true;

            _positionRobotLive  = new PointCollection();
            _position2RobotLive = new PointCollection();

            _styleRobotLive  = new PolylineConfig(false, 5, "Continu", Brushes.Orange); //7.5
            _styleRobotLive2 = new PolylineConfig(false, 5, "Continu", Brushes.Orange); //7.5

            _axrobot.Pss.PositionDataReceived  += new onPositionDataReceived(_portSerieService_PositionDataReceived);
            _axrobot.Pss.Position2DataReceived += new onPosition2DataReceived(_portSerieService_Position2DataReceived);


            CreateMessages();

            Debug.Print("MainPViewModel OK");
        }
Beispiel #2
0
        public MazeCircuitCalibrationViewModel()
        {
            this.pss = SimpleIoc.Default.GetInstance <ActionRobot>();

            this.NextViewModelCommand     = new RelayCommand(this.GoNext, this.NextCanExecute);
            this.PreviousViewModelCommand = new RelayCommand(this.GoBack);
            this.HomeViewModelCommand     = new RelayCommand(this.GoHome);
            this.StartCalibrationCommand  = new RelayCommand(this.StartCalibration, StartCanExecute);
            this.StopCalibrationCommand   = new RelayCommand(this.StopCalibration, StopCanExecute);

            this.nav         = SimpleIoc.Default.GetInstance <INavigation>();
            this.pathPatient = "Files/Patients/" + singleton.Patient.Nom + singleton.Patient.Prenom + singleton.Patient.DateDeNaissance.ToString().Replace("/", string.Empty);
            this.GetPreselection();
        }
        public MazeCircuitMenuViewModel()
        {
            this.nav         = SimpleIoc.Default.GetInstance <INavigation>();
            this.pss         = SimpleIoc.Default.GetInstance <ActionRobot>();
            this.currentType = TypeMazeGame.Null;

            this.PreviousViewModelCommand  = new RelayCommand(this.GoBack);
            this.HomeViewModelCommand      = new RelayCommand(this.GoHome);
            this.ChangeExerciceTypeCommand = new RelayCommand <int>(this.ChangeExerciceType);
            this.ChangerCouleurCommand     = new RelayCommand <int>(this.ChangerCouleur);
            this.StartCommand = new RelayCommand(this.StartGame, this.Start_CanExecute);
            this.StopCommand  = new RelayCommand(this.StopGame, this.Stop_CanExecute);
            this.PauseCommand = new RelayCommand(this.PauseGame, this.Stop_CanExecute);

            // De base aucun type n'est coché donc le menu n'est pas accessible
            this.MenuEnabled = false;

            this.NewCircuitEnabled = false;

            // Création de la liste de radio button pour la séléction du circuit
            this.CircuitsEnabled = false;
            this.CircuitsCheck   = new ObservableCollection <CircuitRadio>();
            for (int i = 1; i < 9; i++)
            {
                var radio = new CircuitRadio(i.ToString());
                this.CircuitsCheck.Add(radio);
            }

            this.pathToFile = "Files/Patients/" + singleton.Patient.Nom + singleton.Patient.Prenom + singleton.Patient.DateDeNaissance.ToString().Replace("/", string.Empty) + "/Maze_Circuit";

            this.ErrorPlotPoint   = new List <DataPoint>();
            this.VitessePlotPoint = new List <DataPoint>();
            this.MaxRepetionPlot  = 10;
            this.currentColor     = TypeColors.Default;
            this.inPause          = false;
        }