Exemplo n.º 1
0
        /// <summary>
        /// Change the the currently shown <see cref="MediaItem"/>
        /// </summary>
        /// <param name="item"><see cref="MediaItem"/> to change to</param>
        public void ChangeMediaItem(MediaItem item)
        {
            if (item?.Path == null)
            {
                return;
            }
            if (_albumView?.ImageCropView == null)
            {
                return;
            }

            DispatchQueue.MainQueue.DispatchAsync(() =>
            {
                StopVideo();

                _albumView.ClearPreview();
                CurrentMediaPath = item.Path;
                CurrentMediaType = item.MediaType;

                if (item.MediaType == MediaType.Image)
                {
                    ChangeImage(item, _albumView);
                }
                else
                {
                    ChangeVideo(item, _albumView);
                }
            });
        }
Exemplo n.º 2
0
        /// <inheritdoc />
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (PHPhotoLibrary.AuthorizationStatus == PHAuthorizationStatus.Authorized)
                {
                    PHPhotoLibrary.SharedPhotoLibrary.UnregisterChangeObserver(this);
                }

                _albumView.ClearPreview();

                _asset.Dispose();
                _asset = null;
            }

            base.Dispose(disposing);
        }