NSTableViewBinding.TestWindowController.inspect C# (CSharp) Méthode

inspect() private méthode

private inspect ( NSArray sender ) : void
sender NSArray
Résultat void
		partial void inspect (NSArray sender)
		{
			NSArray selectedObjects = sender;
			Console.WriteLine("inspect");
			
			int index;
			uint numItems = selectedObjects.Count;
			for (index = 0; index < numItems; index++)
			{
				NSDictionary objectDict =  new NSDictionary(selectedObjects.ValueAt(0));

				if (objectDict != null)
				{
					Console.WriteLine(string.Format("inspector item: [ {0} {1}, {2} ]",
					                                (NSString)objectDict[FIRST_NAME].ToString(),
					                                (NSString)objectDict[LAST_NAME].ToString(),
					                                (NSString)objectDict[PHONE].ToString()));
				}
				
				// setup the edit sheet controller if one hasn't been setup already
				if (myEditController == null)
					myEditController = new EditController();
				
				// remember which selection index we are changing
				int savedSelectionIndex = myContentArray.SelectionIndex;
				
				NSDictionary editItem =  new NSDictionary(selectedObjects.ValueAt(0));
				
				// get the current selected object and start the edit sheet
				NSMutableDictionary newValues = myEditController.edit(editItem, this);

				if (!myEditController.Cancelled)
				{
					// remove the current selection and replace it with the newly edited one
					var currentObjects = myContentArray.SelectedObjects;
					myContentArray.Remove(currentObjects);
					
					// make sure to add the new entry at the same selection location as before
					myContentArray.Insert(newValues,savedSelectionIndex);
				}
			}
		}