The DialogViewController is the main entry point to use MonoTouch.Dialog, it provides a simplified API to the UITableViewController.
Inheritance: UITableViewController
コード例 #1
0
		public void DemoHeadersFooters () 
		{
			var section = new Section () { 
				HeaderView = new UIImageView (UIImage.FromFile ("caltemplate.png")),
				FooterView = new UISwitch (new RectangleF (0, 0, 80, 30)),
			};
			
			// Fill in some data 
			var linqRoot = new RootElement ("LINQ source"){
				from x in new string [] { "one", "two", "three" }
					select new Section (x) {
						from y in "Hello:World".Split (':')
							select (Element) new StringElement (y)
				}
			};

			section.Add ((Element) new RootElement ("Desert", new RadioGroup ("desert", 0)){
				new Section () {
					new RadioElement ("Ice Cream", "desert"),
					new RadioElement ("Milkshake", "desert"),
					new RadioElement ("Chocolate Cake", "desert")
				},
			});
			
			var root = new RootElement ("Headers and Footers") {
				section,
				new Section () { (Element) linqRoot }
			};
			var dvc = new DialogViewController (root, true);
			navigation.PushViewController (dvc, true);
		}
コード例 #2
0
		public void DemoElementApi()
		{
			var root = CreateRoot();

			var dv = new DialogViewController(root, true);
			navigation.PushViewController(dv, true);
		}
コード例 #3
0
		public void DemoRefresh ()
		{
			int i = 0;
			var root = new RootElement ("Pull to Refresh"){
				new Section () {
					new MultilineElement ("Pull from the top to add\na new item at the bottom\nThen wait 1 second")
				}
			};

			var dvc = new DialogViewController (root, true);
			
			//
			// After the DialogViewController is created, but before it is displayed
			// Assign to the RefreshRequested event.   The event handler typically
			// will queue a network download, or compute something in some thread
			// when the update is complete, you must call "ReloadComplete" to put
			// the DialogViewController in the regular mode
			//
			dvc.RefreshRequested += delegate {
				// Wait 3 seconds, to simulate some network activity
				NSTimer.CreateScheduledTimer (1, delegate {
					root [0].Add (new StringElement ("Added " + (++i)));
					
					// Notify the dialog view controller that we are done
					// this will hide the progress info
					dvc.ReloadComplete ();
				});
			};
			dvc.Style = UITableViewStyle.Plain;
			
			navigation.PushViewController (dvc, true);			
		}
コード例 #4
0
		void ConfigDone (DialogViewController dvc)
		{
			dvc.NavigationItem.RightBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Done, delegate {
				// Deactivate editing
				dvc.TableView.SetEditing (false, true);
				ConfigEdit (dvc);
			});
		}
コード例 #5
0
		public void DemoStyled () 
		{
			var imageBackground = new Uri ("file://" + Path.GetFullPath ("background.png"));
			var image = ImageLoader.DefaultRequestImage (imageBackground, null);
			var small = image.Scale (new SizeF (32, 32));
			
			var imageIcon = new StyledStringElement ("Local image icon") {
				Image = small
			};
			var backgroundImage = new StyledStringElement ("Image downloaded") {
				BackgroundUri = new Uri ("http://www.google.com/images/logos/ps_logo2.png")
			};
			var localImage = new StyledStringElement ("Local image"){
				BackgroundUri = imageBackground
			};
			
			var backgroundSolid = new StyledStringElement ("Solid background") {
				BackgroundColor = UIColor.Green
			};
			var colored = new StyledStringElement ("Colored", "Detail in Green") {
				TextColor = UIColor.Yellow,
				BackgroundColor = UIColor.Red,
				DetailColor = UIColor.Green,
			};
			var sse = new StyledStringElement ("DetailDisclosureIndicator") { Accessory = UITableViewCellAccessory.DetailDisclosureButton };
			sse.AccessoryTapped += delegate {
				var alert = new UIAlertView ("Accessory", "Accessory clicked!", null, "Ok");
				alert.Show ();
			};
			var root = new RootElement("Styled Elements") {
				new Section ("Image icon"){
					imageIcon
				},
				new Section ("Background") { 
					backgroundImage, backgroundSolid, localImage
				},
				new Section ("Text Color"){
					colored
				},
				new Section ("Cell Styles"){
					new StyledStringElement ("Default", "Invisible value", UITableViewCellStyle.Default),
					new StyledStringElement ("Value1", "Aligned on each side", UITableViewCellStyle.Value1),
					new StyledStringElement ("Value2", "Like the Addressbook", UITableViewCellStyle.Value2),
					new StyledStringElement ("Subtitle", "Makes it sound more important", UITableViewCellStyle.Subtitle),
					new StyledStringElement ("Subtitle", "Brown subtitle", UITableViewCellStyle.Subtitle) {
						 DetailColor = UIColor.Brown
					}
				},
				new Section ("Accessories"){
					new StyledStringElement ("DisclosureIndicator") { Accessory = UITableViewCellAccessory.DisclosureIndicator },
					new StyledStringElement ("Checkmark") { Accessory = UITableViewCellAccessory.Checkmark },
					sse
				}
			};
			
			var dvc = new DialogViewController (root, true);
			navigation.PushViewController (dvc, true);
		}
		DialogViewController DialogViewControllerWithCustomElementNonGeneric (RootElement re)
		{
			Section s = SectionGenericSampleFactory ();
			re.Add(s);
			DialogViewController dvc;
			dvc = new DialogViewController(UITableViewStyle.Grouped, re, false);
			
			return dvc;
		}
