Example #1
0
        // Remove From Selected Images
        private void buttomRemoveFromSelectedImages_Click(object sender, EventArgs e)
        {
            switch (WallpaperManagerTools.ChooseSelectionType())
            {
            case SelectionType.Active:
                RemoveTagFromImage(WallpaperData.WallpaperManagerForm.GetActiveImage(), sender as Button);
                break;

            case SelectionType.All:
                RemoveTagFromImages(WallpaperData.WallpaperManagerForm.GetSelectedImages(), sender as Button);
                break;
            }

            UpdateTagButton();
        }
Example #2
0
        // Add To Selected Images
        private void buttonAddToSelectedImages_Click(object sender, EventArgs e)
        {
            switch (WallpaperManagerTools.ChooseSelectionType())
            {
            case SelectionType.Active:
                AddTagToImage(WallpaperData.WallpaperManagerForm.GetActiveImage());
                break;

            case SelectionType.All:
                AddTagToImages(WallpaperData.WallpaperManagerForm.GetSelectedImages());
                break;
            }

            UpdateTagButton();
        }
Example #3
0
        private static string[] LargestImagesWithCustomFilePath(string[] customFilePath)
        {
            Image[] images = (from f in customFilePath select WallpaperManagerTools.GetImageFromFile(f)).ToArray();

            for (int i = 0; i < customFilePath.Length; i++) // sets file path for image objects
            {
                //? Note that the tag is empty beforehand | This is used to organize the images below based on their width and height
                images[i].Tag = customFilePath[i];
            }

            customFilePath = (from f in images orderby f.Width + f.Height descending select f.Tag.ToString()).ToArray();

            foreach (Image image in images)
            {
                image.Dispose();
            }

            return(customFilePath);
        }
Example #4
0
        //? Using this will cause old wallpapers to remain visible if you aren't filling the entire screen

        /*
         * // makes the background transparent to prevent flickering (Only stops the 1 frame flicker when closing, not the one that occurs when loading)
         * protected override void OnPaintBackground(PaintEventArgs e)
         * {
         *  var sb = new SolidBrush(Color.FromArgb(0, 0, 0, 0));
         *  e.Graphics.FillRectangle(sb, this.DisplayRectangle);
         * }
         */

        // TODO Create a queue that stores pictureBoxes/axWindowMediaPlayers for each wallpaper. This will be used to allow transitions & prevent flickering from
        // TODO style readjustment when changing wallpapers by *locking* the previous wallpaper in place
        public void SetWallpaper(string imageLocation)
        {
            Loops = 0;
            WallpaperUptime.Stop();

            //! The below conditions were removed but I may consider re-adding this in the future when monitor-specific settings are added, although other methods of handling
            //! not changing a monitor's wallpaper would probably be better than this
            //!if (imageLocation == null) return; //? Under certain conditions a wallpaper won't be selected, this prevents the program from crashing over this

            if (!IsHandleCreated)
            {
                return;
            }

            if (InvokeRequired)
            {
                this.BeginInvoke((MethodInvoker) delegate { SetWallpaperProcess(); });
            }
            else
            {
                SetWallpaperProcess();
            }

            async void SetWallpaperProcess()
            {
                if (!WallpaperManagerTools.IsSupportedVideoType(imageLocation))
                {
                    IsPlayingVideo = false;

                    player.Stop();
                    panelWallpaper.Visible = false;
                    panelWallpaper.Enabled = false;

                    pictureBoxWallpaper.ImageLocation = imageLocation;
                    pictureBoxWallpaper.Enabled       = true;
                    pictureBoxWallpaper.Visible       = true;

                    activeVideoImagePath = null;
                }
                else
                {
                    IsPlayingVideo = true;
                    WallpaperUptime.Restart();

                    pictureBoxWallpaper.Visible = false;
                    pictureBoxWallpaper.Enabled = false;

                    panelWallpaper.Enabled = true;
                    panelWallpaper.Visible = true;

                    activeVideoImagePath = imageLocation;

                    await Task.Run(() =>
                    {
                        player.Reload(imageLocation);

                        WallpaperData.VideoSettings videoSettings = WallpaperData.GetImageData(imageLocation).VideoSettings;
                        player.Volume = AudioManager.IsWallpapersMuted ? 0 : videoSettings.Volume;
                        player.Speed  = videoSettings.PlaybackSpeed;
                    }).ConfigureAwait(false);
                }
            }

            ResetWallpaperStyle(); // this needs to be readjusted with each image
        }