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();
            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 : "")));
        }