示例#1
0
        public NativeListViewController() : base(UITableViewStyle.Plain)
        {
            Title             = "HybridNativeTodo";
            webViewController = new RazorViewController();

            NavigationItem.SetRightBarButtonItem(new UIBarButtonItem(UIBarButtonSystemItem.Add), false);
            NavigationItem.RightBarButtonItem.Clicked += (sender, e) => {
                var template = new TodoView()
                {
                    Model = new TodoItem()
                };
                var page = template.GenerateString();
                webViewController.webView.LoadHtmlString(page, NSBundle.MainBundle.BundleUrl);
                NavigationController.PushViewController(webViewController, true);
            };

            NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem(UIBarButtonSystemItem.Play), false);
            NavigationItem.LeftBarButtonItem.Clicked += (sender, e) => {
                var todos   = App.Database.GetItemsNotDone();
                var tospeak = "";
                foreach (var t in todos)
                {
                    tospeak += t.Name + " ";
                }
                if (tospeak == "")
                {
                    tospeak = "there are no tasks to do";
                }
                Speech.Speak(tospeak);
            };
        }
		public NativeListViewController () : base (UITableViewStyle.Plain)
		{
			Title = "HybridNativeTodo";
			webViewController = new RazorViewController ();

			NavigationItem.SetRightBarButtonItem (new UIBarButtonItem (UIBarButtonSystemItem.Add), false);
			NavigationItem.RightBarButtonItem.Clicked += (sender, e) => { 
				var template = new TodoView () { Model = new TodoItem() };
				var page = template.GenerateString ();
				webViewController.webView.LoadHtmlString (page, NSBundle.MainBundle.BundleUrl);
				NavigationController.PushViewController(webViewController, true);
			};

			NavigationItem.SetLeftBarButtonItem (new UIBarButtonItem (UIBarButtonSystemItem.Play), false);
			NavigationItem.LeftBarButtonItem.Clicked += (sender, e) => { 
				var todos = App.Database.GetItemsNotDone ();
				var tospeak = "";
				foreach (var t in todos)
					tospeak += t.Name + " ";
				if (tospeak == "")
					tospeak = "there are no tasks to do";
				Speech.Speak (tospeak);
			};
		}
示例#3
0
 public TaskDataSource(IList <TodoItem> tasks, RazorViewController webViewController, UIViewController viewController)
 {
     taskList = tasks;
     this.webViewController = webViewController;
     this.viewController    = viewController;
 }
		public TaskDataSource (IList<TodoItem> tasks, RazorViewController webViewController, UIViewController viewController) {
			taskList = tasks;
			this.webViewController = webViewController;
			this.viewController = viewController;
		}