コード例 #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            var bindings = this.CreateInlineBindingTarget<FirstViewModel>();

            var passwordElement = new EntryElement("Password", "Enter Password").Bind(bindings, vm => vm.PasswordProperty);
            passwordElement.Password = true;

            Root = new RootElement("Example Root")
                {
                    new Section("Your details")
                        {
                            new EntryElement("Login", "Enter Login name").Bind(bindings, vm => vm.TextProperty),
                            passwordElement,
                        },
                    new Section("Your options")
                        {
                            new BooleanElement("Remember me?").Bind(bindings, vm => vm.SwitchThis),
                            new CheckboxElement("Upgrade?").Bind(bindings, vm => vm.CheckThis),
                        },
                    new Section("Action")
                        {
                            new ButtonElement("Go").Bind(bindings, element => element.SelectedCommand, vm => vm.GoCommand)  
                        },
                    new Section("Debug out:")
                        {
                            new StringElement("Login is:").Bind(bindings, vm => vm.TextProperty),
                            new StringElement("Password is:").Bind(bindings, vm => vm.PasswordProperty),
                            new StringElement("Remember is:").Bind(bindings, vm => vm.SwitchThis),
                            new StringElement("Upgrade is:").Bind(bindings, vm => vm.CheckThis),
                        },
                };
        }
コード例 #2
0
ファイル: Accounts.cs プロジェクト: eatskolnikov/QBank
	RootElement CreateNewRoot(IEnumerable<IGrouping<string, Account>> accountsByGroup)
	{
		var root = new RootElement ("My Accounts");
			
		var sections = from _group 
			in accountsByGroup 
			select new Section () {  //  i.e.: Deposits 
			from account in _group select
					new AccountRootElement(account,true, StyleTransactionsScreen) 
					{
						new Section()  // Section for Account Header 
						{
							new AccountElement(account, false) as Element,
						},
						new Section("Transactions")  // Section for Transactions 
						{
						//	account.Transactions.Select(tx=> new StyledStringElement(tx.Description, string.Format (@"{0:M/d hh:mm tt} {1:C}",tx.OccuredOn, tx.Amount),UITableViewCellStyle.Subtitle) as Element),
							account.Transactions.Select(tx=> new TransactionElement(tx) as Element),

						},

				} as Element
		};

		root.Add (sections);

		return root;
	}
コード例 #3
0
		/// <summary>
		/// Populates the page with sessions, grouped by time slot
		/// that are marked as 'favorite'
		/// </summary>
		protected override void PopulateTable()
		{
			// get the sessions from the database
			var sessions = BL.Managers.SessionManager.GetSessions ();
			var favs = BL.Managers.FavoritesManager.GetFavorites();
			// extract IDs from Favorites query
			List<string> favoriteIDs = new List<string>();
			foreach (var f in favs) favoriteIDs.Add (f.SessionKey);

			// build list, matching the Favorite.SessionKey with actual
			// Session.Key rows - which might have moved if the data changed
			var root = 	new RootElement ("Favorites") {
						from s in sessions
							where favoriteIDs.Contains(s.Key)
							group s by s.Start.Ticks into g
							orderby g.Key
							select new Section (new DateTime (g.Key).ToString ("dddd HH:mm")) {
							from hs in g
							   select (Element) new SessionElement (hs)
			}};	
			
			if(root.Count == 0) {
				var section = new Section("No favorites") {
					new StyledStringElement("Touch the star to favorite a session") 
				};
				root.Add(section);
			}
			Root = root;
		}	
コード例 #4
0
ファイル: TeamView.cs プロジェクト: Jeff-Lewis/CodeBucket
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            HeaderView.SetImage(null, Images.Avatar);
            Title = ViewModel.Name;

            ViewModel.Bind(x => x.User, x =>
            {
                var name = x.FirstName + " " + x.LastName;
                HeaderView.SubText = string.IsNullOrWhiteSpace(name) ? x.Username : name;
                HeaderView.SetImage(new Avatar(x.Avatar).ToUrl(128), Images.Avatar);
                RefreshHeaderView();

                var followers = new StyledStringElement("Followers", () => ViewModel.GoToFollowersCommand.Execute(null), Images.Heart);
                var events = new StyledStringElement("Events", () => ViewModel.GoToEventsCommand.Execute(null), Images.Event);
                var organizations = new StyledStringElement("Groups", () => ViewModel.GoToGroupsCommand.Execute(null), Images.Group);
                var repos = new StyledStringElement("Repositories", () => ViewModel.GoToRepositoriesCommand.Execute(null), Images.Repo);
                var members = new StyledStringElement("Members", () => ViewModel.GoToMembersCommand.Execute(null), Images.Team);
                var midSec = new Section(new UIView(new CGRect(0, 0, 0, 20f))) { events, organizations, members, followers };
                Root = new RootElement(Title) { midSec, new Section { repos } };
            });
//          if (!ViewModel.IsLoggedInUser)
//              NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Action, (s, e) => ShowExtraMenu());
        }
コード例 #5
0
	private void Core()
	{
		var rootStyles = new RootElement ("Add New Styles");

		var styleHeaderElement = new Section ("Style Header");
		var manualEntryRootElement = new RootElement ("Manual Entry");
		styleHeaderElement.Add (manualEntryRootElement);

		var quickFillElement = new Section ("Quick Fill");
		var womenTops = new RootElement ("Womens Tops");
		var womenOutwear = new RootElement ("Womens Outerwear");
		var womenSweaters = new RootElement ("Womens Sweaters");
		quickFillElement.AddAll (new [] { womenTops, womenOutwear, womenSweaters });

		rootStyles.Add (new [] { styleHeaderElement, quickFillElement });

		// DialogViewController derives from UITableViewController, so access all stuff from it
		var rootDialog = new DialogViewController (rootStyles);
		rootDialog.NavigationItem.BackBarButtonItem = new UIBarButtonItem("Back", UIBarButtonItemStyle.Bordered, null);

		EventHandler handler = (s, e) => {
			if(_popover != null)
				_popover.Dismiss(true);
		};

		rootDialog.NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem("Cancel", UIBarButtonItemStyle.Bordered, handler), true);
		rootDialog.NavigationItem.SetRightBarButtonItem(new UIBarButtonItem("Create", UIBarButtonItemStyle.Bordered, null), true);

		NavigationPopoverContentViewController = new UINavigationController (rootDialog);
	}
コード例 #6
0
		private void Initialize()
		{
			Root = new RootElement("Flurry Analytics Portable")
			{
				new Section("Basics")
				{
					new StringElement("Flurry Supported").Bind(this, "Value IsFlurrySupported"),
					new StringElement("Flurry Version").Bind(this, "Value FlurryVersion"),
					new StringElement("Flurry API Key").Bind(this, "Value FlurryApiKey"),
				},
				new Section("User Information")
				{
					new EntryElement("User Id", "enter user id").Bind(this, "Value UserId"),
					new EntryElement("User Age", "enter user age").Bind(this, "Value UserAge, Converter=Int"),
					new SimplePickerElement("User Gender", null, null).Bind(this, "Value UserGender; Entries UserGender, Converter=EnumToEnumerable")
				},
				new Section("Location")
				{
					new StringElement("Latitude").Bind(this, "Value UserLocation.Coordinates.Latitude, Mode=TwoWay"),
					new StringElement("Longitude").Bind(this, "Value UserLocation.Coordinates.Longitude"),
					new StringElement("Accuracy").Bind(this, "Value UserLocation.Coordinates.Accuracy"),
				},
				new Section("Events")
				{
					new StyledStringElement("Show Events")
					{
						Accessory = UITableViewCellAccessory.DisclosureIndicator,
						Font = UIFont.SystemFontOfSize(UIFont.LabelFontSize)
					}.Bind(this, "SelectedCommand ShowEventsCommand"),
				},
			};
		}
コード例 #7
0
		private void ResetDisplay()
		{
            
			string addressString = ViewModel.Customer.PrimaryAddress != null ? ViewModel.Customer.PrimaryAddress.ToString() : string.Empty;
            var root = new RootElement("Customer Info")
            {
                new Section("Contact Info")
                {
                    new StringElement("ID").Bind(this, "Value Customer.ID"),
                    new StringElement("Name").Bind(this, "Value Customer.Name"),
					new StringElement("Website").Bind(this, "Value Customer.Website; SelectedCommand ShowWebsiteCommand"),
					new StringElement("Primary Phone").Bind(this, "Value Customer.PrimaryPhone; SelectedCommand CallCustomerCommand"),
                },
                new Section("General Info")
                {
					new StyledMultilineElement("Address").Bind(this, "Value Customer.PrimaryAddress; SelectedCommand ShowOnMapCommand"),
                    //new StringElement("Previous Orders ", ViewModel.Customer.Orders != null ? ViewModel.Customer.Orders.Count.ToString() : string.Empty),
                    //new StringElement("Other Addresses ", ViewModel.Customer.Addresses != null ? ViewModel.Customer.Addresses.Count.ToString() : string.Empty),
                    //new StringElement("Contacts ", ViewModel.Customer.Contacts != null ? ViewModel.Customer.Contacts.Count.ToString() : string.Empty),
                },
            };

			root.UnevenRows = true;
			Root = root;
        }
