Пример #1
0
        public VaultSelectorViewModel(IApplicationController app)
            : base()
        {
            _app = app;

            // Set menu
            MenuViewModel menuViewModel = new MenuViewModel(_app);
            menuViewModel.VisibilityLaser = false;
            Menu = menuViewModel;

            ratingVM = new RatingViewModel(_app);
            RatingControl = ratingVM;

            // get all info on startup of this viewmodel
            List<location> locations = vaultModule.getLocations();
            List<vaultnumber> vaultnumbers = vaultModule.getVaultNumbers();
            locationList = new ObservableCollection<location>(locations);
            vaultNumberList = new ObservableCollection<vaultnumber>(vaultnumbers);

            gymnastList = userModule.getGymnastCollection();

            modifyVaultVM = new ModifyVaultViewModel(_app, "SELECT", gymnastList, vaultnumbers, vaultModule.getVaultKinds(), locations);
            ModifyViewModelControl = modifyVaultVM;
            this.Content = modifyVaultVM;
            modifyVaultVM.setData(null);

            dateVisibility = Visibility.Hidden;
            OnPropertyChanged("DateVisibility");

            FilterText = "";
            filterList = new ObservableCollection<string>();
        }
Пример #2
0
        public MeasurementViewModel(IApplicationController app, PortController portController, VideoCameraController videoCameraController)
            : base()
        {
            _app = app;
            Measuring = false;
            RatingViewModel ratingVM = new RatingViewModel(_app);
            RatingControl = ratingVM;

            RectangleColor = "White";

            gymnastList     = vaultModule.getGymnasts();
            vaultNumberList = vaultModule.getVaultNumbers();
            vaultKindList   = vaultModule.getVaultKinds();
            locationsList   = vaultModule.getLocations();

            // Set PortController
            this.portController = portController;

            // Set VideoCamera
            CameraView = new CameraViewModel(_app);
            VideoCameraController = videoCameraController;

            ManualModeChecked = true;

            //Turn pilotlaser off if it is on
            if (portController.PilotLaser != 0)
            {
                portController.PilotLaser = 0;
            }

            // Set Graph
            GraphViewModel graphVM = new GraphViewModel(_app, this, true, 1500);
            GraphViewMeasurement = graphVM;

            // Set validation
            SetValidationRules();

            // Set vault handler
            cameraModule.VaultCreated += vaultCreated;

            // Set thumbnail collection
            thumbnailCollection = new ObservableCollection<ThumbnailViewModel>();

            // Create empty vault
            vault newVault = new vault();
            newVault.timestamp = DateTime.Now;
            selectedVault = newVault;

            // Add empty thumbnail for live and set selected
            ThumbnailViewModel liveThumbnail = new ThumbnailViewModel(_app);
            liveThumbnail.setLive(true);
            liveThumbnail.Vault = newVault;
            thumbnailCollection.Add(liveThumbnail);
            SelectedThumbnail = liveThumbnail;
        }
Пример #3
0
        public ModifyVaultViewModel(IApplicationController app, string kind)
            : base()
        {
            _app = app;
            this.kind = kind;
            ratingVM = new RatingViewModel(_app);
            RatingControl = ratingVM;

            //load autocompletion data
            gymnastList     = vaultModule.getGymnasts();
            vaultNumberList = vaultModule.getVaultNumbers();
            vaultKindList   = vaultModule.getVaultKinds();
            locationsList   = vaultModule.getLocations();

            // Set validation
            SetValidationRules();
        }
Пример #4
0
        private void setVaultFields()
        {
            if (selectedVault.vaultkind_id != null)
            {

                VaultKind = selectedVault.vaultkind.name;
            }
            else
            {
                VaultKind = "";
            }

            if (selectedVault.location_id != null)
            {
                Location = selectedVault.location.name;
            }
            else
            {
                Location = "";
            }

            if (selectedVault.gymnast_id != null)
            {
                Gymnast = selectedVault.gymnast.name + (selectedVault.gymnast.surname_prefix != null ? " " +
                    selectedVault.gymnast.surname_prefix : "") + " " + selectedVault.gymnast.surname;
            }
            else
            {
                Gymnast = "";
            }

            if (selectedVault.vaultnumber_id != null)
            {
                VaultNumber = selectedVault.vaultnumber.code;
            }
            else
            {
                VaultNumber = "";
            }

            RatingViewModel rating = new RatingViewModel(_app);
            rating.OnRatingChanged += setVaultRating;
            RatingControl = rating;
            if (selectedVault.rating_star != null)
            {
                rating.RatingValue = (int)selectedVault.rating_star;
            }

            if (selectedVault.rating_official_D != null)
            {
                Dscore = selectedVault.rating_official_D.ToString();
            }
            else
            {
                Dscore = "";
            }

            if (selectedVault.rating_official_E != null)
            {
                Escore = selectedVault.rating_official_E.ToString();
            }
            else
            {
                Escore = "";
            }

            if (selectedVault.penalty != null)
            {
                Penalty = selectedVault.penalty.ToString();
            }
            else
            {
                Penalty = "";
            }
        }
Пример #5
0
        private void clearFields(vault savedVault)
        {
            if (!VaultKindChecked)
            {
                VaultKind = "";
            }
            else
            {
                VaultKind = savedVault.vaultkind.name;
            }

            if (!LocationChecked)
            {
                Location = "";
            }
            else
            {
                Location = savedVault.location.name;
            }

            if (!GymnastChecked)
            {
                Gymnast = "";
            }
            else
            {
                Gymnast = savedVault.gymnast.name + (savedVault.gymnast.surname_prefix != null ? " " + savedVault.gymnast.surname_prefix : "") + " " + savedVault.gymnast.surname;
            }

            if (!VaultNumberChecked)
            {
                VaultNumber = "";
            }
            else
            {
                VaultNumber = savedVault.vaultnumber.code;
            }

            RatingViewModel ratingView = new RatingViewModel(_app);
            ratingView.OnRatingChanged += setVaultRating;
            RatingControl = ratingView;
            if (RatingChecked)
            {
                ratingView.RatingValue = (int)savedVault.rating_star;
            }

            if (!DscoreChecked)
            {
                Dscore = "";
            }
            else
            {
                Dscore = savedVault.rating_official_D.ToString();
            }

            if (!EscoreChecked)
            {
                Escore = "";
            }
            else
            {
                Escore = savedVault.rating_official_E.ToString();
            }

            if (!PenaltyChecked)
            {
                Penalty = "";
            }
            else
            {
                Penalty = savedVault.penalty.ToString();
            }
        }
Пример #6
0
        public ModifyVaultViewModel(IApplicationController app, string kind, List<gymnast> gymnastList, List<vaultnumber> vaultNumberList, 
                List<vaultkind> vaultKindList, List<location> locationsList)
            : base()
        {
            _app = app;
            this.kind = kind;
            ratingVM = new RatingViewModel(_app);
            RatingControl = ratingVM;

            this.gymnastList     = gymnastList;
            this.vaultNumberList = vaultNumberList;
            this.vaultKindList   = vaultKindList;
            this.locationsList   = locationsList;

            // Set validation
            SetValidationRules();
        }