/// <summary> /// Retrieves the value of a setting. We need this method so we can fire the SettingsLoaded event /// when settings are loaded from the providers.Ideally, this should be fired from SettingsBase, /// but unfortunately that will not happen in Whidbey. Instead, we check to see if the value has already /// been retrieved. If not, we fire the load event, since we expect SettingsBase to load all the settings /// from this setting's provider. /// </summary> private object GetPropertyValue(string propertyName) { if (PropertyValues[propertyName] == null) { // If this is our first load and we are part of a Clickonce app, call Upgrade. if (_firstLoad) { _firstLoad = false; if (IsFirstRunOfClickOnceApp()) { Upgrade(); } } object temp = base[propertyName]; SettingsProperty setting = Properties[propertyName]; SettingsProvider provider = setting != null ? setting.Provider : null; Debug.Assert(provider != null, "Could not determine provider from which settings were loaded"); SettingsLoadedEventArgs e = new SettingsLoadedEventArgs(provider); OnSettingsLoaded(this, e); // Note: we need to requery the value here in case someone changed it while // handling SettingsLoaded. return(base[propertyName]); } else { return(base[propertyName]); } }
private void Settings_SettingsLoaded(object sender, System.Configuration.SettingsLoadedEventArgs e) { if (HotKeys == null) { HotKeys = new BindingList <Hotkey>(); } }
protected virtual void OnSettingsLoaded(object sender, SettingsLoadedEventArgs e) { if (this._onSettingsLoaded != null) { this._onSettingsLoaded(this, e); } }
protected override void OnSettingsLoaded(object sender, SettingsLoadedEventArgs e) { base.OnSettingsLoaded(sender, e); this.CompactPropertyValues(); this.FShowIcons = this.ShowIcons; this.IsShowItemToolTips = this.ShowItemToolTips; this.IsShowKeyboardCues = this.ShowKeyboardCues; }
protected override void OnSettingsLoaded(object sender, SettingsLoadedEventArgs e) { // coerse the value of FontSize if (FontSize < 12 || FontSize > 18) { FontSize = 12; } }
protected virtual void OnSettingsLoaded(object sender, SettingsLoadedEventArgs e) { if (SettingsLoaded != null) { SettingsLoaded(sender, e); } }
void Settings_SettingsLoaded(object sender, System.Configuration.SettingsLoadedEventArgs e) { for (int i = 0; i < MaxExternalTools; i++) { string toolName = "ExternalTool" + i; if (this.PropertyValues[toolName].PropertyValue == null) { this.PropertyValues.Remove(toolName); this.Properties.Remove(toolName); } } }
protected override void OnSettingsLoaded(object sender, SettingsLoadedEventArgs e) { base.OnSettingsLoaded(sender, e); if (IgnoredExtensions == null) { var defaultIgnoredExtensions = new List<string> { ".jpg" }; IgnoredExtensions = new List<string>(defaultIgnoredExtensions); Save(); } }
protected override void OnSettingsLoaded(object sender, System.Configuration.SettingsLoadedEventArgs e) { Log.InfoFormat("Settings Loaded"); base.OnSettingsLoaded(sender, e); PortableSettingsProvider provider = e.Provider as PortableSettingsProvider; if (provider != null) { SettingsFilePath = provider.SettingsFilePath; } }
private void Settings_SettingsLoaded(object sender, SettingsLoadedEventArgs e) { if (Settings.Default.CanUpgrade) Settings.Default.Upgrade(); CanUpgrade = false; // Check if the default folder is null or empty // and set it to the My Videos folder by default. if (String.IsNullOrWhiteSpace(DefaultFolder)) DefaultFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyVideos); }
private void SettingsLoadedEvento(object sender, System.Configuration.SettingsLoadedEventArgs e) { if (cn2.Length > 0) { var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); var connectionStringsSection = (ConnectionStringsSection)config.GetSection("connectionStrings"); if (connectionStringsSection != null) { connectionStringsSection.ConnectionStrings["CapaPresentacion.Properties.Settings.cn"].ConnectionString = cn2; config.Save(); ConfigurationManager.RefreshSection("connectionStrings"); } } }
private void Default_SettingsLoaded(object sender, System.Configuration.SettingsLoadedEventArgs e) { if (string.IsNullOrEmpty(Settings.Default.FavPreset1TextBox)) { Settings.Default.FavPreset1TextBox = GetShortName(Settings.Default.FavPreset1ComboBox); } if (string.IsNullOrEmpty(Settings.Default.FavPreset2TextBox)) { Settings.Default.FavPreset2TextBox = GetShortName(Settings.Default.FavPreset2ComboBox); } if (string.IsNullOrEmpty(Settings.Default.FavPreset3TextBox)) { Settings.Default.FavPreset3TextBox = GetShortName(Settings.Default.FavPreset3ComboBox); } }
private void Settings_SettingsLoaded(object sender, SettingsLoadedEventArgs e) { if (CSharpImportList == null) CSharpImportList = new StringCollection(); if (JavaImportList == null) JavaImportList = new StringCollection(); ImportList.Clear(); ImportList.Add(CSharp.CSharpLanguage.Instance, CSharpImportList); ImportList.Add(Java.JavaLanguage.Instance, JavaImportList); if (string.IsNullOrEmpty(DestinationPath)) { string myDocuments = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); DestinationPath = Path.Combine(myDocuments, "NClass Generated Projects"); } }
private void SettingsLoadedEventHandler(object sender, System.Configuration.SettingsLoadedEventArgs e) { try { Log.Debug($"Loading {SettingsPath}"); if (File.Exists(SettingsPath)) { var actual = XmlManager <List <Setting> > .Load(SettingsPath); foreach (var setting in actual) { try { if (Properties[setting.Name].PropertyType.IsEnum) { this[setting.Name] = Enum.Parse(Properties[setting.Name].PropertyType, setting.Value); } else { this[setting.Name] = Convert.ChangeType(setting.Value, Properties[setting.Name].PropertyType); } } catch (Exception ex) { Log.Warn($"{setting.Name} loading error"); Log.Error(ex); } } Log.Info($"{SettingsPath} loaded"); } else { Log.Warn($"{SettingsPath} does not exist"); } } catch (Exception ex) { Log.Error(ex); } PropertyChanged += (s, a) => HasChanges = true; Log.Info($"Watching {SettingsPath} changes"); }
private void SettingsLoadedEventHandler(object sender, System.Configuration.SettingsLoadedEventArgs e) { try { if (File.Exists(SettingsPath)) { var actual = XmlManager <List <Setting> > .Load(SettingsPath); foreach (var setting in actual) { this[setting.Name] = Convert.ChangeType(setting.Value, this.Properties[setting.Name].PropertyType); } } } catch (Exception ex) { Log.Error(ex); } }
/// <summary> /// Event handler called when settings are finished being loaded. /// Crucially, this method is called even if no saved settings file was found. /// </summary> void ConfigSettings_SettingsLoaded(object sender, SettingsLoadedEventArgs e) { // If the flag is still set to true, we didn't find a config file and we // should attempt an upgrade from a previous version. if (ConfigFileNotFound) { try { Upgrade(); } catch (Exception ex) { s_log.ErrorFormat("Exception performing settings upgrade: {0}", ex.Message); } } // Always save the flag as off so the next time we launch we will know // that it came from a saved config file! ConfigFileNotFound = false; }
private object GetPropertyValue(string propertyName) { if (this.PropertyValues[propertyName] == null) { if (this._firstLoad) { this._firstLoad = false; if (this.IsFirstRunOfClickOnceApp()) { this.Upgrade(); } } object obj1 = base[propertyName]; SettingsProperty property = this.Properties[propertyName]; SettingsProvider provider = (property != null) ? property.Provider : null; SettingsLoadedEventArgs e = new SettingsLoadedEventArgs(provider); this.OnSettingsLoaded(this, e); } return(base[propertyName]); }
void Settings_SettingsLoaded(object sender, System.Configuration.SettingsLoadedEventArgs e) { try { if (FilterMarkColorsRGB == null) { FilterMarkColorsRGB = new int[] { } } ; FilterBackColors = convert_integers2Colors(FilterMarkColorsRGB); if (FilterBackColors.Length < 1) { FilterBackColors = new Color[1] { Color.Red } } ; if (_FilterTypeName2NewFilter == null) { _FilterTypeName2NewFilter = new System.Collections.Specialized.StringCollection(); } for (int i = 0; i < Settings.Default._FilterTypeName2NewFilter.Count; i += 2) { FilterTypeName2NewFilter[Settings.Default._FilterTypeName2NewFilter[i]] = _FilterTypeName2NewFilter[i + 1]; } if (_FilterTreeFolder2SourceFolder == null) { _FilterTreeFolder2SourceFolder = new System.Collections.Specialized.StringCollection(); } for (int i = 0; i < _FilterTreeFolder2SourceFolder.Count; i += 2) { FilterTreeFolder2SourceFolder[_FilterTreeFolder2SourceFolder[i]] = _FilterTreeFolder2SourceFolder[i + 1]; } } catch (Exception ex) { Message.Error(ex); } }
/// <summary> /// Retrieves the value of a setting. We need this method so we can fire the SettingsLoaded event /// when settings are loaded from the providers.Ideally, this should be fired from SettingsBase, /// but unfortunately that will not happen in Whidbey. Instead, we check to see if the value has already /// been retrieved. If not, we fire the load event, since we expect SettingsBase to load all the settings /// from this setting's provider. /// </summary> private object GetPropertyValue(string propertyName) { if (PropertyValues[propertyName] == null) { // we query the value first so that we initialize all values from value providers and so that we don't end up // on an infinite recursion when calling Properties[propertyName] as that calls this. _ = base[propertyName]; SettingsProperty setting = Properties[propertyName]; SettingsProvider provider = setting?.Provider; Debug.Assert(provider != null, "Could not determine provider from which settings were loaded"); SettingsLoadedEventArgs e = new SettingsLoadedEventArgs(provider); OnSettingsLoaded(this, e); // Note: we need to requery the value here in case someone changed it while // handling SettingsLoaded. return(base[propertyName]); } else { return(base[propertyName]); } }
/// <summary> /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed. /// <example> /// settingsloadedeventhandler.BeginInvoke(sender, e, callback); /// </example> /// </summary> public static IAsyncResult BeginInvoke(this SettingsLoadedEventHandler settingsloadedeventhandler, Object sender, SettingsLoadedEventArgs e, AsyncCallback callback) { if(settingsloadedeventhandler == null) throw new ArgumentNullException("settingsloadedeventhandler"); return settingsloadedeventhandler.BeginInvoke(sender, e, callback, null); }
private object GetPropertyValue(string propertyName) { if (this.PropertyValues[propertyName] == null) { if (this._firstLoad) { this._firstLoad = false; if (this.IsFirstRunOfClickOnceApp()) { this.Upgrade(); } } object obj1 = base[propertyName]; SettingsProperty property = this.Properties[propertyName]; SettingsProvider provider = (property != null) ? property.Provider : null; SettingsLoadedEventArgs e = new SettingsLoadedEventArgs(provider); this.OnSettingsLoaded(this, e); } return base[propertyName]; }
protected virtual void OnSettingsLoaded(object sender, SettingsLoadedEventArgs e) { throw new NotImplementedException(); }
private void Settings_SettingsLoaded(object sender, SettingsLoadedEventArgs e) { if (IsPivotalLoginInformationPresent(true)) { ConnectToPivotalAndPopulateData(); } if (IsTFSLoginInformationPresent(true)) { ConnectToTFS(); LoadTFSProjects(); } }
OnSettingsLoaded ( Object sender, SettingsLoadedEventArgs e ) { AssertValid(); Debug.WriteLine("NodeXLApplicationSettingsBase: OnSettingsLoaded()"); base.OnSettingsLoaded(sender, e); }
protected virtual void OnSettingsLoaded (object sender, SettingsLoadedEventArgs e) { if (SettingsLoaded != null) SettingsLoaded (sender, e); }
/// <summary> /// Fires the SettingsLoaded event. /// </summary> protected virtual void OnSettingsLoaded(object sender, SettingsLoadedEventArgs e) { _onSettingsLoaded?.Invoke(this, e); }
/// <devdoc> /// Fires the SettingsLoaded event. /// </devdoc> protected virtual void OnSettingsLoaded(object sender, SettingsLoadedEventArgs e) { if(_onSettingsLoaded != null) { _onSettingsLoaded(this, e); } }
/// <devdoc> /// Retrieves the value of a setting. We need this method so we can fire the SettingsLoaded event /// when settings are loaded from the providers.Ideally, this should be fired from SettingsBase, /// but unfortunately that will not happen in Whidbey. Instead, we check to see if the value has already /// been retrieved. If not, we fire the load event, since we expect SettingsBase to load all the settings /// from this setting's provider. /// </devdoc> private object GetPropertyValue(string propertyName) { if (PropertyValues[propertyName] == null) { // If this is our first load and we are part of a Clickonce app, call Upgrade. if (_firstLoad) { _firstLoad = false; if (IsFirstRunOfClickOnceApp()) { Upgrade(); } } object temp = base[propertyName]; SettingsProperty setting = Properties[propertyName]; SettingsProvider provider = setting != null ? setting.Provider : null; Debug.Assert(provider != null, "Could not determine provider from which settings were loaded"); SettingsLoadedEventArgs e = new SettingsLoadedEventArgs(provider); OnSettingsLoaded(this, e); // Note: we need to requery the value here in case someone changed it while // handling SettingsLoaded. return base[propertyName]; } else { return base[propertyName]; } }
private void Settings_SettingsLoaded(object sender, SettingsLoadedEventArgs e) { if (HotKeys == null) HotKeys = new BindingList<Hotkey>(); }
protected override void OnSettingsLoaded(object sender, SettingsLoadedEventArgs e) { _cachedToolModalityBehavior = null; base.OnSettingsLoaded(sender, e); }
private void Settings_SettingsLoaded(object sender, System.Configuration.SettingsLoadedEventArgs e) { }
static void Default_SettingsLoaded(object sender, SettingsLoadedEventArgs e) { Console.WriteLine("Settings Loaded"); }
public void SettingsLoadedEventHandler(object sender, System.Configuration.SettingsLoadedEventArgs e) { Settings.Default.FtpPassword = ToInsecureString(DecryptString(Settings.Default.FtpPassword)); }
protected virtual new void OnSettingsLoaded(Object sender, SettingsLoadedEventArgs e) { }
private static void Config_SettingsLoaded(object sender, SettingsLoadedEventArgs e) { IsDirtyDictionary[sender].IsReset = false; IsDirtyDictionary[sender].IsDirty = false; }
static void ranSettings_SettingsLoaded(object sender, SettingsLoadedEventArgs e) { }
protected override void OnSettingsLoaded(object sender, SettingsLoadedEventArgs e) { base.OnSettingsLoaded(sender, e); this.CompactPropertyValues(); }