コード例 #1
0
 private void SwitchIconFlow(IIconFlow iconFlow)
 {
     if (this._iconFlow != null)
     {
         this._iconFlow.Uninitialize(_settings.Buttons);
     }
     this._iconFlow = iconFlow;
     this._iconFlow.Initialize(_settings.Buttons);
 }
コード例 #2
0
        private void OnSettingsChanged(Common.Themes.Theme changeToTheme, IIconFlow changeToIconFlow, bool?autoHideDock,
                                       double?hideAnimationDuration, double?hideTimerMilliseconds,
                                       double?showAnimationDuration, double?showTimerMilliseconds, int?screen)
        {
            SettingsChangedEventArgs args = new SettingsChangedEventArgs(BaubleSettings.SettingsChangedEvent, this);

            args.OldTheme              = Theme;
            args.NewTheme              = changeToTheme;
            args.OldIconFlow           = IconFlow;
            args.NewIconFlow           = changeToIconFlow;
            args.AutoHideDock          = autoHideDock;
            args.HideAnimationDuration = hideAnimationDuration;
            args.HideTimerMilliseconds = hideTimerMilliseconds;
            args.ShowAnimationDuration = showAnimationDuration;
            args.ShowTimerMilliseconds = showTimerMilliseconds;
            args.Screen = screen;

            if ((_settingsChanged != null) && (args.ShouldRaiseEvent))
            {
                // by default, don't re-save the config file
                bool save = false;
                _settingsChanged(this, args);

                // if the theme changed
                if (changeToTheme != null)
                {
                    // populate the settings variables
                    Theme     = changeToTheme;
                    ThemeFile = Theme.FileName;
                    // and trigger a save
                    save = true;
                }
                // if the icon flow changed
                if (changeToIconFlow != null)
                {
                    // populated the settings variables
                    IconFlow         = changeToIconFlow;
                    IconFlowTypeName = IconFlow.TypeName;
                    // and trigger a save
                    save = true;
                }
                // if a save was triggered
                if (save)
                {
                    // save the settings to file
                    Properties.Settings.Default.Save();
                }
            }
        }
コード例 #3
0
        public void ShowConfiguration()
        {
            #region LeftHand Variables
            bool?     autoHideDock          = AutoHideDock;
            double?   hideAnimationDuration = this.HideAnimationDuration;
            double?   hideTimerMilliseconds = this.HideTimerMilliseconds;
            double?   showAnimationDuration = this.ShowAnimationDuration;
            double?   showTimerMilliseconds = this.ShowTimerMilliseconds;
            int?      screen           = this.Screen;
            Theme     changeToTheme    = null;
            IIconFlow changeToIconFlow = null;
            #endregion

            ConfigurationWindow configWindow = new ConfigurationWindow();

            // save the current icon flow and theme before the window is shown
            bool?result = configWindow.ShowDialog();
            if (result.HasValue && result.Value)
            {
                #region Right Hand Checks
                // check and see if the current Icon Flow matches the type name
                // of the icon flow set in the settings
                var selectedIconFlow = (configWindow.IconFlowComboBox.SelectedItem as IIconFlow);
                if (selectedIconFlow != IconFlow)
                {
                    // if not, get a reference to the new icon flow object
                    changeToIconFlow = selectedIconFlow;
                }

                var selectedTheme = (configWindow.ThemeComboBox.SelectedItem as Theme);

                // check and see if the current theme matches the theme filename
                // of the theme set in the settings
                if (selectedTheme != Theme)
                {
                    // if not, get a reference to the new theme object
                    changeToTheme = selectedTheme;
                }
                if (autoHideDock.Value == AutoHideDock)
                {
                    autoHideDock = null;
                }
                else
                {
                    autoHideDock = AutoHideDock;
                }

                if (hideAnimationDuration.Value == HideAnimationDuration)
                {
                    hideAnimationDuration = null;
                }
                else
                {
                    hideAnimationDuration = HideAnimationDuration;
                }

                if (hideTimerMilliseconds.Value == HideTimerMilliseconds)
                {
                    hideTimerMilliseconds = null;
                }
                else
                {
                    hideTimerMilliseconds = HideAnimationDuration;
                }

                if (showAnimationDuration == ShowAnimationDuration)
                {
                    showAnimationDuration = null;
                }
                else
                {
                    showAnimationDuration = ShowAnimationDuration;
                }

                if (showTimerMilliseconds == ShowTimerMilliseconds)
                {
                    showTimerMilliseconds = null;
                }
                else
                {
                    showTimerMilliseconds = ShowTimerMilliseconds;
                }

                if (screen == this.Screen)
                {
                    screen = null;
                }
                else
                {
                    screen = this.Screen;
                }
                #endregion

                OnSettingsChanged(changeToTheme, changeToIconFlow, autoHideDock,
                                  hideAnimationDuration, hideTimerMilliseconds,
                                  showAnimationDuration, showTimerMilliseconds,
                                  screen);
            }
        }