Example #1
0
 public static String GenerateFilename(ThumbnailViewModel thumbnail)
 {
     try
     {
         String name = thumbnail.Vault.gymnast.name + (thumbnail.Vault.gymnast.surname_prefix != null && thumbnail.Vault.gymnast.surname_prefix.Length > 0 ? " " + thumbnail.Vault.gymnast.surname_prefix : "") + " " + thumbnail.Vault.gymnast.surname;
         return thumbnail.Vault.timestamp.ToString().Replace("/", "-").Replace(":", ".") + " " + name;
     }
     catch
     {
         return thumbnail.Vault.timestamp.ToString().Replace("/", "-").Replace(":", ".") + " Unknown gymnast";
     }
 }
        private void vaultCreated(object sender, vault receivedVault)
        {
            // Add vault to thumbnail list.
            ThumbnailViewModel vaultThumb = new ThumbnailViewModel(_app);
            vaultThumb.Vault = receivedVault;

            // Add to collection
            thumbnailCollection.Insert(1, vaultThumb);
            vaultSaved = true;
        }
        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;
        }