public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            _window = new UIWindow(UIScreen.MainScreen.Bounds);

            _rootElement = new RootElement("Json Example")
            {
                new Section("Demo Json")
                {
                    JsonElement.FromFile("sample.json"),
                    new JsonElement("Load from url", "http://localhost/sample.json")
                },
                new Section("Tasks Sample")
            };

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

            _addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add);
            _rootVC.NavigationItem.RightBarButtonItem = _addButton;

            _addButton.Clicked += (sender, e) => {
                ++n;

                var task = new Task {
                    Name = "task " + n, DueDate = DateTime.Now
                };

                var taskElement = JsonElement.FromFile("task.json");

                taskElement.Caption = task.Name;

                var description = taskElement ["task-description"] as EntryElement;

                if (description != null)
                {
                    description.Caption = task.Name;
                    description.Value   = task.Description;
                }

                var duedate = taskElement ["task-duedate"] as DateElement;

                if (duedate != null)
                {
                    duedate.DateValue = task.DueDate;
                }

                _rootElement [1].Add(taskElement);
            };

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

            return(true);
        }
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            _window = new UIWindow(UIScreen.MainScreen.Bounds);

            _rootElement = new RootElement("Web services")
            {
                new Section("Select Service")
                {
                    (Element)JsonElement.FromFile("irisclassifier.json", this)
                    //You can add more JsonElements here by adding more json files which will enable more services
                }
            };

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

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

            return(true);
        }
示例#3
0
        // This method is invoked when the application has loaded its UI and its ready to run
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            JsonElement sampleJson;
            var         Last = new DateTime(2010, 10, 7);

            Console.WriteLine(Last);

            var p = Path.GetFullPath("background.png");

            var menu = new RootElement("Demos")
            {
                new Section("Element API")
                {
                    new StringElement("iPhone Settings Sample", DemoElementApi),
                    new StringElement("Dynamically load data", DemoDynamic),
                    new StringElement("Add/Remove demo", DemoAddRemove),
                    new StringElement("Assorted cells", DemoDate),
                    new StyledStringElement("Styled Elements", DemoStyled)
                    {
                        BackgroundUri = new Uri("file://" + p)
                    },
                    new StringElement("Load More Sample", DemoLoadMore),
                    new StringElement("Row Editing Support", DemoEditing),
                    new StringElement("Advanced Editing Support", DemoAdvancedEditing),
                    new StringElement("Owner Drawn Element", DemoOwnerDrawnElement),
                },
                new Section("Container features")
                {
                    new StringElement("Pull to Refresh", DemoRefresh),
                    new StringElement("Headers and Footers", DemoHeadersFooters),
                    new StringElement("Root Style", DemoContainerStyle),
                    new StringElement("Index sample", DemoIndex),
                },
                new Section("Json")
                {
                    (sampleJson = JsonElement.FromFile("sample.json")),
                    // Notice what happens when I close the paranthesis at the end, in the next line:
                    new JsonElement("Load from URL", "file://" + Path.GetFullPath("sample.json"))
                },
                new Section("Auto-mapped", footer)
                {
                    new StringElement("Reflection API", DemoReflectionApi)
                },
            };

            //
            // Lookup elements by ID:
            //
            var jsonSection = sampleJson ["section-1"] as Section;

            Console.WriteLine("The section has {0} elements", jsonSection.Count);
            var booleanElement = sampleJson ["first-boolean"] as BooleanElement;

            Console.WriteLine("The state of the first-boolean value is {0}", booleanElement.Value);

            //
            // Create our UI and add it to the current toplevel navigation controller
            // this will allow us to have nice navigation animations.
            //
            var dv = new DialogViewController(menu)
            {
                Autorotate = true
            };

            navigation.PushViewController(dv, true);

            window.MakeKeyAndVisible();

            // On iOS5 we use the new window.RootViewController, on older versions, we add the subview
            if (UIDevice.CurrentDevice.CheckSystemVersion(5, 0))
            {
                window.RootViewController = navigation;
            }
            else
            {
                window.AddSubview(navigation.View);
            }

            return(true);
        }
