コード例 #1
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"),
				},
#warning inline LINQ source removed
                /*
                 * 
				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);
		}
コード例 #2
0
ファイル: DemoEditing.cs プロジェクト: runegri/Android.Dialog
		void ConfigDone (DialogViewController dvc)
		{
			dvc.NavigationItem.RightBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Done, delegate {
				// Deactivate editing
				dvc.TableView.SetEditing (false, true);
				ConfigEdit (dvc);
			});
		}
コード例 #3
0
		/// <summary>
		/// Behaves differently depending on iPhone or iPad
		/// </summary>
		public override void Selected (DialogViewController dvc, UITableView tableView, MonoTouch.Foundation.NSIndexPath path)
		{
            session.ShowDetailCommand.Execute();

			/*
			if (splitView != null)
				splitView.ShowSession(session.ID);
			else {
				var sds = new MWC.iOS.Screens.iPhone.Sessions.SessionDetailsScreen (session.ID);
				sds.Title = "Session";
				dvc.ActivateController (sds);
			}
			*/
		}
コード例 #4
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);
		}
コード例 #5
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);
		}
コード例 #6
0
			public SearchDelegate (DialogViewController container)
			{
				this.container = container;
			}
コード例 #7
0
ファイル: DemoEditing.cs プロジェクト: runegri/Android.Dialog
			public EditingSource (DialogViewController dvc) : base (dvc) {}
コード例 #8
0
ファイル: DemoDate.cs プロジェクト: runegri/Android.Dialog
		void msgSelected (DialogViewController dvc, UITableView tv, NSIndexPath path)
		{
			var np = new DialogViewController (new RootElement ("Message Display") {
				new Section () {
					new StyledMultilineElement (
	                    "From: foo\n" +
	                    "To: bar\n" +
	                    "Subject: Hey there\n\n" +
	                    "This is very simple!")
				}
			}, true);
			dvc.ActivateController (np);
		}
コード例 #9
0
ファイル: DemoDynamic.cs プロジェクト: runegri/Android.Dialog
		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 ();
					}
				});
			}
		}
コード例 #10
0
ファイル: Main.cs プロジェクト: runegri/Android.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 ("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),
				},
#warning Json source removed

                /*
				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 = 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;
		}
コード例 #11
0
		public void DemoReflectionApi ()
		{	
			if (settings == null){
				var image = UIImage.FromFile ("monodevelop-32.png");
				
				settings = new Settings () {
					AccountEnabled = true,
					Login = "******",
					TimeSamples = new TimeSettings () {
						Appointment = DateTime.Now,
						Birthday = new DateTime (1980, 6, 24),
						Alarm = new DateTime (2000, 1, 1, 7, 30, 0, 0)
					},
					FavoriteType = TypeCode.Int32,
					Top = image,
					Middle = image,
					Bottom = image,
					ListOfString = new List<string> () { "One", "Two", "Three" }
				};
			}
			var bc = new BindingContext (null, settings, "Settings");
			
			var dv = new DialogViewController (bc.Root, true);
			
#warning This removed...
            /*
			// When the view goes out of screen, we fetch the data.
			dv.ViewDisappearing += delegate {
				// This reflects the data back to the object instance
				bc.Fetch ();
				
				// Manly way of dumping the data.
				Console.WriteLine ("Current status:");
				Console.WriteLine (
				    "AccountEnabled:  {0}\n" +
				    "Login:           {1}\n" +
				    "Password:        {2}\n" +
					"Name:      	  {3}\n" +
				    "Appointment:     {4}\n" +
				    "Birthday:        {5}\n" +
				    "Alarm:           {6}\n" +
				    "Favorite Type:   {7}\n" + 
				    "IEnumerable idx: {8}", 
				    settings.AccountEnabled, settings.Login, settings.Password, settings.Name,
				    settings.TimeSamples.Appointment, settings.TimeSamples.Birthday, 
				    settings.TimeSamples.Alarm, settings.FavoriteType,
				    settings.selected);
			};
             */
			navigation.PushViewController (dv, true);	
		}
コード例 #12
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);				
			});
		}
コード例 #13
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);
			});
		}