コード例 #7
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            var vc = new MyViewController(this)
            {
                Autorotate = dvc.Autorotate
            };

            datePicker       = CreatePicker();
            datePicker.Frame = PickerFrameWithSize(datePicker.SizeThatFits(SizeF.Empty));

            vc.View.BackgroundColor = UIColor.Black;
            vc.View.AddSubview(datePicker);
            dvc.ActivateController(vc);
        }
コード例 #8
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)
		{
			UINavigationController navigation;
			navigation = new UINavigationController ();

			RootElement re = MonoMobile.XSample.UserInterface.UICities();


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

			int n = 0;
			buttonAdd = new UIBarButtonItem (UIBarButtonSystemItem.Add);
			buttonAdd.Clicked += delegate(object sender, EventArgs e) {
			   
				++n;
			   
				City c = new City{Name = "city " + n};
			   
				RootElement cityElement = new RootElement (c.Name){
			  new Section () {
					  new EntryElement (c.Name,
							 "Enter task description", c.Name)
			  },
			  new Section () {
					  new DateElement ("Due Date", DateTime.Now)
			  }
			};
				//re[0].Add (cityElement);	
			};
			dv.NavigationItem.RightBarButtonItem = buttonAdd;

			navigation.PushViewController(dv, true);

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

			return true;
		}
		public UITabBarControllerWithTabBarOnTopAndTabsContainingDialogViewControllers()
		{
			//-----------------------CUSTOM TAB BAR-------------------------------------------------
			rect = new System.Drawing.RectangleF(0,0,this.View.Bounds.Size.Width,TAB_BAR_HEIGHT);
			this.TabBar.Frame = rect;
			this.TabBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
			
			rect = new System.Drawing.RectangleF();
			rect.Location.Y = TAB_BAR_HEIGHT;
			rect.Size.Height = this.View.Bounds.Size.Height - TAB_BAR_HEIGHT;
			
			this.View.Frame = rect;
			this.View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
			//----------------------------------------------------------------------------------------
			
			tab1 = DialogViewControllerWithCustomElementNonGeneric(re1);
			tab1.Title = "Element Custom Non Generic";

			tab2 = DialogViewControllerWithCustomElementGeneric(re2);
			tab2.Title = "Element Custom Generic";

			tab3 = DialogViewControllerWithCustomElementFromXIB(re3);
			tab3.Title = "Element Custom Variations";

			tab4 = DialogViewControllerWithCustomElementManual(re4);
			tab4.Title = "Element Custom Variations";

			#region Additional Info
			//			tab1.TabBarItem = new UITabBarItem (UITabBarSystemItem.History, 0); // sets image AND text
			//			tab2.TabBarItem = new UITabBarItem ("Orange", UIImage.FromFile("Images/first.png"), 1);
			//			tab3.TabBarItem = new UITabBarItem ();
			//			tab3.TabBarItem.Image = UIImage.FromFile("Images/second.png");
			//			tab3.TabBarItem.Title = "Rouge"; // this overrides tab3.Title set above
			//			tab3.TabBarItem.BadgeValue = "4";
			//			tab3.TabBarItem.Enabled = false;
			#endregion

			DialogViewController[] tabs = new DialogViewController[] 
			{
			  tab1
			, tab2
			, tab3
			, tab4
			};
			
			ViewControllers = tabs;
			
			SelectedViewController = tab3; // normally you would default to the left-most tab (ie. tab1)
		}