示例#4
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)
        {
            // create a new window instance based on the screen size



            window = new UIWindow(UIScreen.MainScreen.Bounds);

            myImages = new List <UIImage> ();


            myImages.Add(UIImage.FromFile("Images/Icon-72.png"));
            myImages.Add(UIImage.FromFile("Images/Icon.png"));
            myImages.Add(UIImage.FromFile("Images/Icon-72.png"));

            myImages.Add(UIImage.FromFile("Images/Icon-72.png"));


            _bounds = new RectangleF(140, 140, 140, 140);

            myAnimatedView = new UIImageView(_bounds);

            myAnimatedView.AnimationImages = myImages.ToArray();


            if (myImages.Count > 0)
            {
                Console.WriteLine(myImages.Count);

                myAnimatedView.AnimationDuration = 6.75;                 // Seconds

                myAnimatedView.AnimationRepeatCount = 0;                 // 0 = Loops

                myAnimatedView.StartAnimating();
            }



            _rootViewController = new DialogViewController(new RootElement("Littelfuse")
            {
                new Section()
                {
                },
                new Section(myAnimatedView)
                {
                },
                new Section("Catalogs")
                {
//						new RootElement("Test", delegate
//						{
                    new RootElement("Catalogs")
                    {
                        showSublements()
                    }
//						})
                },

                JsonElement.FromFile("element.json")

                /*new Section ("Catalogs") {
                 *      new RootElement ("Electronics") {
                 *              new Section () {
                 *                      new HtmlElement("Electronics 1",ns),
                 *                      new HtmlElement("Electronics 2",ns),
                 *                      new HtmlElement("Electronics 3",ns),
                 *                      new HtmlElement("Electronics 4",ns),
                 *                      new HtmlElement("Electronics 5",ns),
                 *                      new HtmlElement("Electronics 6",ns),
                 *                      new HtmlElement("Electronics 7",ns),
                 *                      new HtmlElement("Electronics 8",ns),
                 *                      new HtmlElement("Electronics 9",ns),
                 *                      new HtmlElement("Electronics 10",ns)
                 *              }
                 *
                 *      },
                 *      new RootElement("Electrical")
                 *      {
                 *              new Section () {
                 *
                 *                      new HtmlElement("Electrical 1",ns),
                 *                      new HtmlElement("Electrical 2",ns),
                 *                      new HtmlElement("Electrical 3",ns),
                 *                      new HtmlElement("Electrical 4",ns),
                 *                      new HtmlElement("Electrical 5",ns),
                 *                      new HtmlElement("Electrical 6",ns),
                 *                      new HtmlElement("Electrical 7",ns),
                 *                      new HtmlElement("Electrical 8",ns),
                 *                      new HtmlElement("Electrical 9",ns),
                 *                      new HtmlElement("Electrical 10",ns)
                 *
                 *              }
                 *
                 *      }
                 *
                 * }*/
            }
                                                           );

            _navController = new UINavigationController(_rootViewController);

            window.RootViewController = _navController;


            // If you have defined a view, add it here:
            // window.AddSubview (navigationController.View);

            // make the window visible
            window.MakeKeyAndVisible();

            return(true);
        }
示例#5
0
        JsonElement showSublements()
        {
//			throw new NotImplementedException ();
            return(JsonElement.FromFile("element.json"));
        }
示例#6
0
 public InformationViewController(FlyoutNavigationController navigation, String title, String filename)
 {
     navigationViewController = new NavigationViewController(navigation, title);
     dialogViewController     = new DialogViewController(JsonElement.FromFile(filename));
 }
示例#7
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window = new UIWindow(UIScreen.MainScreen.Bounds);

            var book = new AddressBook();

            _rootElement = new RootElement("Json Example")
            {
                new Section("Json Demo")
                {
                    JsonElement.FromFile("sample.json"),
                    new JsonElement("Load from url", "http://localhost/sample.json")
                },
                new Section("MT.D+Linq+Xamarin.Mobile")
                {
                    new RootElement("Contacts with Phones")
                    {
                        from c in book.Where(c => c.Phones.Count() > 0)
                        select new Section(c.DisplayName)
                        {
                            from p in c.Phones
                            select(Element) new StringElement(p.Number)
                        }
                    }
                },
                new Section("Tasks Sample using Json")
            };

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

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

            #region task demo

            int n = 0;

            _addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add);
            _vc.NavigationItem.RightBarButtonItem = _addButton;

            _addButton.Clicked += (sender, e) => {
                ++n;

                var task = new Task {
                    Name = "task " + n, DueDate = DateTime.Now
                };

                var taskElement = JsonElement.FromFile("task.json");

                taskElement.Caption = task.Name;

                var description = taskElement ["task-description"] as EntryElement;

                if (description != null)
                {
                    description.Caption = task.Name;
                    description.Value   = task.Description;
                }

                var duedate = taskElement ["task-duedate"] as DateElement;

                if (duedate != null)
                {
                    duedate.DateValue = task.DueDate;
                }

                _rootElement [2].Add(taskElement);
            };

            #endregion

            return(true);
        }