コード例 #14
0
ファイル: DemoDate.cs プロジェクト: runegri/Android.Dialog
		public void DemoDate ()
		{
			if (badgeImage == null)
				badgeImage = UIImage.FromFile ("jakub-calendar.png");
			
			var badgeSection = new Section ("Basic Badge Properties"){
				new BadgeElement (badgeImage, "New Movie Day") {
					Font = UIFont.FromName ("Helvetica", 36f)
				},
				new BadgeElement (badgeImage, "Valentine's Day"),
				
				new BadgeElement (badgeImage, longString) {
					Lines = 3,
					Font = UIFont.FromName ("Helvetica", 12f)
				}
			};
			
			//
			// Use the MakeCalendarBadge API
			//
			var font = UIFont.FromName ("Helvetica", 14f);
			var dates = new string [][] {
				new string [] { "January", "1", "Hangover day" },
				new string [] { "February", "14", "Valentine's Day" },
 				new string [] { "March", "3", "Third day of March" },
				new string [] { "March", "31", "Prank Preparation day" },
				new string [] { "April", "1", "Pranks" },
			};
			var calendarSection = new Section ("Date sample");
			foreach (string [] date in dates) {
				calendarSection.Add (new BadgeElement (BadgeElement.MakeCalendarBadge (badgeImage, date [0], date [1]), date [2]){
					Font = font
				});
			}
			
			UIImage favorite = UIImage.FromFile ("favorite.png");
			UIImage favorited = UIImage.FromFile ("favorited.png");
			
			var imageSection = new Section ("Image Booleans"){
				new BooleanImageElement ("Gone with the Wind", true, favorited, favorite),
				new BooleanImageElement ("Policy Academy 38", false, favorited, favorite),
			};
			
#warning Message Section removed
            /*
             
			var messageSection = new Section ("Message Elements"){
				new MessageElement (msgSelected) { 
					Sender = "Miguel de Icaza ([email protected])", 
					Subject = "Re: [Gtk-sharp-list] Glib Timeout and other ways to handle idle",
					Body = "Please bring friends, but make sure that you also bring eggs and bacon as we are running short of those for the coctails tonight",
					Date = DateTime.Now - TimeSpan.FromHours (23),
					NewFlag = true,
					MessageCount = 0
				},
				new MessageElement (msgSelected) { 
					Sender = "Nat Friedman ([email protected])", 
					Subject = "Pictures from Vietnam",
					Body = "Hey dude, here are the pictures that I promised from Vietnam",
					Date = new DateTime (2010, 10, 20),
					NewFlag = false,
					MessageCount = 2
				}
			};
			*/
			var entrySection = new Section ("Keyboard styles for entry"){
				new EntryElement ("Number ", "Some cute number", "1.2") { KeyboardType = UIKeyboardType.NumberPad },
				new EntryElement ("Email ", "", null) { KeyboardType = UIKeyboardType.EmailAddress },
				new EntryElement ("Url ", "", null) { KeyboardType = UIKeyboardType.Url },
				new EntryElement ("Phone ", "", "1.2") { KeyboardType = UIKeyboardType.PhonePad },
			};
			
			var root = new RootElement ("Assorted Elements") {
				imageSection,
				//messageSection,
				entrySection,
				calendarSection,
				badgeSection,
			};
			var dvc = new DialogViewController (root, true);
			dvc.Style = UITableViewStyle.Plain;
			
			navigation.PushViewController (dvc, true);
		}
コード例 #15
0
			public Source (DialogViewController container)
			{
				this.Container = container;
				Root = container.root;
			}
コード例 #16
0
			public SizingSource (DialogViewController controller) : base (controller) {}
コード例 #17
0
 public SearchDelegate(DialogViewController container)
 {
     this.container = container;
 }
コード例 #18
0
ファイル: DemoDynamic.cs プロジェクト: runegri/Android.Dialog
		public void DemoDynamic ()
		{
			account = new AccountInfo ();
			
			context = new BindingContext (this, account, "Settings");

			if (dynamic != null)
				dynamic.Dispose ();
			
			dynamic = new DialogViewController (context.Root, true);
			navigation.PushViewController (dynamic, true);				
		}
コード例 #19
0
 public Source(DialogViewController container)
 {
     this.Container = container;
     Root           = container.root;
 }
コード例 #20
0
		/// <summary>
		/// Behaves differently depending on iPhone or iPad
		/// </summary>
		public override void Selected (DialogViewController dvc, UITableView tableView, MonoTouch.Foundation.NSIndexPath path)
		{
		    speaker.ShowDetailCommand.Execute();
		}
コード例 #21
0
 public SizingSource(DialogViewController controller) : base(controller)
 {
 }