Example #1
0
        public AddEditContactScreen(UINavigationController nav)
            : base(UITableViewStyle.Grouped, null, true)
        {
            _rootContainerNavigationController = nav;

            // Navigation
            NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Cancel, (sender, args) =>
            {
                NavigationController.DismissViewController(true, null);
            });
            NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, DoneButtonClicked);
            NavigationItem.Title = "New Contact";

            Root = new RootElement("");

            // Photo
            _photoSection = new Section();
            _photoBadge = new BadgeElement(UIImage.FromBundle("Images/UnknownIcon.jpg"), "Add Photo");
            _photoBadge.Tapped += PhotoBadgeTapped;
            _photoSection.Add(_photoBadge);
            Root.Add(_photoSection);

            // Name
            _nameSection = new Section();
            var firstName = new EntryElement(null, "First", null);
            var middleName = new EntryElement(null, "Middle", null);
            var lastName = new EntryElement(null, "Last", null);
            var org = new EntryElement(null, "Organization", null);
            _nameSection.Add(firstName);
            _nameSection.Add(middleName);
            _nameSection.Add(lastName);
            _nameSection.Add(org);
            Root.Add(_nameSection);

            // Phone numbers
            _phoneSection = new Section("Phone Numbers");
            Root.Add(_phoneSection);
            var phoneLoadMore = new LoadMoreElement("Add More Phone Numbers", "Loading...", PhoneLoadMoreTapped);
            _phoneSection.Add(phoneLoadMore);

            // Emails
            _emailSection = new Section("Emails");
            Root.Add(_emailSection);
            var emailLoadMore = new LoadMoreElement("Add More Emails", "Loading...", EmailLoadMoreTapped);
            _emailSection.Add(emailLoadMore);

            // Urls
            _urlSection = new Section("Urls");
            Root.Add(_urlSection);
            var urlLoadMore = new LoadMoreElement("Add More Urls", "Loading...", UrlLoadMoreTapped);
            _urlSection.Add(urlLoadMore);

            // IMs
            _instantMsgSection = new Section("Instant Messages");
            Root.Add(_instantMsgSection);
            var instantMsgLoadMore = new LoadMoreElement("Add More Instant Messages", "Loading...", InstantMsgLoadMoreTapped);
            _instantMsgSection.Add(instantMsgLoadMore);
        }
Example #2
0
        public SelectFarm()
            : base(UITableViewStyle.Grouped, null)
        {
            Root = new RootElement (null){};
            this.Pushing=true;

            //farm section
            var farms = DBConnection.getAllFarms();
            int farmNumber=farms.Count();
            var section = new Section ("Farms:"){};

            foreach(Farm farm in farms){
                int farmID = farm.farmID;
                string farmName = farm.farmName;
                int fieldNumber = DBConnection.getAllFields(farmID).Count ();
                var farmImg=UIImage.FromFile ("img/"+farmName+".jpg");
                if(farmImg==null)
                    farmImg=UIImage.FromFile ("Icon.png");

                var theFarm=new BadgeElement(farmImg,farmName+"      "+fieldNumber+" fields",()=>{
                    Console.WriteLine("Farm Name is: "+farmName);
                    var field=new SelectField(farmName,farmID,fieldNumber);
                    this.NavigationController.PushViewController(field,true);
                });
                section.Add(theFarm);
            }
            Root.Add(section);

            //grain section
            var section2 = new Section ("Grain Inventory:"){};
            var grin1 = new StringElement ("Bin (1-15)", () => {
                var selectBin=new SelectBin(1);
                this.NavigationController.PushViewController(selectBin,true);
            });
            var grin2 = new StringElement ("Bin(16-30)", () => {
                var selectBin=new SelectBin(16);
                this.NavigationController.PushViewController(selectBin,true);
            });
            var grin3 = new StringElement ("Bin(31-45)", () => {
                var selectBin=new SelectBin(31);
                this.NavigationController.PushViewController(selectBin,true);
            });
            var grin4 = new StringElement ("Bin(46-60)", () => {
                var selectBin=new SelectBin(46);
                this.NavigationController.PushViewController(selectBin,true);
            });
            var grin5 = new StringElement ("Bin(61-75)", () => {
                var selectBin=new SelectBin(61);
                this.NavigationController.PushViewController(selectBin,true);
            });

            section2.Add (grin1);
            section2.Add (grin2);
            section2.Add (grin3);
            section2.Add (grin4);
            section2.Add (grin5);
            Root.Add (section2);
        }
		public NewsDialogViewController () : base (UITableViewStyle.Plain, null)
		{
			View.BackgroundColor = UIColor.White;
			TableView.BackgroundColor = UIColor.White;

			var section = new Section ();
			// creates the rows using MT.Dialog

			foreach (var item in newsItems) {
				var published = item.Item1;
				var image = CustomBadgeElement.MakeCalendarBadge (
					                                  published.ToString ("MMM").ToUpper ()
													, published.ToString ("dd"));
				var badgeRow = new BadgeElement (image, item.Item2);

				badgeRow.Tapped += () => {
					var dv = new DrawingViewController ();
					NavigationController.PushViewController (dv, true);
				};
			 	section.Add (badgeRow);
			}
			Root = new RootElement ("PaintCode examples") { section };
		}