コード例 #8
0
 private void CreateOriginals(RootElement root)
 {
     originalSections = root.Sections.ToArray ();
     originalElements = new Element [originalSections.Length][];
     for (int i = 0; i < originalSections.Length; i++)
         originalElements [i] = originalSections [i].Elements.ToArray ();
 }
		public DialogViewControllerDemoListViewCustomCell () : base (UITableViewStyle.Plain, null)
		{

			ElementDerivedCustom edc1 = new ElementDerivedCustom();
			ElementDerivedCustom edc2 = new ElementDerivedCustom("UITableViewCellCustomHuzDaBoss");
			ElementDerivedCustom edc3 = new ElementDerivedCustom("UITableViewCellCustomForList");
			

			Root = new RootElement ("MTD") 
			{
				new Section ("First Section"){
					new StringElement 
					(
					  "Hello"
					, () => 
						{
							new UIAlertView ("Hola", "Thanks for tapping!", null, "Continue")
							.Show (); 
						}
					),
					new EntryElement ("Name", "Enter your name", String.Empty)
				},
				new Section ("Second Section")
				{
				  new ElementDerivedCustom()
				, edc1
				, new ElementDerivedCustom()
				, edc2
				, edc3
							, new ElementDerivedCustom("UITableViewCellCustomForList")
							, new ElementDerivedCustom("UITableViewCellCustomHuzDaBoss")
				},
			};
		}
コード例 #10
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // ios7 layout
            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
                EdgesForExtendedLayout = UIRectEdge.None;

            Root = new RootElement("The Dialog")
                {
                    new Section("Strings")
                        {
                            new EntryElement("Hello").Bind(this, "Value Hello"),
                            new EntryElement("Hello2").Bind(this, "Value Hello2"),
                            new StringElement("Test").Bind(this, "Value Combined"),
                            new BooleanElement("T or F", false).Bind(this, "Value Option1"),
                            new BooleanElement("T or F:", true).Bind(this, "Value Option1"),
                        },
                        new Section("Dates")
                            {
                                new DateElement("The Date", DateTime.Today).Bind(this, "Value TheDate"),
                                new TimeElement("The Time", DateTime.Today).Bind(this, "Value TheDate"),
                                new StringElement("Actual").Bind(this, "Value TheDate")
                            }

                };
        }
コード例 #11
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);
		}
コード例 #12
0
ファイル: SponsorsView.cs プロジェクト: jorik041/NycCodeCamp8
        public SponsorsView()
            : base(UITableViewStyle.Plain)
        {
            Root = new RootElement("Sponsors");

            RefreshRequested += (s, e) => ViewModel.RefreshDataCommand.Execute(null);
        }
コード例 #13
0
ファイル: AboutView.cs プロジェクト: jsuo/CodeBucket
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var root = new RootElement(Title)
            {
                new Section
                {
                    new MultilinedElement("CodeBucket") { Value = About, CaptionColor = Theme.CurrentTheme.MainTitleColor, ValueColor = Theme.CurrentTheme.MainTextColor }
                },
                new Section
                {
                    new StyledStringElement("Source Code", () => UIApplication.SharedApplication.OpenUrl(new NSUrl("https://github.com/thedillonb/CodeBucket")))
                },
                new Section(String.Empty, "Thank you for downloading. Enjoy!")
                {
					new StyledStringElement("Follow On Twitter", () => UIApplication.SharedApplication.OpenUrl(new NSUrl("https://twitter.com/Codebucketapp"))),
					new StyledStringElement("Rate This App", () => UIApplication.SharedApplication.OpenUrl(new NSUrl("https://itunes.apple.com/us/app/codebucket/id551531422?mt=8"))),
                    new StyledStringElement("App Version", NSBundle.MainBundle.InfoDictionary.ValueForKey(new NSString("CFBundleVersion")).ToString())
                }
            };

            root.UnevenRows = true;
            Root = root;
        }
コード例 #14
0
ファイル: SpeakerView.cs プロジェクト: jorik041/NycCodeCamp8
        protected override void OnLoadingComplete()
        {
            base.OnLoadingComplete();
          
            var bindings = this.CreateInlineBindingTarget<SpeakerViewModel>();

            Root = new RootElement("Speaker Info")
            {
                new Section
                {
                    new TransparentMultilineElement
                    {
                        Font = AppStyles.EntityTitleFont
                    }.Bind(bindings, el => el.Caption, vm => vm.Speaker.Name)
                },
                new Section
                {
                    new StyledStringElement("Send Email") { 
                        Accessory = UITableViewCellAccessory.DisclosureIndicator,
                        ShouldDeselectAfterTouch = true,
                        Image = UIImage.FromFile("compose.png"),
                        BackgroundColor = AppStyles.SemiTransparentCellBackgroundColor,
                        TextColor = AppStyles.ListTitleColor,
                        Font = AppStyles.ListTitleFont
                    }.Bind(bindings, el => el.SelectedCommand, vm => vm.EmailSpeakerCommand)
                },
                new Section
                {
                    new TransparentMultilineElement()
                        .Bind(bindings, el => el.Caption, vm => vm.Speaker.Bio, "MultiLine")
                }
            };
            Root.UnevenRows = true;
        }
コード例 #15
0
ファイル: IssueView.cs プロジェクト: Mikoj/CodeBucket
		public void RenderIssue()
		{
			if (ViewModel.Issue == null)
				return;

            var avatar = new Avatar(ViewModel.Issue.ReportedBy?.Avatar);

			NavigationItem.RightBarButtonItem.Enabled = true;
            HeaderView.Text = ViewModel.Issue.Title;
            HeaderView.SetImage(avatar.ToUrl(), Images.Avatar);
            HeaderView.SubText = ViewModel.Issue.Content ?? "Updated " + ViewModel.Issue.UtcLastUpdated.Humanize();
            RefreshHeaderView();

            var split = new SplitButtonElement();
            split.AddButton("Comments", ViewModel.Comments.Items.Count.ToString());
            split.AddButton("Watches", ViewModel.Issue.FollowerCount.ToString());

            var root = new RootElement(Title);
            root.Add(new Section { split });

			var secDetails = new Section();

			if (!string.IsNullOrEmpty(ViewModel.Issue.Content))
			{
                _descriptionElement.LoadContent(new MarkdownRazorView { Model = ViewModel.Issue.Content }.GenerateString());
				secDetails.Add(_descriptionElement);
			}

            _split1.Button1.Text = ViewModel.Issue.Status;
            _split1.Button2.Text = ViewModel.Issue.Priority;
            secDetails.Add(_split1);

            _split2.Button1.Text = ViewModel.Issue.Metadata.Kind;
            _split2.Button2.Text = ViewModel.Issue.Metadata.Component ?? "No Component";
			secDetails.Add(_split2);

            _split3.Button1.Text = ViewModel.Issue.Metadata.Version ?? "No Version";
            _split3.Button2.Text = ViewModel.Issue.Metadata.Milestone ?? "No Milestone";
            secDetails.Add(_split3);

			var assigneeElement = new StyledStringElement("Assigned", ViewModel.Issue.Responsible != null ? ViewModel.Issue.Responsible.Username : "******", UITableViewCellStyle.Value1) {
                Image = AtlassianIcon.User.ToImage(),
				Accessory = UITableViewCellAccessory.DisclosureIndicator
			};
			assigneeElement.Tapped += () => ViewModel.GoToAssigneeCommand.Execute(null);
			secDetails.Add(assigneeElement);

			root.Add(secDetails);

            if (ViewModel.Comments.Any(x => !string.IsNullOrEmpty(x.Content)))
			{
				root.Add(new Section { _commentsElement });
			}

            var addComment = new StyledStringElement("Add Comment") { Image = AtlassianIcon.Addcomment.ToImage() };
			addComment.Tapped += AddCommentTapped;
			root.Add(new Section { addComment });
			Root = root;
		}
コード例 #16
0
ファイル: DemoIndex.cs プロジェクト: runegri/Android.Dialog
		public IndexedViewController (RootElement root, bool pushing) : base (root, pushing)
		{
			// Indexed tables require this style.
			Style = UITableViewStyle.Plain;
			EnableSearch = true;
			SearchPlaceholder = "Find item";
			AutoHideSearch = true;
		}
コード例 #17
0
ファイル: SessionsView.cs プロジェクト: jorik041/NycCodeCamp8
        public SessionsView()
            : base(UITableViewStyle.Plain)
        {
            Root = new RootElement("Schedule");
            Root.UnevenRows = true;

            RefreshRequested += (s, e) => ViewModel.RefreshDataCommand.Execute(null);
        }
コード例 #18
0
ファイル: OverviewView.cs プロジェクト: jorik041/NycCodeCamp8
        public OverviewView()
            : base(UITableViewStyle.Plain)
        {
            Root = new RootElement("NYC Code Camp");
            Root.UnevenRows = true;

            RefreshRequested += (s, e) => ViewModel.RefreshDataCommand.Execute(null);
        }
コード例 #19
0
ファイル: Accounts.cs プロジェクト: eatskolnikov/QBank
	UIViewController StyleTransactionsScreen (RootElement arg)
	{
		var dvc = new DialogViewController (UITableViewStyle.Plain, arg,true);
		dvc.LoadView ();
		dvc.Root.TableView.SeparatorColor = UIColor.FromPatternImage (Resources.CellSeparator);
		dvc.Root.TableView.BackgroundView = new UIImageView (UIImage.FromBundle ("paper.png"));

		return dvc;
	}
