Beispiel #1
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            _window = new UIWindow (UIScreen.MainScreen.Bounds);

            _quantityGroup = new RadioGroup("Qty", 0);
            _fromUnitGroup = new RadioGroup("FromU", 0);
            _toUnitGroup = new RadioGroup("ToU", 0);

            var quantityRootElement = new RootElement("Quantity", _quantityGroup) { new Section() };
            quantityRootElement[0].AddAll(QuantityCollection.Quantities.Select(qty => {
                var elem = new EventHandlingRadioElement(qty.Quantity.DisplayName, "Qty");
                elem.OnSelected += OnQuantitySelected;
                return elem as Element;
            }));

            _rootElement = new RootElement ("Unit Converter")
            {
                new Section() { quantityRootElement },
                new Section("From") { new EntryElement("Amount", string.Empty, string.Empty),
                    new RootElement("Unit", _fromUnitGroup) { new Section() } },
                new Section("To") { new EntryElement("Amount", string.Empty, string.Empty),
                    new RootElement("Unit", _toUnitGroup) { new Section() } }
            };

            _rootVC = new DialogViewController(_rootElement);
            _nav = new UINavigationController(_rootVC);

            _window.RootViewController = _nav;
            _window.MakeKeyAndVisible();

            return true;
        }
Beispiel #2
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            _window = new UIWindow(UIScreen.MainScreen.Bounds);

            _quantityGroup = new RadioGroup("Qty", 0);
            _fromUnitGroup = new RadioGroup("FromU", 0);
            _toUnitGroup   = new RadioGroup("ToU", 0);

            var quantityRootElement = new RootElement("Quantity", _quantityGroup)
            {
                new Section()
            };

            quantityRootElement[0].AddAll(QuantityCollection.Quantities.Select(qty => {
                var elem         = new EventHandlingRadioElement(qty.Quantity.ToString(), "Qty");
                elem.OnSelected += OnQuantitySelected;
                return(elem as Element);
            }));

            _rootElement = new RootElement("Unit Converter")
            {
                new Section()
                {
                    quantityRootElement
                },
                new Section("From")
                {
                    new EntryElement("Amount", string.Empty, string.Empty),
                    new RootElement("Unit", _fromUnitGroup)
                    {
                        new Section()
                    }
                },
                new Section("To")
                {
                    new EntryElement("Amount", string.Empty, string.Empty),
                    new RootElement("Unit", _toUnitGroup)
                    {
                        new Section()
                    }
                }
            };

            _rootVC = new DialogViewController(_rootElement);
            _nav    = new UINavigationController(_rootVC);

            _window.RootViewController = _nav;
            _window.MakeKeyAndVisible();

            return(true);
        }