Beispiel #1
0
		/// <summary>
		/// Sets up basic keybindings for the UI.
		/// </summary>
		private void SetUIKeys() {

			InputBinder binder = this.GetService<InputBinder>();
			if( binder != null ) {
				binder.AddBinding( this, new KeyBinding( this.CmdPrevFile, new KeyGesture( Key.Left ) ) );
				binder.AddBinding( this, new KeyBinding( this.CmdNextFile, new KeyGesture( Key.Right ) ) );
			}

		} //
Beispiel #2
0
		} //

		#endregion

		private void CategorySetUpdated( object sender, NotifyCollectionChangedEventArgs e ) {

			InputBinder binder = this.GetService<InputBinder>();
			if( binder == null ) {
				Console.WriteLine( @"ERROR: Can't find InputBinder service." );
				return;
			}

			switch( e.Action ) {

				case NotifyCollectionChangedAction.Remove:

					foreach( FileCategory cat in e.OldItems ) {
						binder.RemoveBinding( this, cat.Gesture );
					}
					break;

				case NotifyCollectionChangedAction.Add:

					Console.WriteLine( @"CategorySet ADD ACTION" );
					foreach( FileCategory cat in e.NewItems ) {
						InputBinding b = this.CategorySet.MakeCategoryBinding( this.CmdCategoryClick, cat );
						if( b != null ) {
							binder.AddBinding( this, b );
						}
					}
					break;

				case NotifyCollectionChangedAction.Replace:

					foreach( FileCategory cat in e.OldItems ) {
						binder.RemoveBinding( this, cat.Gesture );
					}
					foreach( FileCategory cat in e.NewItems ) {

						InputBinding b = this.CategorySet.MakeCategoryBinding( this.CmdCategoryClick, cat );
						if( b != null ) {
							binder.AddBinding( this, b );
						}

					}

					break;
				case NotifyCollectionChangedAction.Reset:
					Console.WriteLine( @"RESET COLLECTION ACTION" );
					this.ClearKeyBindings();
					this.ResetKeyBindings();
					break;

			}

		} //