Ejemplo n.º 1
0
        private void AddToFavorites(Image image, string defaultName)
        {
            var imageName = defaultName;

            using (var form = new FormAddFavoriteImage(image, defaultName, FavoriteImagesManager.Instance.Images.Select(i => i.Name.ToLower())))
            {
                form.Text = "Add Image to Favorites";
                form.simpleLabelItemTitle.Text = "Save this Image in your Favorites folder for future<br>presentations";
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                imageName = form.ImageName;
            }
            FavoriteImagesManager.Instance.SaveImage(image, imageName);
            PopupMessageHelper.Instance.ShowInformation("Image successfully added to Favorites");
        }
        private void OnFavoritesAddItemClick(object sender, ItemClickEventArgs e)
        {
            var imageName = _currentClipartObject.Name ?? "Clipart Image";

            Image favoritesImage;

            switch (_currentClipartObject.Type)
            {
            case ClipartObjectType.Image:
                var imageObject = (ImageClipartObject)_currentClipartObject;
                favoritesImage = imageObject.Image;
                break;

            case ClipartObjectType.Video:
                var videoClipartObject = (VideoClipartObject)_currentClipartObject;
                favoritesImage = videoClipartObject.Thumbnail;
                break;

            case ClipartObjectType.YouTube:
                var youtubeObject = (YouTubeClipartObject)_currentClipartObject;
                favoritesImage = youtubeObject.Thumbnail;
                break;

            default:
                throw new ArgumentOutOfRangeException("Undefined clipart type found");
            }

            using (var form = new FormAddFavoriteImage(favoritesImage, imageName, FavoriteImagesManager.Instance.Images.Select(i => i.Name.ToLower())))
            {
                form.Text = "Add Image to Favorites";
                form.simpleLabelItemTitle.Text = "Save this Image in your Favorites folder for future use";
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                imageName = form.ImageName;
            }

            FavoriteImagesManager.Instance.SaveImage(favoritesImage, imageName);
            PopupMessageHelper.Instance.ShowInformation("Image successfully added to Favorites");
        }
Ejemplo n.º 3
0
        private void OnMenuItemFavoritesClick(object sender, EventArgs e)
        {
            var imageSource = imageListView.Items[_menuHitInfo.ItemIndex].Tag as ImageSource;

            if (imageSource == null)
            {
                return;
            }
            var imageName = imageSource.Name;

            using (var form = new FormAddFavoriteImage(imageSource.BigImage, imageName, FavoriteImagesManager.Instance.Images.Select(i => i.Name.ToLower())))
            {
                form.Text = "Add Image to Favorites";
                form.simpleLabelItemTitle.Text = "Save this Image in your Favorites folder for future<br>presentations";
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                imageName = form.ImageName;
            }
            FavoriteImagesManager.Instance.SaveImage(imageSource.BigImage, imageName);
            PopupMessageHelper.Instance.ShowInformation("Image successfully added to Favorites");
            _menuHitInfo = null;
        }