コード例 #1
0
        /// <summary>
        /// Deletes an image from both the the view models and datamodels
        /// </summary>
        /// <param name="image"></param>
        internal void Delete(SafetyCheckFaultImageViewModel image)
        {
            // remove from backing data model (exists in startup service)
            _safetyCheckFault.Images.Remove(image.FaultImage);

            // remove view model
            Images.Remove(image);
        }
コード例 #2
0
        /// <summary>
        /// Packs up the image stre
        /// </summary>
        /// <param name="stream"></param>
        private void OnPictureTaken(Stream stream)
        {
            var memoryStream = new MemoryStream();

            stream.CopyTo(memoryStream);

            int   sequenceNumber = (Images.Any()) ? _images.Max(i => i.FaultImage.Sequence) + 1 : 1;
            Image image          = new Image()
            {
                ID = Guid.NewGuid(), SafetyCheckFaultID = _safetyCheckFault.ID, Sequence = sequenceNumber, Bytes = memoryStream.ToArray()
            };


            //Add to data model
            _safetyCheckFault.Images.Add(image);

            //Add to view model
            SafetyCheckFaultImageViewModel imageViewModel = new SafetyCheckFaultImageViewModel(image, this);

            Images.Add(imageViewModel);
        }