示例#1
0
        public void Save()
        {
            try
            {
                if (IsOneView)
                {
                    ViewSettingsParser.Modify(_configLocation.FileName, new ViewSettings
                    {
                        URL = URL,
                        ProjectNameRegEx             = ProjectNameRegEx,
                        CategoryRegEx                = CategoryRegEx,
                        ServerNameRegEx              = ServerNameRegEx,
                        SkinName                     = SkinName,
                        ViewName                     = ViewName,
                        ShowOnlyBroken               = ShowOnlyBroken,
                        ShowServerName               = ShowServerName,
                        ShowOutOfDate                = ShowOutOfDate,
                        OutOfDateDifferenceInMinutes = OutOfDateDifferenceInMinutes
                    });
                }

                var config = OpenExeConfiguration();

                config.AppSettings.Settings[PollFrequencyKey].Value        = PollFrequency.ToString();
                config.AppSettings.Settings[ShowCountdownKey].Value        = ShowCountdown.ToString();
                config.AppSettings.Settings[ShowProgressKey].Value         = ShowProgress.ToString();
                config.AppSettings.Settings[PlaySoundsKey].Value           = PlaySounds.ToString();
                config.AppSettings.Settings[PlaySpeechKey].Value           = PlaySpeech.ToString();
                config.AppSettings.Settings[BrokenBuildSoundKey].Value     = BrokenBuildSound;
                config.AppSettings.Settings[FixedBuildSoundKey].Value      = FixedBuildSound;
                config.AppSettings.Settings[BrokenBuildTextKey].Value      = BrokenBuildText;
                config.AppSettings.Settings[FixedBuildTextKey].Value       = FixedBuildText;
                config.AppSettings.Settings[SpeechVoiceNameKey].Value      = SpeechVoiceName;
                config.AppSettings.Settings[BreakerGuiltStrategyKey].Value = _breakerGuiltStrategy;
                config.Save(ConfigurationSaveMode.Minimal);
            }
            catch (Exception ex)
            {
                // config may be edited in the file (manually) - we cannot show an error dialog here
                // because it's entirely reasonable that the user doesn't have access to the machine running
                // the exe, in order to close a dialog
                _log.Error(ex.Message, ex);
            }
        }
 public void SendShowCountdown()
 {
     ShowCountdown?.Invoke();
 }