Example #4
0
        public void PhotoBadgeTapped()
        {
            var imagePicker = new UIImagePickerController();
            imagePicker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary;
            imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.PhotoLibrary);

            imagePicker.FinishedPickingMedia += (sender, e) =>
            {
                if (e.Info[UIImagePickerController.MediaType].ToString() == "public.image")
                {
                    _profilePhoto = e.Info[UIImagePickerController.OriginalImage] as UIImage;
                    if (_profilePhoto != null)
                    {
                        _photoSection.Remove(_photoBadge);
                        _photoBadge = new BadgeElement(_profilePhoto, "");
                        _photoBadge.Tapped += PhotoBadgeTapped;
                        _photoSection.Add(_photoBadge);
                    }
                }
                else
                {
                    new UIAlertView("Warning", "Please Choose An Image", null, "OK", null).Show();
                }
                imagePicker.DismissViewController(true, null);
            };

            imagePicker.Canceled += (sender, e) =>
            {
                imagePicker.DismissViewController(true, null);
            };

            NavigationController.PresentViewController(imagePicker, true, null);
        }
		public RootElement getUI(MovieEntry entry){
		
			NSUrl url = new NSUrl(entry.MovieThumbnail);
			NSData data = NSData.FromUrl(url);
			UIImage MovieThumb = new UIImage (data);

			UIImage Rotten = UIImage.FromBundle ("rotten.png");
			UIImage Fresh = UIImage.FromBundle ("fresh.png");
			UIImage DontKnow = UIImage.FromBundle ("QuestionMark.png");

			System.Drawing.SizeF size = new System.Drawing.SizeF ();
			size.Height = 3;
			size.Width = 3;
			Rotten.Scale (size);
			Fresh.Scale (size);
			DontKnow.Scale (size);

			String Director_String=""; 
			String Genre_String = "";
			foreach(var directors in entry.Directors){

				Director_String = Director_String +  +directors+" " ;
			}

			foreach (var genre in entry.Genres) {
			
				Genre_String = Genre_String +genre+" ";
			}

			var Actor_Section = new Section ("Actors");

			Console.WriteLine ("CompleteCast count"+entry.CompleteCast.Count);
			Console.WriteLine ("Abridged Cast Count" + entry.AbridgedCast.Count);

			foreach (var actor in entry.AbridgedCast) {

				var elem = new StyledStringElement (actor.Name , actor.Charachter, UITableViewCellStyle.Subtitle);
				Actor_Section.Add (elem);
				
			}

			var Reviews_Section = new Section ("Reviews");

			foreach (var review in entry.ListOfCritics.Critic_Info) {
				BadgeElement elem = null;
				if(review.FreshOrRotten==true){
					elem = new BadgeElement (Fresh, review.NameOfCritic+", "+review.MediaSourceOfCritc+Environment.NewLine+Environment.NewLine+review.BriefCriticReview);
					elem.LineBreakMode = UILineBreakMode.WordWrap;
					elem.Lines = 0;
					elem.Font = UIFont.FromName ("AmericanTypeWriter", 8f);
				}else if(review.FreshOrRotten==false){
					elem = new BadgeElement (Rotten, review.NameOfCritic+", "+review.MediaSourceOfCritc+Environment.NewLine+Environment.NewLine+review.BriefCriticReview);
					elem.LineBreakMode = UILineBreakMode.WordWrap;
					elem.Lines = 0;
					elem.Font = UIFont.FromName ("AmericanTypeWriter", 8f);
				}else{
					elem = new BadgeElement (DontKnow, review.NameOfCritic+", "+review.MediaSourceOfCritc+Environment.NewLine+Environment.NewLine+review.BriefCriticReview);
					elem.LineBreakMode = UILineBreakMode.WordWrap;
					elem.Lines = 0;
					elem.Font = UIFont.FromName ("AmericanTypeWriter", 8f);
				}

				Reviews_Section.Add (elem);
			}

			var Movie_Title = new Section (entry.MovieTitle);

			var Movie_Title_Element = new BadgeElement(MovieThumb,entry.OverallCriticScore +"% Of Critics liked it." + Environment.NewLine + entry.AbridgedCast [0].Name + ", " + entry.AbridgedCast [1].Name + Environment.NewLine + entry.MPAA_Rating + ", " + entry.Runtime + Environment.NewLine + entry.TheatreReleaseDate);

			Movie_Title_Element.Font = UIFont.FromName ("AmericanTypeWriter", 10f);
			Movie_Title_Element.LineBreakMode = UILineBreakMode.WordWrap;
			Movie_Title_Element.Lines = 0;

			Movie_Title.Add (Movie_Title_Element);

			var Movie_Info_Section = new Section ("Movie Details");
			var DirectorElem = new StyledStringElement("Director Names: ",Director_String,UITableViewCellStyle.Subtitle);
			var RatingElem = new StyledStringElement ("Rated: ", entry.MPAA_Rating, UITableViewCellStyle.Subtitle);
			var RunningElem = new StyledStringElement ("Running Time: ", entry.Runtime, UITableViewCellStyle.Subtitle);
			var GenreElem = new StyledStringElement ("Genre: ", Genre_String, UITableViewCellStyle.Subtitle);
			var TheatreReleaseElem = new StyledStringElement ("Theatre Release Date: ", entry.TheatreReleaseDate, UITableViewCellStyle.Subtitle);


			Movie_Info_Section.Add (DirectorElem);
			Movie_Info_Section.Add (RatingElem);
			Movie_Info_Section.Add (RunningElem);
			Movie_Info_Section.Add (GenreElem);
			Movie_Info_Section.Add (TheatreReleaseElem);

			var Synopsis_Sec = new Section ("Synopsis");

			var SysnopsisElem = new MultilineElement ("Synopsis", entry.Synopsis);

			Synopsis_Sec.Add (SysnopsisElem);

			var Links_Section = new Section ("Links");
			var Root_Element = new RootElement ("MOVIE DETAILS");

			Root_Element.Add (Movie_Title);
			Root_Element.Add (Movie_Info_Section);
	
			Root_Element.Add (Actor_Section);

			Root_Element.Add (Reviews_Section);

			return Root_Element;
		}