public void Setup() { _lastConfigChangedEventArgs = null; _lastSender = null; _dic = new SharedDictionaryImpl( null ); _dic.Changed += ( o, e ) => { _lastSender = o; _lastConfigChangedEventArgs = e; }; }
/// <summary> /// Change detection is made by the runner itself (one event subscription) since /// it use its dictionnary to route the event: this is far more efficient than /// if each PluginConfigAccessor had to subscribe and filter the event for its plugin identifier. /// </summary> /// <param name="e"></param> internal void RaiseConfigChanged(ConfigChangedEventArgs e) { Debug.Assert(e.MultiPluginId.Contains(_idEdited)); if (ConfigChanged != null) { ConfigChanged(this, e); } }
void ObjectConfigurationChanged(object source, ConfigChangedEventArgs e) { Debug.Assert(source == _dic); if (e.Obj == _userConfiguration) { IsUserConfigDirty = true; } else if (e.Obj == _systemConfiguration) { IsSystemConfigDirty = true; } }
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 ); } } }
protected override void OnConfigChanged( object sender, ConfigChangedEventArgs e ) { DispatchPropertyChanged(); }
/// <summary> /// Launches OnPropertyChanged when needed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void OnConfigChanged( object sender, ConfigChangedEventArgs e ) { if( e.MultiPluginId.Any( ( c ) => c.UniqueId.Equals( this.PluginGuid ) ) && !String.IsNullOrEmpty( e.Key ) ) { switch( e.Key ) { case "TimeBeforeCountDownStarts": MouseWatcher.Service.TimeBeforeCountDownStarts = (int)e.Value; break; case "CountDownDuration": MouseWatcher.Service.CountDownDuration = (int)e.Value; break; case "ShowMouseIndicatorOption": OnPropertyChanged( "ShowMouseIndicator" ); break; default: return; } OnPropertyChanged( e.Key ); } }
protected override void OnConfigChanged( object sender, ConfigChangedEventArgs e ) { NotifyOfPropertiesChange(); }
void OnConfigChanged( object sender, ConfigChangedEventArgs e ) { if( LayoutKeyMode.GetPropertyLookupPath().Contains( e.Obj ) ) { PropertyChangedTriggers( e.Key ); } }
protected override void OnConfigChanged( object sender, ConfigChangedEventArgs e ) { NotifyOfPropertyChange( () => CountDownDuration ); NotifyOfPropertyChange( () => TimeBeforeCountDownStarts ); NotifyOfPropertyChange( () => ShowMouseIndicatorOption ); }
void OnConfigChanged( object sender, ConfigChangedEventArgs e ) { Debug.Assert( Dispatcher.CurrentDispatcher == Context.NoFocusManager.ExternalDispatcher, "This method should only be called by the ExternalThread." ); if( e.Obj == Layout ) { switch( e.Key ) { case "KeyboardBackground": UpdateBackgroundPath(); Context.NoFocusManager.NoFocusDispatcher.Invoke( (Action)(() => { OnPropertyChanged( "BackgroundImagePath" ); }) ); break; case "InsideBorderColor": SafeUpdateInsideBorderColor(); Context.NoFocusManager.NoFocusDispatcher.Invoke( (Action)(() => { OnPropertyChanged( "InsideBorderColor" ); }) ); break; case "HighlightBackground": UpdateHighlightBackground(); Context.NoFocusManager.NoFocusDispatcher.Invoke( (Action)(() => { OnPropertyChanged( "HighlightBackground" ); }) ); break; case "HighlightFontColor": UpdateHighlightFontColor(); Context.NoFocusManager.NoFocusDispatcher.Invoke( (Action)(() => { OnPropertyChanged( "HighlightFontColor" ); }) ); break; case "LoopCount": UpdateLoopCount(); Context.NoFocusManager.NoFocusDispatcher.Invoke( (Action)(() => { OnPropertyChanged( "LoopCount" ); }) ); break; } } }
void OnConfigChanged( object sender, ConfigChangedEventArgs e ) { if( e.MultiPluginId.Any( u => u.UniqueId == InputTrigger.PluginId.UniqueId ) && ( e.Key == "TriggerCode" || e.Key == "TriggerDevice" ) ) { if( _currentDevice == TriggerDevice.Keyboard ) //If we were listening to a keyboard key, unregister it. KeyboardDriver.Service.UnregisterCancellableKey( _keyCode ); if( e.Key == "TriggerCode" ) //Retrieving the new code. _keyCode = (int)e.Value; else if( e.Key == "TriggerDevice" ) //Retrieving the new TriggerDevice { TriggerDevice temp = TriggerDevice.None; if( Enum.TryParse<TriggerDevice>( e.Value.ToString(), out temp ) ) _currentDevice = temp; } if( _currentDevice == TriggerDevice.Keyboard ) //If we are now listening to a keyboard key, register it KeyboardDriver.Service.RegisterCancellableKey( _keyCode ); } }
void OnLayoutConfigChanged( object sender, ConfigChangedEventArgs e ) { if( e.MultiPluginId.Any( ( c ) => String.Compare( c.UniqueId.ToString(), "36C4764A-111C-45E4-83D6-E38FC1DF5979", StringComparison.InvariantCultureIgnoreCase ) == 0 ) ) { switch( e.Key ) { case "Background": case "HoverBackground": case "PressedBackground": case "FontSize": case "FontWeight": case "FontSizes": case "FontStyle": case "TextDecorations": case "FontColor": case "LetterColor": OnPropertyChanged( "TextDecorationsAsBool" ); OnPropertyChanged( "PressedBackground" ); OnPropertyChanged( "FontWeightAsBool" ); OnPropertyChanged( "FontStyleAsBool" ); OnPropertyChanged( "TextDecorations" ); OnPropertyChanged( "HoverBackground" ); OnPropertyChanged( "LetterColor" ); OnPropertyChanged( "FontWeight" ); OnPropertyChanged( "Background" ); OnPropertyChanged( "FontWeight" ); OnPropertyChanged( "FontStyle" ); OnPropertyChanged( "FontSizes" ); OnPropertyChanged( "FontStyle" ); OnPropertyChanged( "FontSize" ); break; default: break; } } }
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 ); }
void OnConfigChanged( object sender, ConfigChangedEventArgs e ) { switch( e.Key ) { case "Opacity": _radar.ViewModel.Opacity = (int)e.Value / 100f; break; case "RadarSize": _radar.ViewModel.RadarSize = (int)e.Value * 2; _radar.Height = _radar.ViewModel.WindowSize; _radar.Width = _radar.ViewModel.WindowSize; _radar.UpdateLocation( MouseDriver.Service.CurrentPointerXLocation, MouseDriver.Service.CurrentPointerYLocation ); break; case "RotationSpeed": _radar.RotationSpeed = (int)e.Value; break; case "TranslationSpeed": _radar.TranslationSpeed = (int)e.Value; break; case "ArrowColor": _radar.ViewModel.SetArrowColor( (Color)e.Value ); break; case "CircleColor": _radar.ViewModel.SetCircleColor( (Color)e.Value ); break; } }
void OnConfigChanged( object sender, ConfigChangedEventArgs e ) { if( _key.Current.GetPropertyLookupPath().Contains( e.Obj ) ) { if( String.IsNullOrWhiteSpace( e.Key ) ) { OnPropertyChanged( "Image" ); OnPropertyChanged( "ImageSource" ); OnPropertyChanged( "ShowLabel" ); OnPropertyChanged( "ShowImage" ); } else { switch( e.Key ) { case "Image": GetImageSourceCache(); OnPropertyChanged( "Image" ); OnPropertyChanged( "ImageSource" ); break; case "DisplayType": OnPropertyChanged( "ShowImage" ); OnPropertyChanged( "ShowLabel" ); LayoutKeyModeVM.TriggerPropertyChanged( "ShowLabel" ); break; } } } if( LayoutKeyMode.GetPropertyLookupPath().Contains( e.Obj ) ) { //Console.Out.WriteLine( e.Key ); if( String.IsNullOrWhiteSpace( e.Key ) ) { OnPropertyChanged( "Opacity" ); OnPropertyChanged( "FontSize" ); OnPropertyChanged( "FontStyle" ); OnPropertyChanged( "FontWeight" ); OnPropertyChanged( "Background" ); OnPropertyChanged( "LetterColor" ); OnPropertyChanged( "HoverBackground" ); OnPropertyChanged( "TextDecorations" ); OnPropertyChanged( "PressedBackground" ); OnPropertyChanged( "HighlightBackground" ); OnPropertyChanged( "HighlightFontColor" ); } else { switch( e.Key ) { case "Opacity": OnPropertyChanged( "Opacity" ); break; case "Visible": OnPropertyChanged( "Visible" ); LayoutKeyModeVM.TriggerPropertyChanged( "Visible" ); break; case "FontSize": OnPropertyChanged( "FontSize" ); break; case "FontStyle": OnPropertyChanged( "FontStyle" ); break; case "FontWeight": OnPropertyChanged( "FontWeight" ); break; case "Background": OnPropertyChanged( "Background" ); break; case "LetterColor": OnPropertyChanged( "LetterColor" ); break; case "HoverBackground": OnPropertyChanged( "HoverBackground" ); break; case "TextDecorations": OnPropertyChanged( "TextDecorations" ); break; case "PressedBackground": OnPropertyChanged( "PressedBackground" ); break; case "HighlightBackground": OnPropertyChanged( "HighlightBackground" ); break; case "HighlightFontColor": OnPropertyChanged( "HighlightFontColor" ); break; default: break; } } } }
protected override void OnConfigChanged( object sender, ConfigChangedEventArgs e ) { NotifyOfPropertyChange( () => EnableAutoHide ); NotifyOfPropertyChange( () => AutoHideTimeOut ); }
void OnConfigChanged( object sender, ConfigChangedEventArgs e ) { if( e.MultiPluginId.Any( ( c ) => c.UniqueId.Equals( this.PluginGuid ) ) && !String.IsNullOrEmpty( e.Key ) ) { switch( e.Key ) { case "MaxLapCount": MaxLapCount = (int)e.Value; break; case "ClickDepth": ClickDepth = (int)e.Value; break; case "SquareSize": SquareSize = (int)e.Value; break; case "BackgroundColor": BackgroundColor = e.Value.ToString(); break; default: return; } ExitAll(); CurrentNode = null; ChildNodes.Clear(); InitializeGrid(); } }
private void OnConfigChangedWrapper( object sender, ConfigChangedEventArgs e ) { if( e.MultiPluginId.Contains( _plugin ) ) { OnConfigChanged( sender, e ); } }
void OnConfigChanged( object sender, ConfigChangedEventArgs e ) { if( e.MultiPluginId.Any( ( c ) => c.UniqueId.Equals( this.PluginGuid ) ) && !String.IsNullOrEmpty( e.Key ) ) { if( e.Key == "autohide" || e.Key == "autohide-timeout" ) UpdateAutoHideConfig(); } }
protected abstract void OnConfigChanged( object sender, ConfigChangedEventArgs e );
protected override void OnConfigChanged( object sender, ConfigChangedEventArgs e ) { NotifyOfPropertyChange( () => MaxSuggestedWords ); NotifyOfPropertyChange( () => InsertSpaceAfterPredictedWord ); NotifyOfPropertyChange( () => UsesSemanticPrediction ); NotifyOfPropertyChange( () => FilterAlreadyShownWords ); NotifyOfPropertyChange( () => DisplayContextEditor ); }
protected override void OnConfigChanged( object sender, ConfigChangedEventArgs e ) { if( e.MultiPluginId.Any( u => u.UniqueId == ScrollerPlugin.PluginId.UniqueId ) ) { if( e.Key == "Speed" ) { var newInterval = new TimeSpan(0, 0, 0, 0, (int) e.Value); if( !IsTurboMode ) _normalInterval = newInterval; else { _normalInterval = newInterval; SetTurboWithCheck(); } } if( e.Key == "TurboSpeed" ) { TurboInterval = new TimeSpan( 0, 0, 0, 0, (int)e.Value ); if( Timer.Interval != _normalInterval ) SetTurboWithCheck(); } } }
void OnConfigChangedInternal( object sender, ConfigChangedEventArgs e ) { Debug.Assert( Dispatcher.CurrentDispatcher == Application.Current.Dispatcher, "This method should only be called by the Application Thread." ); OnConfigChanged( sender, e ); }
private void OnConfigChanged( object sender, ConfigChangedEventArgs e ) { if( e.MultiPluginId.Any( u => u.UniqueId == ScrollerPlugin.PluginId.UniqueId ) ) { if( e.Key == "Strategy" ) { _scrollingStrategy.SwitchTo( e.Value.ToString() ); } else if( e.Key == "Trigger" ) { if( _currentTrigger != null ) { InputTrigger.Service.Unregister( _currentTrigger, OnInputTriggered ); _currentTrigger = Configuration.User.GetOrSet( "Trigger", InputTrigger.Service.DefaultTrigger ); InputTrigger.Service.RegisterFor( _currentTrigger, OnInputTriggered ); } } else if( e.Key == "ScrollableModules" ) { Console.Out.WriteLine( "Scrollable changed" ); ScrollingElementConfiguration conf = (ScrollingElementConfiguration)e.Value; var disabledElements = conf.Select( m => m.InternalName ).ToList(); //Getting the removed items and propagating the fact that they have been removed var removed = disabledElements.Except( _disabledElements ); foreach( var removedItem in removed ) { if( _registeredElements.ContainsKey( removedItem ) ) _scrollingStrategy.ElementUnregistered( _registeredElements[removedItem] ); } _disabledElements = disabledElements; } } }
void OnLayoutConfigChanged( object sender, ConfigChangedEventArgs e ) { if( e.MultiPluginId.Any( ( c ) => String.Compare(c.UniqueId.ToString(), "36C4764A-111C-45E4-83D6-E38FC1DF5979", true ) == 0 ) ) { switch( e.Key ) { case "Background": case "HoverBackground": case "PressedBackground": case "FontSize": case "FontWeight": case "FontSizes": case "FontStyle": case "TextDecorations": case "FontColor": NotifyOfPropertyChange( () => Background ); NotifyOfPropertyChange( () => HoverBackground ); NotifyOfPropertyChange( () => PressedBackground ); NotifyOfPropertyChange( () => FontSize ); NotifyOfPropertyChange( () => FontWeight ); NotifyOfPropertyChange( () => FontSizes ); NotifyOfPropertyChange( () => FontStyle ); NotifyOfPropertyChange( () => TextDecorations ); NotifyOfPropertyChange( () => FontColor ); break; default: break; } } }
protected virtual void OnConfigChanged( object sender, ConfigChangedEventArgs e ) { if( e.MultiPluginId.Any( u => u.UniqueId == ScrollerPlugin.PluginId.UniqueId ) ) { if( e.Key == "Speed" ) { Timer.Interval = new TimeSpan( 0, 0, 0, 0, (int)e.Value ); } } }
void OnConfigChanged( object sender, ConfigChangedEventArgs e ) { Debug.Assert( Dispatcher.CurrentDispatcher == Context.NoFocusManager.ExternalDispatcher, "This method should only be called by the ExternalThread." ); if( LayoutKeyMode.GetPropertyLookupPath().Contains( e.Obj ) ) { LayoutPropertyChangedTriggers( e.Key ); } if( _key.Current.GetPropertyLookupPath().Contains( e.Obj ) ) { PropertyChangedTriggers( e.Key ); } }
void OnConfigChanged( object sender, ConfigChangedEventArgs e ) { if( e.Obj == Layout ) { switch( e.Key ) { case "KeyboardBackground": OnPropertyChanged( "BackgroundImagePath" ); break; case "InsideBorderColor": OnPropertyChanged( "InsideBorderColor" ); break; } } }
void OnConfigChanged( object sender, ConfigChangedEventArgs e ) { if( PropertyChanged != null ) PropertyChanged( this, new PropertyChangedEventArgs( e.Key ) ); }
protected override void OnConfigChanged( object sender, ConfigChangedEventArgs e ) { if( e != null && e.Key == "ScrollableModules" ) { UpdateAll(); } }
void ObjectConfigurationChanged( object source, ConfigChangedEventArgs e ) { Debug.Assert( source == _dic ); if( e.Obj == _userConfiguration ) { IsUserConfigDirty = true; } else if( e.Obj == _systemConfiguration ) { IsSystemConfigDirty = true; } }