コード例 #20
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var bindings = this.CreateInlineBindingTarget<FirstViewModel>();

            // note that this list isn't bound - if the view model list changes, then the UI won't update it;s list
            var radioChoices = from r in (ViewModel as FirstViewModel).DessertChoices
                               select (Element)new RadioElement(r);

            Root = new RootElement("Example Root")
                {
                    new Section("Your details")
                        {
                            new EntryElement("Login", "Enter Login name").Bind(bindings, vm => vm.TextProperty),
                            new EntryElement("Password", "Enter Password", "", true).Bind(bindings, vm => vm.PasswordProperty)
                        },
                    new Section("Your options")
                        {
                            new BooleanElement("Remember me?", false).Bind(bindings, vm => vm.SwitchThis),
                            new CheckboxElement("Upgrade?").Bind(bindings, vm => vm.CheckThis),
                        },
                    new Section("Radio")
                        {
                            new RootElement("Dessert", new RadioGroup("Dessert", 0))
                                {
                                    new Section()
                                        {
                                            radioChoices
                                        }
                                }.Bind(bindings, e => e.RadioSelected, vm => vm.CurrentDessertIndex) as Element
                        },
                    new Section("Action")
                        {
                            new StyledStringElement("Second")
                                {
                                    BackgroundColor = UIColor.Red,
                                    TextColor = UIColor.Yellow,
                                    Alignment = UITextAlignment.Right
                                }.Bind(bindings, element => element.SelectedCommand, vm => vm.GoSecondCommand),
                            new StyledStringElement("Bindable Elements") {
                                BackgroundColor = UIColor.Blue,
                                TextColor = UIColor.White,
                                Alignment = UITextAlignment.Center
                                }.Bind(bindings, element => element.SelectedCommand, vm => vm.BindableElementsCommand), 
                        },
                    new Section("Debug out:")
                        {
                            new StringElement("Login is:").Bind(bindings, vm => vm.TextProperty),
                            new StringElement("Password is:").Bind(bindings, vm => vm.PasswordProperty),
                            new StringElement("Remember is:").Bind(bindings, vm => vm.SwitchThis),
                            new StringElement("Upgrade is:").Bind(bindings, vm => vm.CheckThis),
                            new StringElement("Selected Dessert Index is:").Bind(bindings, vm => vm.CurrentDessertIndex),
                        },
                };
        }
コード例 #21
0
		private void Initialize()
		{
			Root = new RootElement("Events")
			{
				new Section("Normal Events")
				{
					new Element("Log Single Event").Bind(this, "SelectedCommand LogNormalEventCommand"),
					new Element("Log Parametrized Event").Bind(this, "SelectedCommand LogParametrizedEventCommand"),
				},
				new Section("Timed Events")
				{
					new Element("Log Single Event").Bind(this, "SelectedCommand LogNormalTimedEventCommand"),
					new Element("Log Parametrized Timed Event").Bind(this, "SelectedCommand LogParametrizedTimedEventCommand"),
					new Element("Log Updated Parametrized Timed Event").Bind(this,
						"SelectedCommand LogParametrizedTimedEventWithEndParametersCommand"),
				},
				new Section("Errors")
				{
					new Element("Log Error").Bind(this, "SelectedCommand LogErrorCommand")
				},
			};

			// show a progress box if there is some work
			var events = ViewModel as EventsViewModel;
			if (events != null)
			{
				UIAlertView progress = null;
				events.PropertyChanged += (sender, e) =>
				{
					if (e.PropertyName == "IsWorking")
					{
						if (events.IsWorking)
						{
							if (progress == null)
							{
								progress = new UIAlertView("Working...", "Doing absolutely nothing in the background...", null, null, null);
								UIActivityIndicatorView indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray);
								indicator.StartAnimating();
								progress.SetValueForKey(indicator, (NSString)"accessoryView");
								progress.Show();
							}
						}
						else
						{
							if (progress != null)
							{
								progress.DismissWithClickedButtonIndex(0, true);
								progress = null;
							}
						}
					}
				};
			}
		}
コード例 #22
0
ファイル: MenuView.cs プロジェクト: jorik041/NycCodeCamp8
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var frame = View.Frame;
            frame.Width = 200;
            View.Frame = frame;

            TableView.ScrollEnabled = false;

            var binder = this.CreateBindingSet<MenuView, MenuViewModel>();

            Func<string, string, Expression<Func<MenuViewModel, object>>, StyledStringElement> createElement = (text, imageFileName, property) =>
            {
                var element = new StyledStringElement(text) 
                { 
                    Accessory = UITableViewCellAccessory.DisclosureIndicator,
                    ShouldDeselectAfterTouch = true,
                    Image = UIImage.FromFile(imageFileName),
                    BackgroundColor = AppStyles.MenuCellBackgroundColor
                };

                binder.Bind(element)
                      .For(el => el.SelectedCommand)
                      .To(property);

                return element;
            };
              
            Root = new RootElement("")
            {
                new Section
                {
                    createElement("Overview", "home.png", vm => vm.ShowOverviewCommand),
                    createElement("Full Schedule", "clock.png", vm => vm.ShowSessionsCommand),
                    createElement("Speakers", "users.png", vm => vm.ShowSpeakersCommand),
                    createElement("Sponsors", "sponsors.png", vm => vm.ShowSponsorsCommand),
                    createElement("Facility Map", "map.png", vm => vm.ShowMapCommand)
                }
            };

            var headerView = new UIView(new RectangleF(0, 0, View.Frame.Width, 60));
            headerView.Add(new UILabel(new RectangleF(15, 0, headerView.Frame.Width - 15, headerView.Frame.Height))
            {
                Text = "NYC Code Camp 8",
                Font = UIFont.FromName("HelveticaNeue-Bold", 18),
                BackgroundColor = UIColor.Clear,
                TextColor = AppStyles.StandardTextColor
            });
            TableView.TableHeaderView = headerView;

            binder.Apply();
        }
コード例 #23
0
        public BindingContext(Context context, object callbacks, object o, string title)
        {
            _context = context;

            if (o == null)
                throw new ArgumentNullException("o");

            mappings = new Dictionary<Element, MemberAndInstance>();

            Root = new RootElement(title);
            Populate(callbacks, o, Root);
        }
コード例 #24
0
        public override void OnViewCreated(Views.View p0, OS.Bundle p1)
        {
            if (DialogAdapter == null)
            {
                ListAdapter = DialogAdapter = new DialogAdapter(Activity, _root, ListView);
                _root = null;
            }

            DialogAdapter.List = ListView;
            DialogAdapter.RegisterListView();
            base.OnViewCreated(p0, p1);
        }
コード例 #25
0
ファイル: AccountsView.cs プロジェクト: Jeff-Lewis/CodeBucket
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            var root = new RootElement(Title);
            var accountSection = new Section();
            var accounts = PopulateAccounts();
            accountSection.AddAll(accounts);
            root.Add(accountSection);
            Root = root;

            CheckEntries();
        }
コード例 #26
0
        private RootElement BuildRoot(string url)
        {
            var root = new RootElement (String.Empty);
            var section = new Section("TodoItems");
            root.Add (section);
            var result = GetAzureResult (url);

            foreach (JsonObject item in result) {
                section.Add (new StringElement(item["text"]));
            }

            return root;
        }
コード例 #27
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            var bindings = this.CreateInlineBindingTarget<LinearViewModel>();

            // note that this list isn't bound - if the view model list changes, then the UI won't update it;s list
            var radioChoices = from r in (ViewModel as LinearViewModel).DessertChoices
                               select (Element)new RadioElement(r);

            Root = new RootElement("Example Root")
                {
                    new Section("Your details")
                        {
                            new EntryElement("Login", "Enter Login name").Bind(bindings, vm => vm.TextProperty),
                            new EntryElement("Password", "Enter Password")
                            {
                                Password = true
                            }.Bind(bindings, vm => vm.PasswordProperty)
                        },
                    new Section("Your options")
                        {
                            new BooleanElement("Remember me?").Bind(bindings, vm => vm.SwitchThis),
                            new CheckboxElement("Upgrade?").Bind(bindings, vm => vm.CheckThis),
                        },
                    new Section("Radio")
                        {
                            new RootElement("Dessert", new RadioGroup("Dessert", 0))
                                {
                                    new Section()
                                        {
                                            radioChoices
                                        }
                                }.Bind(bindings, e => e.RadioSelected, vm => vm.CurrentDessertIndex) as Element
                        },
                    new Section("Action")
                        {
                            new ButtonElement("Second").Bind(bindings, element => element.SelectedCommand, vm => vm.GoSecondCommand),
                            new ButtonElement("Bindable Elements").Bind(bindings, element => element.SelectedCommand, vm => vm.BindableElementsCommand),
                            new ButtonElement("Listview dialog").Bind(bindings, element => element.SelectedCommand, vm => vm.GoListViewCommand)  
                        },
                    new Section("Debug out:")
                        {
                            new StringElement("Login is:").Bind(bindings, vm => vm.TextProperty),
                            new StringElement("Password is:").Bind(bindings, vm => vm.PasswordProperty),
                            new StringElement("Remember is:").Bind(bindings, vm => vm.SwitchThis),
                            new StringElement("Upgrade is:").Bind(bindings, vm => vm.CheckThis),
                            new StringElement("Selected Dessert Index is:").Bind(bindings, vm => vm.CurrentDessertIndex),
                        },
                };
        }
コード例 #28
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Root = new RootElement("Test Root Elem")
            {
                new Section
                {
                    new StringElement("Label", "Only Element in a Blank Section"),
                },
                new Section("Test Header", "Test Footer")
                {
                    new ButtonElement("DialogActivity", (o, e) => StartNew()),
                    new StringElement("DialogListView Activity", Resource.Layout.dialog_labelfieldright)
                    {
                        Click = (o, e) => ClickList(),
                    },
                    new BooleanElement("Push my button", true),
                    new BooleanElement("Push this too", false),
                    new StringElement("Text label", "Click for EntryElement Test")
                    {
                        Click = (o, e) => ClickElementTest(),
                    },
                },
                new Section("Part II")
                {
                    new StringElement("This is the String Element", "The Value"),
                    new CheckboxElement("Check this out", true),
                    new EntryElement("Username", string.Empty){ Hint = "Enter Login", },
                    new EntryElement("Password", string.Empty) {
                        Hint = "Enter Password",
                        Password = true,
                    },
                },
                new Section("Group", new ViewElement(Android.Resource.Layout.SimpleListItem1)
                    { Populate = view => { view.FindViewById<TextView>(Android.Resource.Id.Text1).Text = "Custom footer view"; }, })
                {
                    (Element)new RootElement("Radio Group", new Android.Dialog.RadioGroup("dessert", 2))
                    {
                        new Section
                        {
                            new RadioElement("Ice Cream Sandwich", "dessert"),
                            new RadioElement("Honeycomb", "dessert"),
                            new RadioElement("Gingerbread", "dessert"),
                        },
                    },
                }
            };

            ValueChanged += root_ValueChanged;
        }
