示例#1
0
        private void applyButton_Click(object sender, EventArgs e)
        {
            applyButton.Enabled = false;
            bool themeDownloaded = true;

            if (selectedIndex > 0)
            {
                themeDownloaded = ThemeManager.IsThemeDownloaded(ThemeManager.themeSettings[selectedIndex - 1]);
            }

            if (!themeDownloaded)
            {
                DownloadDialog downloadDialog = new DownloadDialog()
                {
                    Owner = this
                };
                downloadDialog.FormClosed += OnDownloadDialogClosed;
                downloadDialog.Show();
                this.Enabled = false;
                downloadDialog.InitDownload(ThemeManager.themeSettings[selectedIndex - 1]);
            }
            else
            {
                ApplySelectedTheme();
            }

            applyButton.Enabled = true;
        }
示例#2
0
 private void DownloadTheme(ThemeConfig theme, bool applyPending)
 {
     DownloadDialog downloadDialog = new DownloadDialog() { Owner = this, applyPending = applyPending };
     downloadDialog.FormClosed += OnDownloadDialogClosed;
     downloadDialog.Show();
     this.Enabled = false;
     downloadDialog.InitDownload(theme);
 }
示例#3
0
        private void downloadButton_Click(object sender, EventArgs e)
        {
            DownloadDialog downloadDialog = new DownloadDialog()
            {
                Owner = this
            };

            downloadDialog.FormClosed += OnDownloadDialogClosed;
            downloadDialog.Show();
            this.Enabled = false;
            downloadDialog.InitDownload(ThemeManager.themeSettings[selectedIndex - 1]);
        }
        private void themeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int         itemIndex = imageListView1.SelectedItems[0].Index;
            string      themeId   = (string)imageListView1.Items[itemIndex].Tag;
            ThemeConfig theme     = ThemeManager.themeSettings.Find(t => t.themeId == themeId);

            if (ThemeManager.IsThemeDownloaded(theme))
            {
                DialogResult result = MessageDialog.ShowQuestion(string.Format(_("Are you sure you want to remove the " +
                                                                                 "'{0}' theme?"), ThemeManager.GetThemeName(theme)), _("Question"), true);

                if (result == DialogResult.Yes)
                {
                    if (!ThemeManager.defaultThemes.Contains(theme.themeId))
                    {
                        imageListView1.Items.RemoveAt(itemIndex);
                        imageListView1.Items[itemIndex - 1].Selected = true;
                        themeNames.RemoveAt(itemIndex - 1);
                    }

                    Task.Run(() => {
                        ThemeManager.RemoveTheme(theme);

                        if (ThemeManager.defaultThemes.Contains(theme.themeId))
                        {
                            this.Invoke(new Action(() => UpdateSelectedItem()));
                        }
                    });
                }
            }
            else
            {
                DownloadDialog downloadDialog = new DownloadDialog()
                {
                    Owner = this, applyPending = false
                };
                downloadDialog.FormClosed += OnDownloadDialogClosed;
                downloadDialog.Show();
                this.Enabled = false;
                downloadDialog.InitDownload(theme);
            }
        }