Ejemplo n.º 1
0
 /// <summary>
 /// Switches to the ActivePrinter theme without firing the ThemeChanged event. This is useful when changing printers and
 /// allows the theme state to be updated before the ActivePrinterChanged event fires, resulting in a single ReloadAll
 /// occurring rather than two
 /// </summary>
 public static void SwitchToPrinterTheme(bool doReloadEvent)
 {
     if (ActiveSliceSettings.Instance != null)
     {
         if (ActiveSliceSettings.Instance.PrinterSelected)
         {
             //Attempt to load userSetting theme as default
             string activeThemeName = UserSettings.Instance.get(UserSettingsKey.ActiveThemeName);
             if (string.IsNullOrEmpty(activeThemeName))
             {
                 activeThemeName = "Blue - Light";
             }
             if (ActiveSliceSettings.Instance.Contains(SettingsKey.active_theme_name))
             {
                 activeThemeName = ActiveSliceSettings.Instance.GetValue(SettingsKey.active_theme_name);
                 if (string.IsNullOrEmpty(activeThemeName))
                 {
                     activeThemeName = "Blue - Light";
                 }
                 if (!doReloadEvent)
                 {
                     ActiveTheme.SuspendEvents();
                 }
             }
             else
             {
                 //If the active printer has no theme we set it to the default so that it does not suddenly change colors later when another printer's color is changed
                 ActiveSliceSettings.Instance.SetValue(SettingsKey.active_theme_name, activeThemeName);
             }
             ActiveTheme.Instance = ActiveTheme.GetThemeColors(activeThemeName);
             ActiveTheme.ResumeEvents();
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Switches to the ActivePrinter theme without firing the ThemeChanged event. This is useful when changing printers and
        /// allows the theme state to be updated before the ActivePrinterChanged event fires, resulting in a single ReloadAll
        /// occurring rather than two
        /// </summary>
        public static void SwitchToPrinterTheme(bool doReloadEvent)
        {
            if (ActiveSliceSettings.Instance != null)
            {
                if (ActiveSliceSettings.Instance.PrinterSelected)
                {
                    string activeThemeName = "Blue - Light";
                    if (ActiveSliceSettings.Instance.Contains(SettingsKey.active_theme_name))
                    {
                        activeThemeName = ActiveSliceSettings.Instance.GetValue(SettingsKey.active_theme_name);
                        if (string.IsNullOrEmpty(activeThemeName))
                        {
                            activeThemeName = "Blue - Light";
                        }
                        if (!doReloadEvent)
                        {
                            ActiveTheme.SuspendEvents();
                        }
                    }

                    ActiveTheme.Instance = ActiveTheme.GetThemeColors(activeThemeName);
                    ActiveTheme.ResumeEvents();
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Switches to the ActivePrinter theme without firing the ThemeChanged event. This is useful when changing printers and
        /// allows the theme state to be updated before the ActivePrinterChanged event fires, resulting in a single ReloadAll
        /// occurring rather than two
        /// </summary>
        public static void SwitchToPrinterTheme(bool doReloadEvent)
        {
            if (ActiveSliceSettings.Instance.PrinterSelected)
            {
                //Attempt to load userSetting theme as default
                string activeThemeName = ActiveSliceSettings.Instance.GetValue(SettingsKey.active_theme_name);
                if (!string.IsNullOrEmpty(activeThemeName))
                {
                    if (!doReloadEvent)
                    {
                        ActiveTheme.SuspendEvents();
                    }

                    ActiveTheme.Instance = ActiveTheme.GetThemeColors(activeThemeName);

                    ActiveTheme.ResumeEvents();
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Switches to the ActivePrinter theme without firing the ThemeChanged event. This is useful when changing printers and
        /// allows the theme state to be updated before the ActivePrinterChanged event fires, resulting in a single ReloadAll
        /// occurring rather than two
        /// </summary>
        public static void SwitchToPrinterTheme(bool doReloadEvent)
        {
            int defaultThemeIndex = 1;

            int themeIndex;

            if (ActiveSliceSettings.Instance != null)
            {
                string activeThemeIndex = ActiveSliceSettings.Instance.ActiveValue("MatterControl.ActiveThemeIndex");
                if (string.IsNullOrEmpty(activeThemeIndex) || !int.TryParse(activeThemeIndex, out themeIndex))
                {
                    themeIndex = defaultThemeIndex;
                }

                if (!doReloadEvent)
                {
                    ActiveTheme.SuspendEvents();
                }
                ActiveTheme.Instance = ActiveTheme.AvailableThemes[themeIndex];
                ActiveTheme.ResumeEvents();
            }
        }
Ejemplo n.º 5
0
 private void btnCustomizeThisContentType_Click(object sender, EventArgs e)
 {
     try {
         IndentTheme theme;
         if (!Service.Themes.TryGetValue(CurrentContentType, out theme))
         {
             if (ActiveTheme == null)
             {
                 theme = new IndentTheme();
             }
             else
             {
                 theme = ActiveTheme.Clone();
             }
             theme.ContentType = CurrentContentType;
             Service.Themes[CurrentContentType] = theme;
             UpdateThemeList();
         }
         cmbTheme.SelectedItem = theme;
     } catch (Exception ex) {
         Trace.WriteLine(string.Format("IndentGuide::btnCustomizeThisContentType_Click: {0}", ex));
     }
 }
Ejemplo n.º 6
0
 protected void Page_Init(object sender, EventArgs e)
 {
     _themes = ThemeDataSource.LoadAll(BitFieldState.False);
     ActiveTheme.DataSource = _themes;
     ActiveTheme.DataBind();
 }