コード例 #29
0
		public void DemoAdvancedEditing () 
		{
			var root = new RootElement ("Todo list") {
				new Section() {
			        new StringElement ("1", "Todo item 1"),
					new StringElement ("2","Todo item 2"),
					new StringElement ("3","Todo item 3"),
					new StringElement ("4","Todo item 4"),
					new StringElement ("5","Todo item 5")
				}
		    };
			var dvc = new AdvancedEditingDialog (root, true);
			AdvancedConfigEdit (dvc);			
			navigation.PushViewController (dvc, true);
		}
コード例 #30
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);
		}
コード例 #31
0
 protected EventSourceDialogViewController(UITableViewStyle style = UITableViewStyle.Grouped,
                                           RootElement root       = null,
                                           bool pushing           = false)
     : base(style, root, pushing)
 {
 }
コード例 #32
0
 public override void Reset()
 {
     RootElement.Clear();
     InspectorElement?.Dispose();
 }
コード例 #33
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            // If was send true to Profile.EnableUpdatesOnAccessTokenChange method
            // this notification will be called after the user is logged in and
            // after the AccessToken is gotten
            Profile.Notifications.ObserveDidChange((sender, e) => {
                if (e.NewProfile == null)
                {
                    return;
                }

                LoggedIn(e.NewProfile.UserId);
            });

            loginButton = new LoginButton(new CGRect(48, 0, 218, 46))
            {
                LoginBehavior = LoginBehavior.Browser
            };

            // Handle actions once the user is logged in
            loginButton.Completed += (sender, e) => {
                if (e.Error != null)
                {
                    ShowMessageBox("Ups", e.Error.Description, "Ok", null, null);
                    return;
                }
                if (e.Result.IsCancelled)
                {
                    ShowMessageBox("Ups", "The user cancelled the request", "Ok", null, null);
                    return;
                }
            };

            // Handle actions once the user is logged out
            loginButton.LoggedOut += (sender, e) => {
                LoggedOut();
            };

            // This permission is set by default
            chkPublicProfile         = new CustomCheckboxElement("Public Profile", true);
            chkPublicProfile.Enabled = false;

            // Add or remove all the permissions that you want to ask
            readSection = new Section("Ask Read Permissions")
            {
                chkPublicProfile,
                new CustomCheckboxElement("Email", () => CheckReadPermission("email")),
                new CustomCheckboxElement("About Me", () => CheckReadPermission("user_about_me")),
                new CustomCheckboxElement("Birthday", () => CheckReadPermission("user_birthday")),
                new CustomCheckboxElement("Hometown", () => CheckReadPermission("user_hometown")),
                new CustomCheckboxElement("Friendlists", () => CheckReadPermission("read_custom_friendlists")),
                new CustomCheckboxElement("Managed Groups", () => CheckReadPermission("user_managed_groups"))
            };

            // The user image profile is set automatically once is logged in
            pictureView = new ProfilePictureView(new CGRect(48, 0, 220, 220));

            // Add the initial sections
            Root = new RootElement("Facebook iOS Sample")
            {
                readSection,
                new Section()
                {
                    new UIViewElement("", loginButton, true)
                    {
                        Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent,
                    }
                }
            };

            // If the user is already logged in, remove the read section and add the actions sections
            if (AccessToken.CurrentAccessToken != null)
            {
                LoggedIn(AccessToken.CurrentAccessToken.UserID);
            }
        }
コード例 #34
0
 public AdvancedEditingDialog(RootElement root, bool pushing) : base(root, pushing)
 {
 }
コード例 #35
0
        protected void UpdateView()
        {
            var root = new RootElement(Title)
            {
                UnevenRows = true
            };
            var section = new Section();

            root.Add(section);

            var desc = new Gistacular.Elements.MultilinedElement("Description")
            {
                Value = _model.Description
            };

            desc.Tapped += ChangeDescription;
            section.Add(desc);

            if (_public == null)
            {
                _public = new Gistacular.Elements.TrueFalseElement("Public");
            }
            _public.Value = _model.Public;

            if (_publicEditable)
            {
                section.Add(_public);
            }

            var fileSection = new Section();

            root.Add(fileSection);

            foreach (var file in _model.Files.Keys)
            {
                var key = file;
                if (!_model.Files.ContainsKey(key) || _model.Files[file].Content == null)
                {
                    continue;
                }

                var size = System.Text.ASCIIEncoding.UTF8.GetByteCount(_model.Files[file].Content);
                var el   = new StyledElement(file, size + " bytes", UITableViewCellStyle.Subtitle)
                {
                    Accessory = UITableViewCellAccessory.DisclosureIndicator
                };
                el.Tapped += () => {
                    if (!_model.Files.ContainsKey(key))
                    {
                        return;
                    }
                    var createController = new ModifyGistFileController(key, _model.Files[key].Content);
                    createController.Save = (name, content) => {
                        if (string.IsNullOrEmpty(name))
                        {
                            throw new InvalidOperationException("Please enter a name for the file");
                        }

                        //If different name & exists somewhere else
                        if (!name.Equals(key) && _model.Files.ContainsKey(name))
                        {
                            throw new InvalidOperationException("A filename by that type already exists");
                        }

                        //Remove old
                        _model.Files.Remove(key);

                        //Put new
                        _model.Files[name] = new GistCreateModel.File {
                            Content = content
                        };
                    };

                    NavigationController.PushViewController(createController, true);
                };
                fileSection.Add(el);
            }

            fileSection.Add(new StyledElement("Add New File", AddFile));

            Root = root;
        }
コード例 #36
0
        protected override bool ProcessWindowMessage(IntPtr hwnd, uint msg, IntPtr wParam, IntPtr lParam, ref IntPtr lResult)
        {
            if (msg == WM_NCCALCSIZE)
            {
                bool bCalcValidRects = wParam.ToInt32() != 0;
                if (bCalcValidRects)
                {
                    lResult = IntPtr.Zero;
                    return(true);
                }
            }

            else if (msg == WM_NCHITTEST)
            {
                if (DwmDefWindowProc(hwnd, msg, wParam, lParam, out lResult) != 0)
                {
                    return(true);
                }

                PInvokeUtils.POINT p = new PInvokeUtils.POINT()
                {
                    X = LoWord((int)lParam), Y = HiWord((int)lParam)
                };
                const int LEFT_WIDTH   = 8;
                const int RIGHT_WIDTH  = 8;
                const int BOTTOM_WIDTH = 8;
                const int TOP_WIDTH    = 8;

                PInvokeUtils.RECT rcWindow;
                GetWindowRect(_hwnd, out rcWindow);

                int uRow = 1;
                int uCol = 1;

                if (p.Y >= rcWindow.top && p.Y < rcWindow.top + TOP_WIDTH)
                {
                    uRow = 0;
                }
                else if (p.Y < rcWindow.bottom && p.Y >= rcWindow.bottom - BOTTOM_WIDTH)
                {
                    uRow = 2;
                }

                if (p.X >= rcWindow.left && p.X < rcWindow.left + LEFT_WIDTH)
                {
                    uCol = 0;
                }
                else if (p.X < rcWindow.right && p.X >= rcWindow.right - RIGHT_WIDTH)
                {
                    uCol = 2;
                }

                int[,] hitTests = new int[3, 3] {
                    { HTTOPLEFT, HTTOP, HTTOPRIGHT },
                    { HTLEFT, HTCLIENT, HTRIGHT },
                    { HTBOTTOMLEFT, HTBOTTOM, HTBOTTOMRIGHT },
                };

                lResult = new IntPtr(hitTests[uRow, uCol]);

                if (hitTests[uRow, uCol] == HTCLIENT)
                {
                    ScreenToClient(_hwnd, ref p);
                    var el = ElementAtPoint(p.X, p.Y);
                    Debug.WriteLine(el.ToString());
                    if (el != null && el.Test("caption#area-glass"))
                    {
                        lResult = new IntPtr(HTCAPTION);
                    }
                }

                return(true);
            }

            else if (msg == WM_SIZE)
            {
                if (wParam.ToInt32() == (int)WmSizeType.SIZE_MAXIMIZED)
                {
                    _is_maximized = true;
                    SetWindowPos(_hwnd, IntPtr.Zero, 0, 0, 0, 0, SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_NOACTIVATE | SetWindowPosFlags.SWP_FRAMECHANGED);
                    RootElement.SetState(SciterXDom.ELEMENT_STATE_BITS.STATE_EXPANDED, 0);
                }

                else if (wParam.ToInt32() == (int)WmSizeType.SIZE_RESTORED && _is_maximized)
                {
                    _is_maximized = false;
                    SetWindowPos(_hwnd, IntPtr.Zero, 0, 0, 0, 0, SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_NOACTIVATE | SetWindowPosFlags.SWP_FRAMECHANGED);
                    RootElement.SetState(0, SciterXDom.ELEMENT_STATE_BITS.STATE_EXPANDED);
                }
            }
            return(false);
        }
コード例 #37
0
 public RwsError(HttpResponseMessage responseMessage) : base(responseMessage)
 {
     SetErrorDescription(RootElement?.Attribute(Constants.MDSOL + "ErrorDescription")?.Value);
 }
コード例 #38
0
 public DialogViewController(UITableViewStyle style, RootElement root, bool pushing) : base(style)
 {
     Style        = style;
     this.pushing = pushing;
     this.root    = root;
 }
