コード例 #1
0
 public void WijzigResultaat()
 {
     if (SelectedResultaat != null)
     {
         BackWithRefresh = true;
         ResultaatDataService rds = new ResultaatDataService();
         // controleren of de fields zijn ingevuld
         if (SelectedResultaat.Datum == null || SelectedResultaat.AlgorithmId < 1)
         {
             MessageBoxResult result = MessageBox.Show("Please fill in all fields.",
                                                       "Information", MessageBoxButton.OK, MessageBoxImage.Information);
         }
         else
         {
             // controleren of update of insert moet zijn
             if (SelectedResultaat.Id == 0)
             {
                 rds.RegisterTime(SelectedResultaat.Sessie, SelectedResultaat.AlgorithmId, SelectedResultaat.Datum, SelectedResultaat.Tijd);
             }
             else
             {
                 rds.UpdateTime(SelectedResultaat);
             }
             BackWithRefresh = true;
             // datum selecteren om te refreshen met binding
             SelectedDatum = SelectedResultaat;
             refreshResutaten();
         }
         //Resultaat leegmaken om messagebox te tonen "You have selected a Date, not a Result..." in functie deleteResultaat()
         SelectedResultaat = null;
         SelectedAlgorithm = null;
         // delete button inschakelen
         DeleteButtonEnabled = true;
     }
 }
コード例 #2
0
        //*****CONSTRUCTOR*****
        public ResultaatWindowViewModel()
        {
            //laden data
            AlgorithmDataService ads = new AlgorithmDataService();

            Algorithms = ads.GetAlgorithms(0);
            ResultaatDataService rds = new ResultaatDataService();

            Resultaten = rds.GetResultaten();

            // unieke datums uit de collection halen en opslaan in 'Datums'
            DateTime _vorigeDatum = new DateTime().Date;

            foreach (Resultaat Resultaat in Resultaten)
            {
                if (Resultaat.Datum.Date != _vorigeDatum)
                {
                    Datums.Add(Resultaat);
                    _vorigeDatum = Resultaat.Datum.Date;
                }
            }

            //koppelen commands
            ExitCommand             = new BaseCommand(Exit);
            WijzigResultaatCommand  = new BaseCommand(WijzigResultaat);
            VoegResultaatToeCommand = new BaseCommand(VoegResultaatToe);
            DeleteResultaatCommand  = new BaseCommand(DeleteResultaat);

            //instantiëren DialogService als singleton
            _dialogService = new DialogService();
        }
