Пример #1
0
        private void ChangeThemeCmd_Executed(object s, ExecutedRoutedEventArgs e, System.Windows.Threading.Dispatcher disp)
        {
            ThemesVM.EnTheme oldTheme = ThemesVM.EnTheme.Generic;

            try
            {
                if (e == null)
                {
                    return;
                }

                if (e.Parameter == null)
                {
                    return;
                }

                // Check if request is available
                if (e.Parameter is Themes.ThemesVM.EnTheme == false)
                {
                    return;
                }

                Themes.ThemesVM.EnTheme t = (Themes.ThemesVM.EnTheme)e.Parameter;

                oldTheme = this.Config.CurrentTheme;

                // The Work to perform on another thread
                ThreadStart start = delegate
                {
                    // This works in the UI tread using the dispatcher with highest Priority
                    disp.Invoke(DispatcherPriority.Send,
                                (Action)(() =>
                    {
                        try
                        {
                            this.Config.CurrentTheme = t;
                        }
                        catch (Exception exp)
                        {
                            logger.ErrorException(exp.Message, exp);
                            Edi.Msg.Box.Show(exp, App.IssueTrackerText, MsgBoxButtons.OK, MsgBoxImage.Error, MsgBoxResult.NoDefaultButton,
                                             App.IssueTrackerLink, App.IssueTrackerLink, App.IssueTrackerText, null, true);
                        }
                    }));
                };

                // Create the thread and kick it started!
                Thread thread = new Thread(start);

                thread.Start();
            }
            catch (Exception exp)
            {
                this.Config.CurrentTheme = oldTheme;

                logger.ErrorException(exp.Message, exp);
                Edi.Msg.Box.Show(exp, App.IssueTrackerText, MsgBoxButtons.OK, MsgBoxImage.Error, MsgBoxResult.NoDefaultButton,
                                 App.IssueTrackerLink, App.IssueTrackerLink, App.IssueTrackerText, null, true);
            }
        }
Пример #2
0
 /// <summary>
 /// Constructor from parent reference to <seealso cref="ThemesVM"/>
 /// collection and <see cref="ThemesVM.EnTheme"/> enumeration entry.
 /// </summary>
 /// <param name="parentObject"></param>
 /// <param name="displayText"></param>
 /// <param name="t"></param>
 public ThemeVM(ThemesVM parentObject, ThemesVM.EnTheme t, string displayText)
 {
     this.mParent = parentObject;
     this.ThemeID = t;
     this.mText   = displayText;
 }
Пример #3
0
        /// <summary>
        /// Default constructor for collection of themes (application skins)
        /// from <seealso cref="ThemesVM.EnTheme"/> enumeration entry as theme
        /// to initialize to.
        /// </summary>
        /// <param name="thisCurrentTheme"></param>
        public ThemesVM(EnTheme thisCurrentTheme)
        {
            this.Themes = ThemesVM.ListAllThemes(this);

            this.mCurrentTheme = thisCurrentTheme; // Construct with this theme as current theme
        }
Пример #4
0
        /// <summary>
        /// Default constructor for collection of themes (application skins).
        /// </summary>
        public ThemesVM()
        {
            this.Themes = ThemesVM.ListAllThemes(this);

            this.mCurrentTheme = EnTheme.Aero; // Just select any theme as default
        }