public override void LoadView() { base.LoadView(); Utility = new XMUtilities(); Utility.SetCallback (new XMUtilityCallback (OurCallback)); var operandSection = new Section("Operands") { new EntryElement("Name: ", "", ""), new EntryElement("Operand One: ", "", ""), new EntryElement("Operand Two: ", "", ""), }; var operationSection = new Section("Operations") { new StringElement("Add", Handle_AddOperation), new StringElement("Multiply", Handle_MultiplyOperation), new StringElement("Hello", Handle_HelloOperation), new StringElement("Invoke Callback", Handle_InvokeCallback), }; var resultSection = new Section("Result") { new StringElement(@"") }; var customViewSection = new Section("More Bindings") { new StringElement("Go to CustomView!", () => { var c = new CustomViewController(); this.NavigationController.PushViewController(c, true); }) }; this.Root.Add(new Section[] { operandSection, operationSection, resultSection, customViewSection }); }
public override void LoadView() { base.LoadView(); utility = new XMUtilities(); utility.SetCallback(new XMUtilityCallback(message => { SetResultElementValue("Callback: " + message); })); Root.Add(new[] { new Section("Operands") { new EntryElement("Name: ", "", ""), new EntryElement("Operand One: ", "", ""), new EntryElement("Operand Two: ", "", ""), }, new Section("Result") { new StringElement("") }, new Section("Operations") { new StringElement("Add", Handle_AddOperation), new StringElement("Subtract", Handle_SubtractOperation), new StringElement("Multiply", Handle_MultiplyOperation), new StringElement("Echo", Handle_EchoOperation), new StringElement("Speak", Handle_SpeakOperation), new StringElement("Speak Greeting", Handle_SpeakGreetingOperation), new StringElement("Hello", Handle_HelloOperation), new StringElement("Invoke Callback", Handle_InvokeCallback), }, new Section("More Bindings") { new StringElement("Go to CustomView!", () => { var c = new CustomViewController(); NavigationController.PushViewController(c, true); }) } }); }
void Handle_EchoOperation() { var nameElement = Root[0][0] as EntryElement; SetResultElementValue(XMUtilities.Echo(nameElement.Value)); }