Beispiel #1
0
        /// <summary>
        /// Called when the user changes the theme of the compiler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Select_CompilerThemeChanged(object sender, SelectionChangedEventArgs e)
        {
            MessageResult result = AppDialogMessage.Show(
                "Changing the theme requires a restart of the application. Do you still want to change the theme?",
                "Change theme?", MessageButtons.YesNo, MessageIcon.Question);

            // Always remove the theme event handler before changing
            ctrlThemes.SelectionChanged -= Select_CompilerThemeChanged;

            if (result == MessageResult.Yes)
            {
                Themes.ChangeTheme(e.AddedItems[0] as string);
            }
            else
            {
                ComboBox obj = sender as ComboBox;
                Debug.Assert(obj != null);
                obj.SelectedItem = e.RemovedItems[0];
            }

            // When done rebind the event handler
            ctrlThemes.SelectionChanged += Select_CompilerThemeChanged;
        }