コード例 #10
0
        public void Navigate(RootElement root_element_next_screen)
        {
            // TODO: mc++
            // is new DialgoViewController necessary?
            dv = new DialogViewController
                 (
                root_element_next_screen
                , true
                 );

            // iOS version??!?!
            this.PushViewController(dv, true);

            return;
        }
コード例 #11
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            tableView.DeselectRow(path, true);

            if (Animating)
            {
                return;
            }

            if (Tapped != null)
            {
                Animating = true;
                Tapped(this);
            }
        }
コード例 #12
0
ファイル: Screen.MT.cs プロジェクト: moljac/MonoMobile.Dialog
		public void Navigate(RootElement root_element_next_screen)
		{
			// TODO: mc++
			// is new DialgoViewController necessary?
			dv = new DialogViewController 
						(
						  root_element_next_screen
						, true
						);
						
			// iOS version??!?!
			this.PushViewController (dv, true);					

			return;
		}
コード例 #13
0
		public void DemoAddRemove ()
		{
			rnd = new Random ();
			var section = new Section (null, "Elements are added randomly") {
				new StringElement ("Add elements", AddElements),
				new StringElement ("Add, with no animation", AddNoAnimation),
				new StringElement ("Remove top element", RemoveElements),
				new StringElement ("Add Section", AddSection),
				new StringElement ("Remove Section", RemoveSection)
			};
			region = new Section ();
			
			demoRoot = new RootElement ("Add/Remove Demo") { section, region };
			var dvc = new DialogViewController (demoRoot, true);
			navigation.PushViewController (dvc, true);
		}
コード例 #14
0
		// Constructor
		public MainPage()
		{
			InitializeComponent();

			RootElement re =
					new AppDelegate().CreateRootHolisticWare()
					;

			DialogViewController dvc =
					new DialogViewController(re)
					// new DialogViewController(e, true)
					;

			// LayoutRoot
			ContentPanel.Children.Add(dvc);

			return;
		}
コード例 #15
0
ファイル: Json.cs プロジェクト: ikxx/MonoMobile.Dialog
		public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			if (Url == null){
				base.Selected (dvc, tableView, path);
				return;
			}
			
			tableView.DeselectRow (path, false);
			if (loading)
				return;
			var cell = GetActiveCell ();
			var spinner = StartSpinner (cell);
			loading = true;
			
			var wc = new WebClient ();
			
			wc.DownloadStringCompleted += delegate  (object sender, DownloadStringCompletedEventArgs e){
				dvc.BeginInvokeOnMainThread (delegate {
					loading = false;
					spinner.StopAnimating ();
					spinner.RemoveFromSuperview ();
					if (e.Result != null){
						try {
							var obj = JsonValue.Load (new StringReader (e.Result)) as JsonObject;
							if (obj != null){
								var root = JsonElement.FromJson (obj);
								var newDvc = new DialogViewController (root, true) {
									Autorotate = true
								};
								PrepareDialogViewController (newDvc);
								dvc.ActivateController (newDvc);
								return;
							}
						} catch (Exception ee){
							Console.WriteLine (ee);
						}
					}
					var alert = new UIAlertView ("Error", "Unable to download data", null, "Ok");
					alert.Show ();
				});
			};
			wc.DownloadStringAsync (new Uri (Url));
		}
コード例 #16
0
		public void DemoOwnerDrawnElement () 
		{
			var root = new RootElement("Owner Drawn") {
				new Section() {
					new SampleOwnerDrawnElement("000 - "+SmallText, DateTime.Now, "David Black"),
					new SampleOwnerDrawnElement("001 - "+MediumText, DateTime.Now - TimeSpan.FromDays(1), "Peter Brian Telescope"),
					new SampleOwnerDrawnElement("002 - "+LargeText, DateTime.Now - TimeSpan.FromDays(3), "John Raw Vegitable"),
					new SampleOwnerDrawnElement("003 - "+SmallText, DateTime.Now - TimeSpan.FromDays(5), "Tarquin Fintimlinbinwhinbimlim Bus Stop F'tang  F'tang Ole  Biscuit-Barrel"),
					new SampleOwnerDrawnElement("004 - "+WellINeverWhatAWhopperString, DateTime.Now - TimeSpan.FromDays(9), "Kevin Phillips Bong"),
					new SampleOwnerDrawnElement("005 - "+LargeText, DateTime.Now - TimeSpan.FromDays(11), "Alan Jones"),
					new SampleOwnerDrawnElement("006 - "+MediumText, DateTime.Now - TimeSpan.FromDays(32), "Mrs Elsie Zzzzzzzzzzzzzzz"),
					new SampleOwnerDrawnElement("007 - "+SmallText, DateTime.Now - TimeSpan.FromDays(45), "Jeanette Walker"),
					new SampleOwnerDrawnElement("008 - "+MediumText, DateTime.Now - TimeSpan.FromDays(99), "Adrian  Blackpool Rock  Stoatgobblerk"),
					new SampleOwnerDrawnElement("009 - "+SmallText, DateTime.Now - TimeSpan.FromDays(123), "Thomas Moo"),
				}
			};
			root.UnevenRows = true;
			var dvc = new DialogViewController (root, true);
			
			navigation.PushViewController (dvc, true);
		}
