コード例 #1
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);
        }