コード例 #39
0
ファイル: OperationPage.cs プロジェクト: romap0/DFFBudget
        public static void OperationPage(Operation operation, Action refresh, string type)
        {
            var delete   = false;
            var date     = new DateElement("Дата", operation.Datetime);
            var category = new RootElement("Категория", new RadioGroup(operation.CategoryId))
            {
                Global.CategoriesRoot
            };
            var sum = new EntryElement("Сумма", "", operation.Sum.ToString())
            {
                KeyboardType = UIKeyboardType.DecimalPad
            };
            var comment = new EntryElement("Комментарий", "", operation.Comment)
            {
                ReturnKeyType = UIReturnKeyType.Done
            };

            var root = new RootElement("Подробности")
            {
                new Section()
                {
                    date,
                    category,
                    sum,
                    comment
                }
            };

            var dv = new DialogViewController(root, true);

            dv.ViewDisappearing += delegate
            {
                if (!delete)
                {
                    operation.Datetime   = date.DateValue;
                    operation.CategoryId = category.RadioSelected;
                    operation.Sum        = int.Parse(sum.Value);
                    operation.Comment    = comment.Value;

                    Task.Factory.StartNew(
                        () =>
                    {
                        DataLayer.PutOperation(operation, type);
                    }
                        ).ContinueWith(
                        t =>
                    {
                    }, TaskScheduler.FromCurrentSynchronizationContext()
                        );
                }
                refresh();
            };

            var deleteButton = new UIBarButtonItem(UIBarButtonSystemItem.Trash);

            deleteButton.Clicked += delegate
            {
                UIAlertView alert = new UIAlertView("Удаление", "Вы точно хотите удалить?", null, "Да", new string[] { "Нет" });
                alert.Clicked += (s, b) =>
                {
                    if (b.ButtonIndex == 0)
                    {
                        delete = true;

                        if (type == "income")
                        {
                            Global.Incomes.Remove(operation);
                        }
                        else
                        {
                            Global.Outcomes.Remove(operation);
                        }

                        Task.Factory.StartNew(
                            () =>
                        {
                            DataLayer.DeleteOperation(operation, type);
                        }
                            ).ContinueWith(
                            t =>
                        {
                        }, TaskScheduler.FromCurrentSynchronizationContext()
                            );

                        navigation.PopViewControllerAnimated(true);
                    }
                };
                alert.Show();
            };
            dv.NavigationItem.RightBarButtonItem = deleteButton;

            navigation.PushViewController(dv, true);
        }
コード例 #40
0
 /// <summary>
 /// Returns the specified task's element in the XML document or null
 /// if there is no matching element.
 /// </summary>
 /// <param name="guid">GUID of the task.</param>
 private XElement GetTaskElement(string guid)
 {
     return(RootElement.Elements("task").SingleOrDefault(e => e.Attribute("guid").Value == guid));
 }
コード例 #41
0
        //------------------------------------------------------------------------------
        RootElement CreateGeneralSection()
        {
            m_bluetooth = new BooleanElement("Bluetooth", LocalSettings.Bluetooth);
            m_bluetooth.ValueChanged += (object sender, EventArgs e) =>
            {
                LocalSettings.Bluetooth = m_bluetooth.Value;
                LocalSettings.SaveSetting(s => LocalSettings.Bluetooth);
            };

            m_locationService = new BooleanElement("Location Services", LocalSettings.LocationServices);
            m_locationService.ValueChanged += (object sender, EventArgs e) =>
            {
                LocalSettings.LocationServices = m_locationService.Value;
                LocalSettings.SaveSetting(s => LocalSettings.LocationServices);
            };

            Action <RadioElementEx, EventArgs> saveAutoLockDelegate = (sender, e) =>
            {
                LocalSettings.AutoLock = (AutoLock)m_autoLock.RadioSelected;
                LocalSettings.SaveSetting(s => LocalSettings.AutoLock);
            };

            m_autoLock = new RootElement("Auto-Lock", new RadioGroup((int)LocalSettings.AutoLock))
            {
                new Section()
                {
                    new RadioElementEx("Never", saveAutoLockDelegate),
                    new RadioElementEx("1 Minute", saveAutoLockDelegate),
                    new RadioElementEx("2 Minutes", saveAutoLockDelegate),
                    new RadioElementEx("3 Minutes", saveAutoLockDelegate),
                    new RadioElementEx("4 Minutes", saveAutoLockDelegate),
                    new RadioElementEx("5 Minutes", saveAutoLockDelegate),
                }
            };

            Action <RadioElementEx, EventArgs> saveHomeButtonDoubleClickDelegate = (sender, e) =>
            {
                LocalSettings.HomeButtonDoubleClick = (HomeButtonDoubleClick)m_homeButtonDoubleClick.RadioSelected;
                LocalSettings.SaveSetting(s => LocalSettings.HomeButtonDoubleClick);
            };

            m_homeButtonDoubleClick = new RootElement("Home", new RadioGroup((int)LocalSettings.HomeButtonDoubleClick))
            {
                new Section("Double-click the Home Button for:")
                {
                    new RadioElementEx("Home", saveHomeButtonDoubleClickDelegate),
                    new RadioElementEx("Search", saveHomeButtonDoubleClickDelegate),
                    new RadioElementEx("Phone favorites", saveHomeButtonDoubleClickDelegate),
                    new RadioElementEx("Camera", saveHomeButtonDoubleClickDelegate),
                    new RadioElementEx("iPod", saveHomeButtonDoubleClickDelegate),
                }
            };

            return(new RootElement("General")
            {
                new Section()
                {
                    new RootElement("Bluetooth", 0, 0)
                    {
                        new Section()
                        {
                            m_bluetooth
                        }
                    },
                    m_locationService,
                },
                new Section()
                {
                    m_autoLock,
                    m_homeButtonDoubleClick,
                },
            });
        }
コード例 #42
0
 private void Reload_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
 {
     RootElement.StopRender();
     LoadReact();
 }
コード例 #43
0
 public IInputElement HitTest(Point position)
 {
     return(RootElement.HitTest(position) as IInputElement);
 }
コード例 #44
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SmtpConnectView"/> class.
        /// </summary>
        /// <param name="siteName">The remote site name.</param>
        /// <param name="navigation">AppWindow.</param>
        public SmtpConnectView(AppWindow window, MailMessage message) :
            base(new RootElement("Send Mail Message"), true)
        {
            // Initialize controller's elements
            _window = window;

            _message = message;

            _serverName = new EntryElement("Hostname: ", "Enter server address", "smtp.gmail.com");
            Util.DisableAutoCorrectionAndAutoCapitalization(_serverName);

            var noneRadio     = new RadioElement("None", "mode");
            var implicitRadio = new RadioElement("Implicit", "mode");
            var explicitRadio = new RadioElement("Explicit", "mode");

            // automatically update port number to SSL mode default
            noneRadio.Tapped     += () => { ServerPort = Smtp.DefaultPort; };
            explicitRadio.Tapped += () => { ServerPort = Smtp.DefaultPort; };
            implicitRadio.Tapped += () => { ServerPort = Smtp.DefaultImplicitSslPort; };

            _sslModes = new RadioGroup("mode", 1);
            _mode     = new RootElement("TLS/SSL mode:", _sslModes)
            {
                new Section()
                {
                    noneRadio,
                    implicitRadio,
                    explicitRadio
                }
            };

            string defaultPort = Smtp.DefaultImplicitSslPort.ToString();

            _serverPort = new EntryElement("Port: ", "Enter port", defaultPort);
            _serverPort.KeyboardType = UIKit.UIKeyboardType.NumberPad;

            _username = new EntryElement("Username: "******"Enter username", "");
            Util.DisableAutoCorrectionAndAutoCapitalization(_username);

            _password = new EntryElement("Password: "******"Enter password", "", true);
            Util.DisableAutoCorrectionAndAutoCapitalization(_password);

            _propertiesSection = new Section()
            {
                _serverName,
                _mode,
                _serverPort,
                _username,
                _password
            };

            Root.Add(_propertiesSection);

            _connectButton = UIButton.FromType(UIButtonType.System);
            _connectButton.SetTitle("Send Message", UIControlState.Normal);
            _connectButton.Frame          = new CoreGraphics.CGRect(0, 0, _window.Screen.Bounds.Width - 20, 40);
            _connectButton.TouchUpInside += Connect;

            Section buttonSection = new Section();

            buttonSection.Add(_connectButton);

            Root.Add(buttonSection);
        }
コード例 #45
0
 public Source(DialogViewController container)
 {
     this.Container = container;
     Root           = container.root;
 }
コード例 #46
0
ファイル: RepositoryView.cs プロジェクト: mikoj/CodeBucket
        public void Render(RepositoryDetailedModel model)
        {
            if (model == null)
            {
                return;
            }

            Title = model.Name;

            var avatar = new Avatar(model.Logo).ToUrl(128);
            var root   = new RootElement(Title)
            {
                UnevenRows = true
            };

            HeaderView.SubText = string.IsNullOrWhiteSpace(model.Description) ? "Updated " + model.UtcLastUpdated.Humanize() : model.Description;
            HeaderView.SetImage(avatar, Images.RepoPlaceholder);
            RefreshHeaderView();

            var stargazersCommand = ViewModel.GoToStargazersCommand;
            var split             = new SplitButtonElement();

            split.AddButton("Watchers", model.FollowersCount.ToString(), () => stargazersCommand.Execute(null));
            split.AddButton("Forks", model.ForkCount.ToString());
            split.AddButton("Branches", ViewModel.Branches?.Count.ToString() ?? "-");

            var sec1 = new Section();

            _split1.Button1.Image = model.IsPrivate ? AtlassianIcon.Locked.ToImage() : AtlassianIcon.Unlocked.ToImage();
            _split1.Button1.Text  = model.IsPrivate ? "Private" : "Public";
            _split1.Button2.Text  = string.IsNullOrEmpty(model.Language) ? "N/A" : model.Language;
            sec1.Add(_split1);

            _split3.Button1.Text = model.Scm.ApplyCase(LetterCasing.Title);
            _split3.Button2.Text = "Issues".ToQuantity(ViewModel.Issues);
            sec1.Add(_split3);

            _split2.Button1.Text = (model.UtcCreatedOn).ToString("MM/dd/yy");
            _split2.Button2.Text = model.Size.Bytes().ToString("#.##");
            sec1.Add(_split2);

            var owner = new StyledStringElement("Owner", model.Owner)
            {
                Image = AtlassianIcon.User.ToImage(), Accessory = UITableViewCellAccessory.DisclosureIndicator
            };

            owner.Tapped += () => ViewModel.GoToOwnerCommand.Execute(null);
            sec1.Add(owner);

            if (model.ForkOf != null)
            {
                var parent = new StyledStringElement("Forked From", model.ForkOf.Name)
                {
                    Image = AtlassianIcon.Devtoolsfork.ToImage(), Accessory = UITableViewCellAccessory.DisclosureIndicator
                };
                parent.Tapped += () => ViewModel.GoToForkParentCommand.Execute(model.ForkOf);
                sec1.Add(parent);
            }

            var events = new StyledStringElement("Events", () => ViewModel.GoToEventsCommand.Execute(null), AtlassianIcon.Blogroll.ToImage());
            var sec2   = new Section {
                events
            };

            if (model.HasWiki)
            {
                sec2.Add(new StyledStringElement("Wiki", () => ViewModel.GoToWikiCommand.Execute(null), AtlassianIcon.Edit.ToImage()));
            }

            if (model.HasIssues)
            {
                sec2.Add(new StyledStringElement("Issues", () => ViewModel.GoToIssuesCommand.Execute(null), AtlassianIcon.Flag.ToImage()));
            }

            if (ViewModel.HasReadme)
            {
                sec2.Add(new StyledStringElement("Readme", () => ViewModel.GoToReadmeCommand.Execute(null), AtlassianIcon.Pagedefault.ToImage()));
            }

            var sec3 = new Section
            {
                new StyledStringElement("Commits", () => ViewModel.GoToCommitsCommand.Execute(null), AtlassianIcon.Devtoolscommit.ToImage()),
                new StyledStringElement("Pull Requests", () => ViewModel.GoToPullRequestsCommand.Execute(null), AtlassianIcon.Devtoolspullrequest.ToImage()),
                new StyledStringElement("Source", () => ViewModel.GoToSourceCommand.Execute(null), AtlassianIcon.Filecode.ToImage()),
            };

            root.Add(new[] { new Section {
                                 split
                             }, sec1, sec2, sec3 });

            if (!String.IsNullOrEmpty(ViewModel.Repository.Website))
            {
                root.Add(new Section
                {
                    new StyledStringElement("Website", () => ViewModel.GoToUrlCommand.Execute(ViewModel.Repository.Website), AtlassianIcon.Homepage.ToImage())
                });
            }

            Root = root;
        }
コード例 #47
0
 public ServerTestLogic(Server.MtaServer server, IElementRepository elementRepository, RootElement root, IResourceServer resourceServer)
 {
     this.server            = server;
     this.elementRepository = elementRepository;
     this.root           = root;
     this.resourceServer = resourceServer;
     this.SetupTestLogic();
 }
コード例 #48
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 alertController = UIAlertController.Create("Accessory", "Accessory clicked", UIAlertControllerStyle.Alert);
                alertController.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, (obj) => { }));
                window.RootViewController.PresentViewController(alertController, true, () => { });
            };
            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);
        }
コード例 #49
0
        public AutomationElement GetRoot(string appRootName)
        {
            var condition = new PropertyCondition(NameProperty, appRootName);

            return(RootElement.FindFirst(TreeScope.Children, condition));
        }
コード例 #50
0
 public DVCMenu() : base(UITableViewStyle.Plain, null)
 {
     Root = new RootElement("Maps Demo")
     {
         new Section("Map")
         {
             new StringElement("Basic Map", () => {
                 var ctrl = new BasicMapViewController();
                 NavigationController.PushViewController(ctrl, true);
             }),
             new StringElement("Map Types", () => {
                 var ctrl = new MapTypesViewController();
                 NavigationController.PushViewController(ctrl, true);
             }),
             new StringElement("Traffic Layer", () => {
                 var ctrl = new TrafficMapViewController();
                 NavigationController.PushViewController(ctrl, true);
             }),
             new StringElement("My Location", () => {
                 var ctrl = new MyLocationViewController();
                 NavigationController.PushViewController(ctrl, true);
             }),
             new StringElement("Gesture Control", () => {
                 var ctrl = new GestureControlViewController();
                 NavigationController.PushViewController(ctrl, true);
             })
         },
         new Section("Overlays")
         {
             new StringElement("Markers", () => {
                 var ctrl = new MarkersViewController();
                 NavigationController.PushViewController(ctrl, true);
             }),
             new StringElement("Custom Markers", () => {
                 var ctrl = new CustomMarkersViewController();
                 NavigationController.PushViewController(ctrl, true);
             }),
             new StringElement("Marker Events", () => {
                 var ctrl = new MarkerEventsViewController();
                 NavigationController.PushViewController(ctrl, true);
             }),
             new StringElement("Polygons", () => {
                 var ctrl = new PolygonsViewController();
                 NavigationController.PushViewController(ctrl, true);
             }),
             new StringElement("Polylines", () => {
                 var ctrl = new PolylinesViewController();
                 NavigationController.PushViewController(ctrl, true);
             }),
             new StringElement("Ground Overlays", () => {
                 var ctrl = new GroundOverlayViewController();
                 NavigationController.PushViewController(ctrl, true);
             })
         },
         new Section("Camera")
         {
             new StringElement("Fit Bounds", () => {
                 var ctrl = new FitBoundsViewController();
                 NavigationController.PushViewController(ctrl, true);
             }),
             new StringElement("Camera Animation", () => {
                 var ctrl = new CameraViewController();
                 NavigationController.PushViewController(ctrl, true);
             }),
             new StringElement("Map Layer", () => {
                 var ctrl = new MapLayerViewController();
                 NavigationController.PushViewController(ctrl, true);
             })
         },
         new Section("Services")
         {
             new StringElement("Geocoder", () => {
                 var ctrl = new GeocoderViewController();
                 NavigationController.PushViewController(ctrl, true);
             })
         }
     };
 }
コード例 #51
0
        /*
         * private static void TesseractDownloadLangFile(String folder, String lang)
         * {
         *  String subfolderName = "tessdata";
         *  String folderName = System.IO.Path.Combine(folder, subfolderName);
         *  if (!System.IO.Directory.Exists(folderName))
         *  {
         *      System.IO.Directory.CreateDirectory(folderName);
         *  }
         *  String dest = System.IO.Path.Combine(folderName, String.Format("{0}.traineddata", lang));
         *  if (!System.IO.File.Exists(dest))
         *      using (System.Net.WebClient webclient = new System.Net.WebClient())
         *      {
         *          String source =
         *              String.Format("https://github.com/tesseract-ocr/tessdata/blob/4592b8d453889181e01982d22328b5846765eaad/{0}.traineddata?raw=true", lang);
         *
         *          Console.WriteLine(String.Format("Downloading file from '{0}' to '{1}'", source, dest));
         *          webclient.DownloadFile(source, dest);
         *          Console.WriteLine(String.Format("Download completed"));
         *      }
         * }*/

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            RootElement root = Root;

            root.UnevenRows = true;
            UIImageView   imageView      = new UIImageView(View.Frame);
            StringElement messageElement = new StringElement("");
            StringElement licenseElement = new StringElement("");

            root.Add(new Section()
            {
                new StyledStringElement("Process", delegate
                {
                    String path = "tessdata";

                    messageElement.Value = String.Format("Checking Tesseract language data...");
                    try
                    {
                        LicensePlateDetector.TesseractDownloadLangFile(path, "eng");
                        LicensePlateDetector.TesseractDownloadLangFile(path, "osd");
                    }
                    catch (System.Net.WebException webExcpt)
                    {
                        messageElement.Value =
                            String.Format(
                                "Failed to download Tesseract language file, please check internet connection.");
                        return;
                    }
                    catch (Exception e)
                    {
                        messageElement.Value = e.Message;
                        return;
                    }
                    messageElement.Value = String.Format("Checking Tesseract language data...");

                    using (Image <Bgr, Byte> image = new Image <Bgr, byte>("license-plate.jpg"))
                    {
                        LicensePlateDetector detector = new LicensePlateDetector(path);
                        Stopwatch watch = Stopwatch.StartNew(); // time the detection process

                        List <IInputOutputArray> licensePlateImagesList         = new List <IInputOutputArray>();
                        List <IInputOutputArray> filteredLicensePlateImagesList = new List <IInputOutputArray>();
                        List <RotatedRect> licenseBoxList = new List <RotatedRect>();
                        List <string> words = detector.DetectLicensePlate(
                            image,
                            licensePlateImagesList,
                            filteredLicensePlateImagesList,
                            licenseBoxList);

                        watch.Stop(); //stop the timer
                        messageElement.Value = String.Format("{0} milli-seconds", watch.Elapsed.TotalMilliseconds);

                        StringBuilder builder = new StringBuilder();
                        foreach (String w in words)
                        {
                            builder.AppendFormat("{0} ", w);
                        }
                        licenseElement.Value = builder.ToString();

                        messageElement.GetImmediateRootElement().Reload(messageElement, UITableViewRowAnimation.Automatic);
                        licenseElement.GetImmediateRootElement().Reload(licenseElement, UITableViewRowAnimation.Automatic);
                        foreach (RotatedRect box in licenseBoxList)
                        {
                            image.Draw(box, new Bgr(Color.Red), 2);
                        }
                        Size frameSize = FrameSize;
                        using (Mat resized = new Mat())
                        {
                            CvInvoke.ResizeForFrame(image, resized, frameSize);
                            imageView.Image = resized.ToUIImage();
                            imageView.Frame = new RectangleF(PointF.Empty, resized.Size);
                        }
                        imageView.SetNeedsDisplay();
                        ReloadData();
                    }
                }
                                        )
            });
            root.Add(new Section("Recognition Time")
            {
                messageElement
            });
            root.Add(new Section("License Plate")
            {
                licenseElement
            });
            root.Add(new Section()
            {
                imageView
            });
        }
コード例 #52
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            var root = new RootElement("Xamarin.Social Sample");

            var section = new Section("Services");

            var facebookButton = new StringElement("Share with Facebook");

            facebookButton.Tapped += delegate
            {
                try
                {
                    Share(Facebook, facebookButton);
                }
                catch (Exception ex)
                {
                    ShowMessage("Facebook: " + ex.Message);
                }
            };
            section.Add(facebookButton);

            var twitterButton = new StringElement("Share with Twitter");

            twitterButton.Tapped += delegate
            {
                try
                {
                    Share(Twitter, twitterButton);
                }
                catch (Exception ex)
                {
                    ShowMessage("Twitter: " + ex.Message);
                }
            };
            section.Add(twitterButton);

            var twitter5Button = new StringElement("Share with built-in Twitter");

            twitter5Button.Tapped += delegate
            {
                try
                {
                    Share(Twitter5, twitter5Button);
                }
                catch (Exception ex)
                {
                    ShowMessage("Twitter5: " + ex.Message);
                }
            };
            section.Add(twitter5Button);

            var flickr = new StringElement("Share with Flickr");

            flickr.Tapped += () => {
                var picker = new MediaPicker();                 // Set breakpoint here
                picker.PickPhotoAsync().ContinueWith(t =>
                {
                    if (t.IsCanceled)
                    {
                        return;
                    }

                    var item = new Item("I'm sharing great things using Xamarin!")
                    {
                        Images = new[] { new ImageData(t.Result.Path) }
                    };

                    Console.WriteLine("Picked image {0}", t.Result.Path);

                    UIViewController viewController = Flickr.GetShareUI(item, shareResult =>
                    {
                        dialog.DismissViewController(true, null);
                        flickr.GetActiveCell().TextLabel.Text = "Flickr shared: " + shareResult;
                    });

                    dialog.PresentViewController(viewController, true, null);
                }, TaskScheduler.FromCurrentSynchronizationContext());
            };
            section.Add(flickr);
            root.Add(section);

            dialog = new DialogViewController(root);

            window = new UIWindow(UIScreen.MainScreen.Bounds);
            window.RootViewController = new UINavigationController(dialog);
            window.MakeKeyAndVisible();

            return(true);
        }
コード例 #53
0
ファイル: IssueEditView.cs プロジェクト: zhongyin/CodeHub
        public override void ViewDidLoad()
        {
            Title = "Edit Issue";

            base.ViewDidLoad();

            _hud = this.CreateHud();
            var vm = (IssueEditViewModel)ViewModel;

            NavigationItem.RightBarButtonItem = new UIBarButtonItem(Theme.CurrentTheme.SaveButton, UIBarButtonItemStyle.Plain, (s, e) => {
                View.EndEditing(true);
                vm.SaveCommand.Execute(null);
            });

            var title = new InputElement("Title", string.Empty, string.Empty);

            title.Changed += (object sender, EventArgs e) => vm.Title = title.Value;

            var assignedTo = new StyledStringElement("Responsible", "Unassigned", UITableViewCellStyle.Value1);

            assignedTo.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            assignedTo.Tapped   += () => vm.GoToAssigneeCommand.Execute(null);

            var milestone = new StyledStringElement("Milestone".t(), "None", UITableViewCellStyle.Value1);

            milestone.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            milestone.Tapped   += () => vm.GoToMilestonesCommand.Execute(null);

            var labels = new StyledStringElement("Labels".t(), "None", UITableViewCellStyle.Value1);

            labels.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            labels.Tapped   += () => vm.GoToLabelsCommand.Execute(null);

            var content = new MultilinedElement("Description");

            content.Tapped += () =>
            {
                var composer = new MarkdownComposerViewController {
                    Title = "Issue Description", Text = content.Value
                };
                composer.NewComment(this, (text) => {
                    vm.Content = text;
                    composer.CloseComposer();
                });
            };

            var state = new TrueFalseElement("Open", true);

            state.ValueChanged += (sender, e) => vm.IsOpen = state.Value;

            vm.Bind(x => x.Title, x => title.Value = x, true);

            vm.Bind(x => x.Content, x => content.Value = x, true);

            vm.Bind(x => x.AssignedTo, x => {
                assignedTo.Value = x == null ? "Unassigned" : x.Login;
                if (assignedTo.GetImmediateRootElement() != null)
                {
                    Root.Reload(assignedTo, UITableViewRowAnimation.None);
                }
            }, true);

            vm.Bind(x => x.Milestone, x => {
                milestone.Value = x == null ? "None" : x.Title;
                if (assignedTo.GetImmediateRootElement() != null)
                {
                    Root.Reload(milestone, UITableViewRowAnimation.None);
                }
            }, true);

            vm.BindCollection(x => x.Labels, x => {
                labels.Value = vm.Labels.Items.Count == 0 ? "None" : string.Join(", ", vm.Labels.Items.Select(i => i.Name));
                if (assignedTo.GetImmediateRootElement() != null)
                {
                    Root.Reload(labels, UITableViewRowAnimation.None);
                }
            }, true);

            vm.Bind(x => x.IsOpen, x =>
            {
                state.Value = x;
                if (assignedTo.GetImmediateRootElement() != null)
                {
                    Root.Reload(state, UITableViewRowAnimation.None);
                }
            }, true);

            vm.Bind(x => x.IsSaving, x =>
            {
                if (x)
                {
                    _hud.Show("Updating...");
                }
                else
                {
                    _hud.Hide();
                }
            });

            Root = new RootElement(Title)
            {
                new Section {
                    title, assignedTo, milestone, labels
                }, new Section {
                    state
                }, new Section {
                    content
                }
            };
        }
コード例 #54
0
 /// <summary>
 ///     Creates a new DialogViewController from a RootElement and sets the push status
 /// </summary>
 /// <param name="root">
 /// The <see cref="RootElement"/> containing the information to render.
 /// </param>
 /// <param name="pushing">
 /// A <see cref="System.Boolean"/> describing whether this is being pushed
 /// (NavigationControllers) or not.   If pushing is true, then the back button
 /// will be shown, allowing the user to go back to the previous controller
 /// </param>
 public DialogViewController(RootElement root, bool pushing) : base(UITableViewStyle.Grouped)
 {
     this.pushing = pushing;
     this.root    = root;
 }
コード例 #55
0
        public override void ViewWillAppear(bool animated)
        {
            var root           = new RootElement(Title);
            var currentAccount = Application.Account;

            root.Add(new Section(string.Empty, "If disabled, CodeHub will prompt you for your password when you switch to this account".t())
            {
                new TrueFalseElement("Remember Credentials".t(), !currentAccount.DontRemember, (e) => {
                    currentAccount.DontRemember = !e.Value;
                    Application.Accounts.Update(currentAccount);
                })
            });

            root.Add(new Section(string.Empty, "If enabled, your teams will be shown in the CodeHub slideout menu under Events".t())
            {
                new TrueFalseElement("Show Organizations in Events".t(), currentAccount.ShowOrganizationsInEvents, (e) => {
                    currentAccount.ShowOrganizationsInEvents = e.Value;
                    Application.Accounts.Update(currentAccount);
                })
            });

            root.Add(new Section(string.Empty, "If enabled, every organization will be listed under Organizations".t())
            {
                new TrueFalseElement("List Organizations".t(), currentAccount.ExpandOrganizations, (e) => {
                    currentAccount.ExpandOrganizations = e.Value;
                    Application.Accounts.Update(currentAccount);
                })
            });

            root.Add(new Section(string.Empty, "If enabled, repository descriptions will be shown in the list of repositories".t())
            {
                new TrueFalseElement("Show Repo Descriptions".t(), currentAccount.ShowRepositoryDescriptionInList, (e) => {
                    currentAccount.ShowRepositoryDescriptionInList = e.Value;
                    Application.Accounts.Update(currentAccount);
                })
            });

            root.Add(new Section(string.Empty, "If enabled, send anonymous usage statistics to build a better app".t())
            {
                new TrueFalseElement("Send Anonymous Usage".t(), MonoTouch.Utilities.AnalyticsEnabled, (e) => {
                    MonoTouch.Utilities.AnalyticsEnabled = e.Value;
                })
            });

            if (Application.ClientCache != null)
            {
                var totalCacheSize   = Application.ClientCache.Sum(x => System.IO.File.Exists(x.Path) ? new System.IO.FileInfo(x.Path).Length : 0);
                var totalCacheSizeMB = ((float)totalCacheSize / 1024f / 1024f).ToString("0.##");
                var cacheSection     = new Section(string.Empty, string.Format("{0} MB of cache".t(), totalCacheSizeMB));
                cacheSection.Add(new StyledStringElement("Delete Cache".t(), () =>
                {
                    Application.ClientCache.DeleteAll();
                    cacheSection.Footer = string.Format("{0} MB of cache".t(), 0);
                    ReloadData();
                }));
                root.Add(cacheSection);
            }

            //Assign the root
            Root = root;

            base.ViewWillAppear(animated);
        }
コード例 #56
0
 public DialogViewController(UITableViewStyle style, RootElement root) : base(style)
 {
     Style     = style;
     this.root = root;
 }
コード例 #57
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            RootElement root = Root;


            Section examplesSection = new Section();

            StyledStringElement helloWorldElement = new StyledStringElement("Hello world");

            helloWorldElement.Tapped += () => {
                NavigationController.PushViewController(
                    new HelloWorldUIViewController(),
                    true
                    );
            };
            examplesSection.Add(helloWorldElement);

            StyledStringElement planarSubdivisionElement = new StyledStringElement("Planar Subdivision");

            planarSubdivisionElement.Tapped += () => {
                NavigationController.PushViewController(
                    new PlanarSubdivisionDialogViewController(),
                    true
                    );
            };
            examplesSection.Add(planarSubdivisionElement);

            StyledStringElement faceDetectionElement = new StyledStringElement("Face Detection");

            faceDetectionElement.Tapped += () => {
                NavigationController.PushViewController(
                    new FaceDetectionDialogViewController(),
                    true
                    );
            };
            examplesSection.Add(faceDetectionElement);

            StyledStringElement featureMatchingElement = new StyledStringElement("Feature Matching");

            featureMatchingElement.Tapped += () => {
                NavigationController.PushViewController(
                    new FeatureMatchingDialogViewController(),
                    true
                    );
            };
            examplesSection.Add(featureMatchingElement);

            StyledStringElement pedestrianDetectionElement = new StyledStringElement("Pedestrian Detection");

            pedestrianDetectionElement.Tapped += () => {
                NavigationController.PushViewController(
                    new PedestrianDetectionDialogViewController(),
                    true
                    );
            };
            examplesSection.Add(pedestrianDetectionElement);


            StyledStringElement cameraElement = new StyledStringElement("Camera");

            cameraElement.Tapped += () => {
                NavigationController.PushViewController(
                    new CameraDialogViewController(),
                    true);
            };
            examplesSection.Add(cameraElement);

            root.Add(examplesSection);
        }
コード例 #58
0
 public DialogViewController(RootElement root) : base(UITableViewStyle.Grouped)
 {
     this.root = root;
 }
コード例 #59
0
		public override void ViewDidLoad ()
		{			
			//Create a new instance of our scanner
			scanner = new MobileBarcodeScanner(this.NavigationController);

            Root = new RootElement ("ZXing.Net.Mobile") {
                new Section {
                    
                    new StyledStringElement ("Scan with Default View", async () => {
                        //Tell our scanner to use the default overlay
                        scanner.UseCustomOverlay = false;
                        //We can customize the top and bottom text of the default overlay
                        scanner.TopText = "Hold camera up to barcode to scan";
                        scanner.BottomText = "Barcode will automatically scan";

                        //Start scanning
                        var result = await scanner.Scan ();

                        HandleScanResult(result);
                    }),

                    new StyledStringElement ("Scan Continuously", () => {
                        //Tell our scanner to use the default overlay
                        scanner.UseCustomOverlay = false;

                        //Tell our scanner to use our custom overlay
                        scanner.UseCustomOverlay = true;
                        scanner.CustomOverlay = customOverlay;


                        var opt = new MobileBarcodeScanningOptions ();
                        opt.DelayBetweenContinuousScans = 3000;

                        //Start scanning
                        scanner.ScanContinuously (opt, true, HandleScanResult);
                    }),

                    new StyledStringElement ("Scan with Custom View", async () => {
                        //Create an instance of our custom overlay
                        customOverlay = new CustomOverlayView();
                        //Wireup the buttons from our custom overlay
                        customOverlay.ButtonTorch.TouchUpInside += delegate {
                            scanner.ToggleTorch();      
                        };
                        customOverlay.ButtonCancel.TouchUpInside += delegate {
                            scanner.Cancel();
                        };

                        //Tell our scanner to use our custom overlay
                        scanner.UseCustomOverlay = true;
                        scanner.CustomOverlay = customOverlay;

                        var result = await scanner.Scan ();

                        HandleScanResult(result);
                    }),

                    new StyledStringElement ("Scan with AVCapture Engine", async () => {
                        //Tell our scanner to use the default overlay
                        scanner.UseCustomOverlay = false;
                        //We can customize the top and bottom text of the default overlay
                        scanner.TopText = "Hold camera up to barcode to scan";
                        scanner.BottomText = "Barcode will automatically scan";

                        //Start scanning
                        var result = await scanner.Scan (true);

                        HandleScanResult (result);  
                    }),

                    new StyledStringElement ("Generate Barcode", () => {
                        NavigationController.PushViewController (new ImageViewController (), true);
                    })
                }
            };
		}
コード例 #60
0
        public Pubnub_MessagingMain() : base(UITableViewStyle.Grouped, null)
        {
            UIView labelView   = new UIView(new RectangleF(0, 0, this.View.Bounds.Width, 24));
            int    left        = 20;
            string hardwareVer = DeviceHardware.Version.ToString().ToLower();

            if (hardwareVer.IndexOf("ipad") >= 0)
            {
                left = 55;
            }

            labelView.AddSubview(new UILabel(new RectangleF(left, 10, this.View.Bounds.Width - left, 24))
            {
                Font            = UIFont.BoldSystemFontOfSize(16),
                BackgroundColor = UIColor.Clear,
                TextColor       = UIColor.FromRGB(76, 86, 108),
                Text            = "Basic Settings"
            });

            var headerMultipleChannels = new UILabel(new RectangleF(0, 0, this.View.Bounds.Width, 24))
            {
                Font            = UIFont.SystemFontOfSize(12),
                TextColor       = UIColor.Brown,
                BackgroundColor = UIColor.Clear,
                TextAlignment   = UITextAlignment.Center
            };

            headerMultipleChannels.Text = "Enter multiple channel names separated by comma";

            EntryElement entryChannelName = new EntryElement("Channel(s)", "Enter Channel Name", "");

            entryChannelName.AutocapitalizationType = UITextAutocapitalizationType.None;
            entryChannelName.AutocorrectionType     = UITextAutocorrectionType.No;

            EntryElement entryCipher = new EntryElement("Cipher", "Enter Cipher", "");

            entryCipher.AutocapitalizationType = UITextAutocapitalizationType.None;
            entryCipher.AutocorrectionType     = UITextAutocorrectionType.No;

            EntryElement entryProxyServer = new EntryElement("Server", "Enter Server", "");

            entryProxyServer.AutocapitalizationType = UITextAutocapitalizationType.None;
            entryProxyServer.AutocorrectionType     = UITextAutocorrectionType.No;

            EntryElement entryProxyPort = new EntryElement("Port", "Enter Port", "");

            EntryElement entryProxyUser = new EntryElement("Username", "Enter Username", "");

            entryProxyUser.AutocapitalizationType = UITextAutocapitalizationType.None;
            entryProxyUser.AutocorrectionType     = UITextAutocorrectionType.No;

            EntryElement entryProxyPassword = new EntryElement("Password", "Enter Password", "", true);

            EntryElement entryCustonUuid = new EntryElement("CustomUuid", "Enter Custom UUID", "");

            entryCustonUuid.AutocapitalizationType = UITextAutocapitalizationType.None;
            entryCustonUuid.AutocorrectionType     = UITextAutocorrectionType.No;

            BooleanElement proxyEnabled = new BooleanElement("Proxy", false);

            BooleanElement sslEnabled = new BooleanElement("Enable SSL", false);

            Root = new RootElement("Pubnub Messaging")
            {
                new Section(labelView)
                {
                },
                new Section(headerMultipleChannels)
                {
                },
                new Section()
                {
                    entryChannelName,
                    sslEnabled
                },
                new Section("Enter cipher key for encryption. Leave blank for unencrypted transfer.")
                {
                    entryCipher
                },
                new Section("Enter custom UUID or leave blank to use the default UUID")
                {
                    entryCustonUuid
                },
                new Section()
                {
                    new RootElement("Proxy Settings", 0, 0)
                    {
                        new Section()
                        {
                            proxyEnabled
                        },
                        new Section("Configuration")
                        {
                            entryProxyServer,
                            entryProxyPort,
                            entryProxyUser,
                            entryProxyPassword
                        },
                    }
                },
                new Section()
                {
                    new StyledStringElement("Launch Example", () => {
                        bool errorFree = true;
                        errorFree      = ValidateAndInitPubnub(entryChannelName.Value, entryCipher.Value, sslEnabled.Value,
                                                               entryCustonUuid.Value, proxyEnabled.Value, entryProxyPort.Value,
                                                               entryProxyUser.Value, entryProxyServer.Value, entryProxyPassword.Value
                                                               );

                        if (errorFree)
                        {
                            new Pubnub_MessagingSub(entryChannelName.Value, entryCipher.Value, sslEnabled.Value, pubnub);
                        }
                    })
                    {
                        BackgroundColor = UIColor.Blue,
                        TextColor       = UIColor.White,
                        Alignment       = UITextAlignment.Center
                    },
                },

                /*new Section()
                 * {
                 *  new StyledStringElement ("Launch Speed Test", () => {
                 *      bool errorFree = true;
                 *      errorFree = ValidateAndInitPubnub(entryChannelName.Value, entryCipher.Value, sslEnabled.Value,
                 *                                        entryCustonUuid.Value, proxyEnabled.Value, entryProxyPort.Value,
                 *                                        entryProxyUser.Value, entryProxyServer.Value, entryProxyPassword.Value
                 *                                        );
                 *
                 *      if(errorFree)
                 *      {
                 *          new Pubnub_MessagingSpeedTest(entryChannelName.Value, entryCipher.Value, sslEnabled.Value, pubnub);
                 *      }
                 *  })
                 *  {
                 *      BackgroundColor = UIColor.Blue,
                 *      TextColor = UIColor.White,
                 *      Alignment = UITextAlignment.Center
                 *  },
                 * }*/
            };
        }