public void FinalDicUpdate() { IObjectPluginConfig finalDic = GetFinalDic(this, SharedDicTestContext.Plugins[0]); _dic.Add(this, SharedDicTestContext.Plugins[0], "key2", "value2"); finalDic["key2"] = "NewValue2"; Assert.That(!_lastConfigChangedEventArgs.IsAllConcerned); Assert.That(_lastConfigChangedEventArgs.Key == "key2"); Assert.That(_lastConfigChangedEventArgs.MultiObj.Count == 1); Assert.That(_lastConfigChangedEventArgs.MultiObj.Contains(this)); Assert.That(_lastConfigChangedEventArgs.MultiPluginId.Count == 1); Assert.That(_lastConfigChangedEventArgs.MultiPluginId.Any((p) => { return(p == SharedDicTestContext.Plugins[0]); })); Assert.That(_lastConfigChangedEventArgs.Obj == this); Assert.That(_lastConfigChangedEventArgs.Status == ChangeStatus.Update); Assert.That((string)_lastConfigChangedEventArgs.Value == "NewValue2"); _lastConfigChangedEventArgs = null; finalDic.GetOrSet("key2", "NewNewValue2"); Assert.IsNull(_lastConfigChangedEventArgs); Assert.Throws <ArgumentNullException>(() => finalDic.GetOrSet <bool>("key2", true, null)); finalDic.GetOrSet <bool>("key2", true, (o) => { return(true); }); Assert.IsNotNull(_lastConfigChangedEventArgs); Assert.That(!_lastConfigChangedEventArgs.IsAllConcerned); Assert.That(_lastConfigChangedEventArgs.Key == "key2"); Assert.That(_lastConfigChangedEventArgs.MultiObj.Count == 1); Assert.That(_lastConfigChangedEventArgs.MultiObj.Contains(this)); Assert.That(_lastConfigChangedEventArgs.MultiPluginId.Count == 1); Assert.That(_lastConfigChangedEventArgs.MultiPluginId.Any((p) => { return(p == SharedDicTestContext.Plugins[0]); })); Assert.That(_lastConfigChangedEventArgs.Obj == this); Assert.That(_lastConfigChangedEventArgs.Status == ChangeStatus.Update); Assert.That((bool)_lastConfigChangedEventArgs.Value == true); }
private void button1_Click(object sender, EventArgs e) { this.myconfig.uid = this.uidBox.Text; this.myconfig.pwd = this.pwdBox.Text; this.myconfig.linkOnStart = this.linkOnStartCheckBox.Checked ? "true" : "false"; this.myconfig.minOnStart = this.minOnStartCheckBox.Checked ? "true" : "false"; if (this.exitRadioButton.Checked) { this.myconfig.onClosing = "exit"; } else if (this.minimumRadioButton.Checked) { this.myconfig.onClosing = "minimum"; } else { this.myconfig.onClosing = "none"; } ConfigChangedEventArgs e1 = new ConfigChangedEventArgs(); e1.myconfig = this.myconfig; //触发事件改变主窗体配置 OnConfigChanged(e1); //保存配置到文件 ch.SaveConfig(this.myconfig); MessageBox.Show("保存成功"); this.Close(); }
/// <summary> /// 触发事件的方法 /// </summary> /// <param name="e"></param> protected virtual void OnConfigChanged(ConfigChangedEventArgs e) { if (ConfigChanged != null) { ConfigChanged(this, e); } }
private void ConfigChanged(object sender, ConfigChangedEventArgs e) { if (LogExpertProxy != null) { NotifySettingsChanged(null, e.Flags); } }
public void Setup() { _lastConfigChangedEventArgs = null; _lastSender = null; _dic = new SharedDictionaryImpl(null); _dic.Changed += (o, e) => { _lastSender = o; _lastConfigChangedEventArgs = e; }; }
internal void RaiseChanged(ConfigChangedEventArgs e) { Debug.Assert(e.MultiPluginId.Contains(_pluginId)); Debug.Assert(e.MultiObj.Contains(_obj)); if (Changed != null) { Changed(this, e); } }
private void Current_ConfigChanged(object sender, ConfigChangedEventArgs e) { PrintTitle("ConfigChange Event Raised..."); var lst = e.ChangedItems.Select(x => JsonConvert.SerializeObject(x)).ToList(); for (int i = 0; i < lst.Count; i++) { Console.WriteLine($"{i}: {lst[i]}"); } }
private void OnUiConfigChangedEvent(object sender, ConfigChangedEventArgs <UiConfig> e) { //Update methods for all handler and services var valueSpecifications = e?.NewValue?.ValueDefinitions?.ToList(); var sources = valueSpecifications?.Select(x => x.DataSource).ToList(); if (sources != null) { _valueHandler.UpdateDataSources(sources); } if (e?.OldValue != null) { NotifySmartDevicesForConfigChange(); } }
/// <summary> /// 当站点承载配置文件发生变更的时候触发的事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public static void ConfigHelper_OnHostingConfigChangedEvent(object sender, ConfigChangedEventArgs e) { if (null == e || null == e.ResultOfChangedConfig) { return; } //IConfiguration config = e.ResultOfChangedConfig; ////设置刷新站点名称 //string siteName = config.GetConfig(Contanst.Config_Node_SiteName); //if (!string.IsNullOrEmpty(siteName)) //{ // SiteName = siteName; //} ////设置请求戳的过期验证时间 //int signTimeOut = config.GetConfigInt(Contanst.Config_Node_SignTimeOut); //SignTimeOut = signTimeOut; }
void OnConfigContainerChanged(object sender, ConfigChangedEventArgs e) { if (e.IsAllPluginsConcerned) { foreach (PluginConfigAccessor p in _configAccessors.Values) { p.RaiseConfigChanged(e); } } else { PluginConfigAccessor result; foreach (INamedVersionedUniqueId pId in e.MultiPluginId) { if (_configAccessors.TryGetValue(pId, out result)) { result.RaiseConfigChanged(e); } } } }
public void OnConfigChanged(object sender, ConfigChangedEventArgs e) { thisGame.CurrentConfig = e.config; thisGame.MakeConfig(@".\HikazeLauncher\Config.json"); }
void OnConfigChanged(object sender, ConfigChangedEventArgs e) { if (Changed == null) { // no listeners return; } if (!e.Key.StartsWith(_UserPrefix)) { // setting for some other user has changed return; } var key = e.Key.Substring(_UserPrefix.Length); Changed(this, new ConfigChangedEventArgs(key, e.Value)); }
public void OnConfigLoad(object sender, ConfigChangedEventArgs e) { config = e.config; }
private void OnConfigChangedEvent(object sender, ConfigChangedEventArgs <SmartDeviceConfig> configChangedEventArgs) { _smartDeviceConfig = configChangedEventArgs.NewValue; }
private void OnConfigChangedEvent(object sender, ConfigChangedEventArgs <UserConfig> configChangedEventArgs) { _userConfig = configChangedEventArgs.NewValue; }
private void OnSDConfigChangedEvent(object sender, ConfigChangedEventArgs <SmartDeviceConfig> e) { NotifySmartDevicesForConfigChange(); }
private void ConfigChanged(object sender, ConfigChangedEventArgs e) { this.config = e.NewConfig; hybridConnectionTcpClientHost.UpdateConfig(config); hybridConnectionTcpListenerHost.UpdateConfig(config); }
/// <summary> /// Event called when any property in the config is changed /// </summary> /// <param name="source"></param> /// <param name="args"></param> void OnConfigChanged(object source, ConfigChangedEventArgs args) { if (args.PropertyName == "AlwaysOnTop") { this.TopMost = this.Config.AlwaysOnTop; } else if (args.PropertyName == "UseTrayIcon") { bool useTrayIcon = Config.UseTrayIcon; if (useTrayIcon == false && this.Visible == false) { BringToFront(); Show(); WindowState = FormWindowState.Normal; Activate(); } notifyIcon.Visible = useTrayIcon; } else if (args.PropertyName == "AutoSize" || (args.PropertyName == "Authenticator" && args.AuthenticatorChangedEventArgs.Property == "Name")) { setAutoSize(); this.Invalidate(); } else if (args.PropertyName == "StartWithWindows") { if (this.Config.IsPortable == false) { WinAuthHelper.SetStartWithWindows(this.Config.StartWithWindows); } } else if (args.AuthenticatorChangedEventArgs != null && args.AuthenticatorChangedEventArgs.Property == "HotKey") { // rehook hotkeys HookHotkeys(); } // batch up saves so they can be done out of line SaveConfig(); }
void OnUserConfigChanged(object sender, ConfigChangedEventArgs e) { if (e.Key.StartsWith("Filters/")) { #if LOG4NET f_Logger.Debug("OnUserConfigChanged(): refreshing filters"); #endif // referesh filters // TODO: use a timeout here to only refresh once in 1 second _Filters = _FilterListController.GetFilterList().Values; } }