private void InitThemes() { // register custom theme string customThemePath = Path.Combine(Directory.GetCurrentDirectory(), CustomThemeName + ".c1themez"); if (File.Exists(customThemePath) && !C1ThemeController.IsThemeRegistered(CustomThemeName)) { C1ThemeController.RegisterTheme(customThemePath); } // load themes into ribbon combo box foreach (string theme in C1ThemeController.GetThemes()) { if (!(theme == CustomThemeName || theme.Contains("Office2016") || theme.Contains("Material"))) { continue; } _ribbonComboBoxThemes.Items.Add(theme); } // set default theme int customThemeIndex = _ribbonComboBoxThemes.Items.IndexOf(CustomThemeName); if (customThemeIndex > -1) { _ribbonComboBoxThemes.SelectedIndex = customThemeIndex; } }
private void InitThemes() { // Register custom theme var customThemePath = Path.Combine(Directory.GetCurrentDirectory(), _customThemeName + ".c1themez"); if (File.Exists(customThemePath)) { C1ThemeController.RegisterTheme(customThemePath); } // Load themes into ribbon combo box var themes = C1ThemeController.GetThemes().Where(x => x == _customThemeName || x.Contains("Office2016") || x.Contains("Material")); foreach (var theme in themes) { _lstThemes.Items.Add(theme); } // Set default theme var customThemeIndex = _lstThemes.Items.IndexOf(_customThemeName); if (customThemeIndex > -1) { _lstThemes.SelectedIndex = customThemeIndex; } }
private void btnAdd_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { try { string theme = C1ThemeController.RegisterTheme(openFileDialog1.FileName); ctdbgThemes.AddRow(theme); } catch (Exception ex) { MessageBox.Show(string.Format("Cannot add theme, error:\r\n{0}", ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }