コード例 #1
0
ファイル: AddEditContactScreen.cs プロジェクト: NamXH/Graphy
        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);
        }
コード例 #2
0
        public override async void ViewDidLoad()
        {
            var localData = DataManager.GetTopInfluencers();

            var client = new WebDataHelper <IEnumerable <Influencer> >();
            var list   = await client.GetData("http://50.19.213.136:8080/skills-devdom/api/influencer/top/general.json");


            var firstSection = new Section("Coolest Dev")
            {
                new BadgeElement(UIImage.FromBundle("me.jpg"), "Claudio Sanchez"),
            };

            var section = new Section("Top 20");

            Root.Add(firstSection);
            Root.Add(section);

            foreach (var influencer in list)
            {
                var image = await ImageHelper.LoadImage(influencer.picture);

                var element = new BadgeElement(image, string.Format("[{0}] {1}", influencer.position, influencer.fullName));
                section.Add(element);
            }
        }
コード例 #3
0
        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
            };
        }
コード例 #4
0
        private async void LaunchExampleSix()
        {
            var badge = new Badge("Feedback phenom", "Submit 50 posts", Badge.StarNumbers.Three, true, DateTime.Now, ThemeColors.Orange16, "\uED15");

            var element = new BadgeElement
            {
                BadgeSource = badge
            };

            await Crostini.ShowNotification(badge.Description, title : badge.Title, icon : "\uE008", seconds : 4, content : element, defaultwidth : 200);
        }
コード例 #5
0
        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),
            };

            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 counterSection = new Section("Counter Elements")
            {
                new CounterElement("With comma", "88,6"),
                new CounterElement("With point", "17.97"),
                new CounterElement("No decimals", "14"),
                new CounterElement("No initial value", ""),
                new CounterElement("Mask with decimal", "0,00"),
            };

            var root = new RootElement("Assorted Elements")
            {
                counterSection,
                imageSection,
                messageSection,
                entrySection,
                calendarSection,
                badgeSection,
            };
            var dvc = new DialogViewController(root, true);

            dvc.Style = UITableViewStyle.Plain;

            navigation.PushViewController(dvc, true);
        }
コード例 #6
0
ファイル: AddEditContactScreen.cs プロジェクト: NamXH/Graphy
        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);
        }
コード例 #7
0
        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);
        }