コード例 #17
0
		public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath indexPath)
		{
			RootElement root = (RootElement)Parent.Parent;
			if (RadioIdx != root.RadioSelected)
			{
				UITableViewCell cell;
				var selectedIndex = root.PathForRadio(root.RadioSelected);
				if (selectedIndex != null)
				{
					cell = tableView.CellAt(selectedIndex);
					if (cell != null)
						cell.Accessory = UITableViewCellAccessory.None;
				}
				cell = tableView.CellAt(indexPath);
				if (cell != null)
					cell.Accessory = UITableViewCellAccessory.Checkmark;
				root.RadioSelected = RadioIdx;
			}

			base.Selected(dvc, tableView, indexPath);
		}
コード例 #18
0
ファイル: Main.cs プロジェクト: moljac/MonoMobile.Dialog
		// This method is invoked when the application has loaded its UI and its ready to run
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			var menu = RootElementFactory.CreateRootElement();

			//
			var dv = new DialogViewController (menu) {
				Autorotate = true
			};
			navigation = new UINavigationController ();
			navigation.PushViewController (dv, true);				
			
			// On iOS5 we use the new window.RootViewController, on older versions, we add the subview
			window = new UIWindow (UIScreen.MainScreen.Bounds);
			window.MakeKeyAndVisible ();
			if (UIDevice.CurrentDevice.CheckSystemVersion (5, 0))
				window.RootViewController = navigation;	
			else
				window.AddSubview (navigation.View);
			
			return true;
		}
コード例 #19
0
		public void DemoLoadMore () 
		{
			Section loadMore = new Section();
			
			var s = new StyledStringElement ("Hola") {
				BackgroundUri = new Uri ("http://www.google.com/images/logos/ps_logo2.png")
				//BackgroundColor = UIColor.Red
			};
			loadMore.Add (s);
			loadMore.Add (new StringElement("Element 1"));
			loadMore.Add (new StringElement("Element 2"));
			loadMore.Add (new StringElement("Element 3"));
						
			
			loadMore.Add (new LoadMoreElement("Load More Elements...", "Loading Elements...", lme => {
				// Launch a thread to do some work
				ThreadPool.QueueUserWorkItem (delegate {
					
					// We just wait for 2 seconds.
					System.Threading.Thread.Sleep(2000);
				
					// Now make sure we invoke on the main thread the updates
					navigation.BeginInvokeOnMainThread(delegate {
						lme.Animating = false;
						loadMore.Insert(loadMore.Count - 1, new StringElement("Element " + (loadMore.Count + 1)),
				    		            new StringElement("Element " + (loadMore.Count + 2)),
				            		    new StringElement("Element " + (loadMore.Count + 3)));
					
					});
				});
				
			}, UIFont.BoldSystemFontOfSize(14.0f), UIColor.Blue));
							
			var root = new RootElement("Load More") {
				loadMore
			};
			
			var dvc = new DialogViewController (root, true);
			navigation.PushViewController (dvc, true);
		}
コード例 #20
0
		public void DemoContainerStyle () 
		{
			var root = new RootElement ("Container Style") {
				new Section ("A") {
					new StringElement ("Another kind of"),
					new StringElement ("TableView, just by setting the"),
					new StringElement ("Style property"),
				},
				new Section ("C"){
					new StringElement ("Chaos"),
					new StringElement ("Corner"),
				},
				new Section ("Style"){
					from a in "Hello there, this is a long text that I would like to split in many different nodes for the sake of all of us".Split (' ')
						select (Element) new StringElement (a)
				}
			};
			var dvc = new DialogViewController (root, true) {
				Style = UITableViewStyle.Plain
			};
			navigation.PushViewController (dvc, true);
		}
