Example #1
0
 public System.Windows.Input.CommandBinding AddZoomOut(
     System.Windows.Input.CommandBindingCollection commandBindings)
 {
     if (commandBindings != null)
     {
         var cb =
             new System.Windows.Input.CommandBinding(
                 ZoomOutCommand,
                 ZoomOutExecuted,
                 CanExecuteZoomOut);
         commandBindings.Add(cb);
         return(cb);
     }
     else
     {
         return(null);
     }
 }
Example #2
0
 public System.Windows.Input.CommandBinding AddShrinkRoi(
     System.Windows.Input.CommandBindingCollection commandBindings)
 {
     if (commandBindings != null)
     {
         var cb =
             new System.Windows.Input.CommandBinding(
                 ShrinkRoiCommand,
                 ShrinkRoiExecuted,
                 CanExecuteShrinkRoi);
         commandBindings.Add(cb);
         return(cb);
     }
     else
     {
         return(null);
     }
 }
        public void InputCollectionsPeculiarityOrBug()
        {
            // InputBindingCollection START
            var inputBindingCollection = new System.Windows.Input.InputBindingCollection();

            // NOTE: this silently fails (Count is 0 after insert)
            inputBindingCollection.Insert(0, new System.Windows.Input.MouseBinding());
            Assert.IsTrue(inputBindingCollection.Count == 0);

            inputBindingCollection.Add(new System.Windows.Input.MouseBinding());
            Assert.IsTrue(inputBindingCollection.Count == 1);

            inputBindingCollection.Insert(0, new System.Windows.Input.MouseBinding());
            Assert.IsTrue(inputBindingCollection.Count == 2);
            // InputBindingCollection END

            // CommandBindingCollection START
            var commandBindingCollection = new System.Windows.Input.CommandBindingCollection();

            // NOTE: this silently fails (Count is 0 after insert)
            commandBindingCollection.Insert(0, new System.Windows.Input.CommandBinding());
            Assert.IsTrue(commandBindingCollection.Count == 0);

            commandBindingCollection.Add(new System.Windows.Input.CommandBinding());
            Assert.IsTrue(commandBindingCollection.Count == 1);

            commandBindingCollection.Insert(0, new System.Windows.Input.CommandBinding());
            Assert.IsTrue(commandBindingCollection.Count == 2);
            // CommandBindingCollection END

            // List START (how it probably should work...)
            var list = new List <string>();

            // NOTE: this is successful for ordinary List<T>
            list.Insert(0, "A");
            Assert.IsTrue(list.Count == 1);

            list.Add("A");
            Assert.IsTrue(list.Count == 2);

            list.Insert(0, "A");
            Assert.IsTrue(list.Count == 3);
            // List END
        }
		public void InputCollectionsPeculiarityOrBug()
		{
			// InputBindingCollection START
			var inputBindingCollection = new System.Windows.Input.InputBindingCollection();
			
			// NOTE: this silently fails (Count is 0 after insert)
			inputBindingCollection.Insert(0, new System.Windows.Input.MouseBinding());
			Assert.IsTrue(inputBindingCollection.Count == 0);
			
			inputBindingCollection.Add(new System.Windows.Input.MouseBinding());
			Assert.IsTrue(inputBindingCollection.Count == 1);
			
			inputBindingCollection.Insert(0, new System.Windows.Input.MouseBinding());
			Assert.IsTrue(inputBindingCollection.Count == 2);
			// InputBindingCollection END
			
			// CommandBindingCollection START
			var commandBindingCollection = new System.Windows.Input.CommandBindingCollection();
			
			// NOTE: this silently fails (Count is 0 after insert)
			commandBindingCollection.Insert(0, new System.Windows.Input.CommandBinding());
			Assert.IsTrue(commandBindingCollection.Count == 0);
			
			commandBindingCollection.Add(new System.Windows.Input.CommandBinding());
			Assert.IsTrue(commandBindingCollection.Count == 1);
			
			commandBindingCollection.Insert(0, new System.Windows.Input.CommandBinding());
			Assert.IsTrue(commandBindingCollection.Count == 2);
			// CommandBindingCollection END
			
			// List START (how it probably should work...)
			var list = new List<string>();
			
			// NOTE: this is successful for ordinary List<T>
			list.Insert(0, "A");
			Assert.IsTrue(list.Count == 1);
			
			list.Add("A");
			Assert.IsTrue(list.Count == 2);
			
			list.Insert(0, "A");
			Assert.IsTrue(list.Count == 3);
			// List END
		}