Example #1
0
        private void ThemeDialog_Load(object sender, EventArgs e)
        {
            previewer           = new WPF.ThemePreviewer();
            previewerHost.Child = previewer;

            listView1.ContextMenuStrip   = contextMenuStrip1;
            listView1.ListViewItemSorter = new CompareByItemText(listView1);
            SetWindowTheme(listView1.Handle, "Explorer", null);

            ImageList imageList = new ImageList();

            imageList.ColorDepth = ColorDepth.Depth32Bit;
            Size thumbnailSize = ThemeThumbLoader.GetThumbnailSize(this);

            imageList.ImageSize      = thumbnailSize;
            listView1.LargeImageList = imageList;

            imageList.Images.Add(ThemeThumbLoader.ScaleImage(windowsWallpaper, thumbnailSize));
            listView1.Items.Add(_("None"), 0);

            string activeTheme = ThemeManager.currentTheme?.themeId;

            if (activeTheme == null && (JsonConfig.firstRun || JsonConfig.settings.themeName != null))
            {
                activeTheme = "Mojave_Desert";
            }

            Task.Run(new Action(() =>
                                LoadThemes(ThemeManager.themeSettings, (activeTheme != null) ? activeTheme : "")));
        }
Example #2
0
        private void ThemeDialog_Load(object sender, EventArgs e)
        {
            imageListView1.ContextMenuStrip = contextMenuStrip1;
            imageListView1.SetRenderer(new ThemeListViewRenderer());

            Size thumbnailSize = ThemeThumbLoader.GetThumbnailSize(this);

            imageListView1.ThumbnailSize = thumbnailSize;
            imageListView1.Items.Add(_("None"), ThemeThumbLoader.ScaleImage(windowsWallpaper, thumbnailSize));

            string            currentTheme = ThemeManager.currentTheme?.themeId;
            ImageListViewItem focusItem    = null;

            if (currentTheme == null)
            {
                if (JsonConfig.firstRun || JsonConfig.settings.themeName != null)
                {
                    currentTheme = "Mojave_Desert";
                }
                else
                {
                    focusItem = imageListView1.Items[0];
                }
            }

            Task.Run(new Action(() => {
                for (int i = 0; i < ThemeManager.themeSettings.Count; i++)
                {
                    ThemeConfig theme = ThemeManager.themeSettings[i];
                    string themeName  = ThemeManager.GetThemeName(theme);
                    themeNames.Add(themeName);
                    themeNames.Sort();
                    int itemIndex = themeNames.IndexOf(themeName) + 1;

                    using (Image thumbnailImage = ThemeThumbLoader.GetThumbnailImage(theme, thumbnailSize, true))
                    {
                        this.Invoke(new Action(() => {
                            imageListView1.Items.Insert(itemIndex, themeName, thumbnailImage);
                            imageListView1.Items[itemIndex].Tag = theme.themeId;
                        }));
                    }

                    if (theme.themeId == currentTheme)
                    {
                        focusItem = imageListView1.Items[itemIndex];
                    }
                }

                if (focusItem != null)
                {
                    this.Invoke(new Action(() => {
                        focusItem.Selected = true;
                        imageListView1.EnsureVisible(focusItem.Index);
                    }));
                }

                ThemeThumbLoader.CacheThumbnails(imageListView1.Items);
            }));
        }
Example #3
0
        private void LoadPreviewImage(Image image)
        {
            int       width  = pictureBox1.Size.Width;
            int       height = pictureBox1.Size.Height;
            Rectangle screen = Screen.FromControl(this).Bounds;

            if ((screen.Y / (double)screen.X) <= (height / (double)width))
            {
                height = width * 9 / 16;
            }
            else
            {
                width = height * 16 / 9;
            }

            pictureBox1.Image = ThemeThumbLoader.ScaleImage(image, new Size(width, height));
        }
Example #4
0
        private void ThemeDialog_Load(object sender, EventArgs e)
        {
            previewer           = new WPF.ThemePreviewer();
            previewerHost.Child = previewer;

            listView1.ContextMenuStrip   = contextMenuStrip1;
            listView1.ListViewItemSorter = new CompareByItemText();
            SetWindowTheme(listView1.Handle, "Explorer", null);

            ImageList imageList = new ImageList();

            imageList.ColorDepth = ColorDepth.Depth32Bit;
            Size thumbnailSize = ThemeThumbLoader.GetThumbnailSize(this);

            imageList.ImageSize      = thumbnailSize;
            listView1.LargeImageList = imageList;

            imageList.Images.Add(ThemeThumbLoader.ScaleImage(windowsWallpaper, thumbnailSize));
            listView1.Items.Add(_("None"), 0);

            string[] displayNames = DisplayDevices.GetAllMonitorsFriendlyNames().ToArray();
            for (int i = 0; i < displayNames.Length; i++)
            {
                displayComboBox.Items.Add(string.Format(_("Display {0} - {1}"), i + 1, displayNames[i]));
            }
            displayComboBox.Enabled       = UwpDesktop.IsMultiDisplaySupported();
            displayComboBox.SelectedIndex = 0;

            string activeTheme = ThemeManager.currentTheme?.themeId;

            if (!JsonConfig.IsNullOrEmpty(JsonConfig.settings.multiDisplayThemes))
            {
                displayComboBox.SelectedIndex = 1;
                activeTheme = JsonConfig.settings.multiDisplayThemes[0];
            }
            else if (activeTheme == null && (JsonConfig.firstRun || JsonConfig.settings.themeName != null))
            {
                activeTheme = "Mojave_Desert";
            }

            Task.Run(new Action(() =>
                                LoadThemes(ThemeManager.themeSettings, (activeTheme != null) ? activeTheme : "")));
        }