コード例 #3
0
        // Button_Start
        // timer stoppen | timer2(countdown) starten
        private void StartStopTimer()
        {
            // ButtonClick tijdens inpectieTijd
            if (InspectionOn)
            {
                SkipInspection = true;
            }
            else
            {
                SkipInspection = false;
            }

            // ButtonClick tijdens de timer loopt
            if (TimerOn == false)
            {
                TimerOn = true;
                // timer stoppen
                _stopWatch.Stop();
                // text knop aanpassen
                TimerStatus = "START";
                if (InspectionOn == false)
                {
                    // verstreken tijd opslaan
                    ResultaatDataService rds = new ResultaatDataService();
                    LaatsteInsertedId = rds.RegisterTime(_nieuweSessie, RandomAlgorithm.Id, _huidigeDag, _elapsedTime);
                    refreshLastAlgorithm(RandomAlgorithm.Id);
                    //wanneer de timer start, de "reset active", "delete last" en "show only this sessions" inschakelen
                    FunctionIsActive = true;
                }
            }

            // ButtonClick wanneer geen timer loopt (BEGINSTATUS)
            else
            {
                // enkel de timer kunnen starten indien er tenminste 1 algorithm "actief" is
                if (ActieveAlgorithmIds.Count > 0)
                {
                    //wanneer de timer start, de "reset active", "delete last" en "show only this sessions" uitshakelen
                    FunctionIsActive = false;
                    TimerOn          = false;
                    //nieuw algorithm uit collection halen
                    generateRandomAlgorithm();
                    //countdown starten
                    _inspection = InspectionTime;
                    _timer2.Start();
                    TimerStatus  = "Inspection";
                    TimerDisplay = _inspection.ToString();
                }
                else
                {
                    MessageBox.Show("All Alorithms are disabled. Please enable some Algorithms to use the timer.", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
        }
コード例 #4
0
 // buttons
 // button_DeleteLastTime
 private void DeleteLastTime()
 {
     // enkel uitvoeren wanneer de timer NIET loopt
     if (FunctionIsActive)
     {
         ResultaatDataService rds = new ResultaatDataService();
         rds.DeleteTime(LaatsteInsertedId);
         try
         {
             refreshLastAlgorithm(RandomAlgorithm.Id);
         }
         catch (Exception)
         {
             // geen update doen wanneer er geen RandomAlgorithm Id is
         }
     }
 }
コード例 #5
0
        //*****PROGRAMMA*****
        public void refreshResutaten()
        {
            Resultaten.Clear();
            ResultaatDataService rds = new ResultaatDataService();

            Resultaten = rds.GetResultaten();

            Datums.Clear();
            // unieke datums uit de collection halen en opslaan in 'Datums'
            DateTime _vorigeDatum = new DateTime().Date;

            foreach (Resultaat Resultaat in Resultaten)
            {
                if (Resultaat.Datum.Date != _vorigeDatum)
                {
                    Datums.Add(Resultaat);
                    _vorigeDatum = Resultaat.Datum.Date;
                }
            }
        }
コード例 #6
0
        //*****CONSTRUCTOR*****
        public MainWindowViewModel()
        {
            //laden data
            ResultaatDataService rds = new ResultaatDataService();

            _nieuweSessie  = (rds.GetLastSession() + 1);
            _gekozenSessie = _nieuweSessie;
            AlgorithmDataService ads = new AlgorithmDataService();

            Algorithms = ads.GetAlgorithms(_gekozenSessie);
            BackgroundDataService bds = new BackgroundDataService();

            Backgrounds = bds.GetBackgrounds();
            CreateBackgroundsMenu();
            // ids van algorithms nu al opslaan voor de "generate random algorithm" , dit is nodig om de start functie uit te schakelen indien alles op "niet-actief" staat
            refreshIdList();

            //koppelen commands
            TimerCommand           = new BaseCommand(StartStopTimer);
            ResetActiveCommand     = new BaseCommand(ResetActive);
            DeleteLastTimeCommand  = new BaseCommand(DeleteLastTime);
            AlgorithmActiefCommand = new ParameterCommand(AlgorithmActief);
            EditAlgorithmsCommand  = new BaseCommand(EditAlgorithms);
            EditCategoriesCommand  = new BaseCommand(EditCategories);
            EditResultatenCommand  = new BaseCommand(EditResultaten);
            AboutCommand           = new BaseCommand(About);

            // timer + timer2(countdown)
            _timer.Tick     += new EventHandler(timer_Tick);
            _timer.Interval  = new TimeSpan(0, 0, 0, 0, 10);
            _timer2.Tick    += new EventHandler(timer2_Tick);
            _timer2.Interval = new TimeSpan(0, 0, 0, 1, 0);

            //instantiëren DialogService als singleton
            _dialogService = new DialogService();

            //luisteren naar updates vanuit detailvenster
            Messenger.Default.Register <UpdateFinishedMessage>(this, OnMessageReceived);
        }
コード例 #7
0
        public void DeleteResultaat()
        {
            BackWithRefresh = true;
            ResultaatDataService rds = new ResultaatDataService();

            // kijken of je enkel 1 resutaat wil wissen of een datum met al zijn resultaten
            if (SelectedResultaat == null && SelectedDatum != null)
            {
                // datum met zijn resultaten wissen
                MessageBoxResult result = MessageBox.Show("You have selected a Date, not a Result." + "\n" + "Are you sure you want to delete all Results of this Date?",
                                                          "Delete more Results?", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No);
                switch (result)
                {
                case MessageBoxResult.Yes:
                    rds.DeleteTimesByDate(SelectedDatum);
                    ResultatenOpDatum = rds.GetResultatenOpDatum(SelectedDatum);
                    refreshResutaten();
                    break;
                }
            }
            else
            {
                if (SelectedResultaat != null || SelectedDatum != null)
                {
                    // 1 resultaat deleten en de gegevens refreshen
                    rds.DeleteTime(SelectedResultaat.Id);
                    SelectedDatum = SelectedResultaat;
                    refreshResutaten();
                }
                else
                {
                    MessageBoxResult result = MessageBox.Show("There is nothing selected to delete." + "\n" + "Please select a Date or Result.",
                                                              "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
        }