コード例 #21
0
			public Source (DialogViewController container)
			{
				this.Container = container;
				Root = container.root;
			}
コード例 #22
0
			public SearchDelegate (DialogViewController container)
			{
				this.container = container;
			}
コード例 #23
0
		void TimeLineLoaded (IAsyncResult result)
		{
			var request = result.AsyncState as HttpWebRequest;
			Busy = false;
				
			try {
				var response = request.EndGetResponse (result);
				var stream = response.GetResponseStream ();

				
				var root = CreateDynamicContent (XDocument.Load (new XmlTextReader (stream)));
				InvokeOnMainThread (delegate {
					var tweetVC = new DialogViewController (root, true);
					navigation.PushViewController (tweetVC, true);
				});
			} catch (WebException e){
				
				InvokeOnMainThread (delegate {
					using (var msg = new UIAlertView ("Error", "Code: " + e.Status, null, "Ok")){
						msg.Show ();
					}
				});
			}
		}
コード例 #24
0
 public Screen()
 {
     dv = new DialogViewController(null);
 }
コード例 #25
0
		// Constructor
		public MainPage()
		{
			InitializeComponent();


			# region    Loading Button from code
			//-------------------------------------------------------------------------
			// Button b = new Button();
			// b.Content = "Loading Button from code";
			// ContentPanel.Children.Add(b);
			//-------------------------------------------------------------------------
			# endregion Loading Button from code


			# region    Loading StackPanle from Code
			//-------------------------------------------------------------------------
			// StackPanel stackpanel = new StackPanel();
			// for (int i = 1; i <= 10; i++)
			// {
			// 	Button b = new Button();
			// 	b.Content = "Button " + i.ToString();
			// 	stackpanel.Children.Add(b);
			// }
			// ContentPanel.Children.Add(stackpanel);
			//-------------------------------------------------------------------------
			# endregion Loading StackPanle from Code
	
	
			RootElement re = 
			new RootElement("Root")
			{
				new Section ("- Section 00") 
				{
					new EntryElement ("- - Entry Eelment", "placeholder", "")
					, new RootElement ("- - Root 2") 
					{
						new Section ("- - - Section") 
						{
							new EntryElement ("- - - - EntryElement", "placeholder", "")
							, new StringElement ("- - - - String element Back", () => {})
						}
					}
				}
				, new Section("- Section 01", "Footer")
				{
					new StringElement("- - StringElement caption")
					, new StringElement("- - StringElement caption", "value value value value value value value value value value value value value value value value value value value value value value value value value value value value value value value value value ")
					, new EntryElement("- - EntryElement caption", "value")
					, new EntryElement("- - EntryElement caption", "hint", "value")
					, new EntryElement("- - EntryElement caption", "placeholder", "value", true)
					//, new BooleanElement("BooleanElement caption", false)

					// Exception:
					// 'UI Task' (Managed): Loaded 'System.SR.dll'
					// A first chance exception of type 'System.IO.FileNotFoundException' 
					// occurred in mscorlib.dll
					//, new BooleanElement("BooleanElement caption", false, "key")
					, new CheckboxElement("- - CheckboxElement caption")
					, new CheckboxElement("- - CheckboxElement caption", false)
					, new CheckboxElement("- - CheckboxElement caption", true, "group")
					, new CheckboxElement("- - CheckboxElement caption", true, "subcaption", "group")
					, new DateElement("- - DateElement caption", DateTime.Now)
					//, new DateElement("DateElement1 caption", DateTime.Now)
					//, new DateElement("DateElement2 caption", DateTime.Now)
					//, new DateElement("DateElement3 caption", DateTime.Now)
					//, new DateElement("DateElement4 caption", DateTime.Now)
					//, new DateElement("DateElement5 caption", DateTime.Now)
					, new DateTimeElement("- - DateTimeElement caption", DateTime.Now)
					, new DateTimeElement("- - DateTimeElement1 caption", DateTime.Now)
					//, new FloatElement("- - Float")
					//, new FloatElement(0.4f, 0.0f, 10f)
					//, new ImageElement(null)
					, new MultilineElement("- - MultilineElement caption")
					, new MultilineElement("- - MultilineElement caption", delegate(){})
					, new MultilineElement("- - MultilineElement caption", "value")
					//, new HtmlElement("HtmlElement caption", new NSUrl("http://holisiticware.net"))
				}
				//, new Section("Section 02", "Footer")
				//	{
				//	}
			};

			DialogViewController dvc = 
				new DialogViewController(re)
				// new DialogViewController(e, true)
				;

			// Create the final scrooling environment
			ScrollViewer scrollViewer = new ScrollViewer()
			{
				Content = dvc
			};


			ContentPanel.Children.Add(scrollViewer);
		}
コード例 #26
0
		public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			tableView.DeselectRow (path, true);
			
			if (Animating)
				return;
			
			if (Tapped != null){
				Animating = true;
				Tapped (this);
			}
		}
コード例 #27
0
		/// <summary>
		/// Invoked when the given element has been deslected by the user.
		/// </summary>
		/// <param name="dvc">
		/// The <see cref="DialogViewController"/> where the deselection took place
		/// </param>
		/// <param name="tableView">
		/// The <see cref="UITableView"/> that contains the element.
		/// </param>
		/// <param name="path">
		/// The <see cref="NSIndexPath"/> that contains the Section and Row for the element.
		/// </param>
		public virtual void Deselected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
		}
コード例 #28
0
ファイル: Main.cs プロジェクト: moljac/MonoMobile.Dialog
		// 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 ("Element API HolisticWare", DemoElementApiHolisticWare),
					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") {
					(Element) (sampleJson = JsonElement.FromFile ("sample.json")),
					// Notice what happens when I close the paranthesis at the end, in the next line:
					(Element) 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 = new UINavigationController ();
			navigation.PushViewController (dv, true);				
			
			// On iOS5 we use the new window.RootViewController, on older versions, we add the subview
			window = new UIWindow (UIScreen.MainScreen.Bounds);
			window.MakeKeyAndVisible ();
			if (UIDevice.CurrentDevice.CheckSystemVersion (5, 0))
				window.RootViewController = navigation;	
			else
				window.AddSubview (navigation.View);
			
			return true;
		}
コード例 #29
0
ファイル: Element.MT.cs プロジェクト: ikxx/MonoMobile.Dialog
 /// <summary>
 /// Invoked when the given element has been deslected by the user.
 /// </summary>
 /// <param name="dvc">
 /// The <see cref="DialogViewController"/> where the deselection took place
 /// </param>
 /// <param name="tableView">
 /// The <see cref="UITableView"/> that contains the element.
 /// </param>
 /// <param name="path">
 /// The <see cref="NSIndexPath"/> that contains the Section and Row for the element.
 /// </param>
 public virtual void Deselected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
 {
 }
コード例 #30
0
			public SizingSource (DialogViewController controller) : base (controller) {}
コード例 #31
0
			public EditingSource (DialogViewController dvc) : base (dvc) {}
コード例 #32
0
		public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			var vc = new MyViewController(this)
			{
				Autorotate = dvc.Autorotate
			};
			datePicker = CreatePicker();
			datePicker.Frame = PickerFrameWithSize(datePicker.SizeThatFits(SizeF.Empty));

			vc.View.BackgroundColor = UIColor.Black;
			vc.View.AddSubview(datePicker);
			dvc.ActivateController(vc);
		}
コード例 #33
0
 public SearchDelegate(DialogViewController container)
 {
     this.container = container;
 }
コード例 #34
0
        public void PushViewController(DialogViewController dvc, bool pushing)
        {
            // pushing???

            return;
        }
コード例 #35
0
 public Source(DialogViewController container)
 {
     this.Container = container;
     Root           = container.root;
 }
コード例 #36
0
		void AdvancedConfigDone (DialogViewController dvc)
		{
			dvc.NavigationItem.RightBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Done, delegate {
				// Deactivate editing
				dvc.ReloadData();
				// Switch updated entry elements to StringElements
				dvc.Root = CreateEditableRoot(dvc.Root, false);
				dvc.TableView.SetEditing (false, true);
				AdvancedConfigEdit (dvc);
			});
		}
コード例 #37
0
 public SizingSource(DialogViewController controller) : base(controller)
 {
 }
コード例 #38
0
		void AdvancedConfigEdit (DialogViewController dvc)
		{
			dvc.NavigationItem.RightBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Edit, delegate {
				// Activate editing
				// Switch the root to editable elements		
				dvc.Root = CreateEditableRoot(dvc.Root, true);
				dvc.ReloadData();	
				// Activate row editing & deleting
				dvc.TableView.SetEditing (true, true);
				AdvancedConfigDone(dvc);				
			});
		}
コード例 #39
0
ファイル: Screen.MT.cs プロジェクト: moljac/MonoMobile.Dialog
		public Screen ()
		{
			dv = new DialogViewController(null);	
		}