コード例 #1
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			//UI that must be setup from code
			View.BackgroundColor = Theme.BackgroundColor;
			title = new UILabel (new RectangleF (0, 0, 100, 36)) { 
				TextColor = UIColor.White,
				BackgroundColor = UIColor.Clear,
				Font = Theme.BoldFontOfSize (16),
				Text = "Items",
			};
			titleButton = new UIBarButtonItem (title);
			toolbar.Items = new UIBarButtonItem[] { titleButton };

			var textAttributes = new UITextAttributes { TextColor = UIColor.White };
			edit = new UIBarButtonItem ("Edit", UIBarButtonItemStyle.Bordered, delegate {
				edit.Title = tableView.Editing ? "Edit" : "Done";
				tableView.SetEditing (!tableView.Editing, true);
			});
			edit.SetTitleTextAttributes (textAttributes, UIControlState.Normal);
			edit.SetBackgroundImage (Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

			space = new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace);

			addItem = new UIBarButtonItem ("Add Item", UIBarButtonItemStyle.Bordered, OnAddItem);
			addItem.SetTitleTextAttributes (textAttributes, UIControlState.Normal);
			addItem.SetBackgroundImage (Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

			tableView.Source = new TableSource (this);
		}
コード例 #2
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			//UI setup from code
			cancel.SetTitleTextAttributes (new UITextAttributes() { TextColor = UIColor.White }, UIControlState.Normal);
			
			var label = new UILabel (new CGRect(0, 0, 80, 36)) { 
				Text = "Labor",
				TextColor = UIColor.White,
				BackgroundColor = UIColor.Clear,
				Font = Theme.BoldFontOfSize (18),
			};
			labor = new UIBarButtonItem(label);

			done = new UIBarButtonItem("Done", UIBarButtonItemStyle.Bordered, (sender, e) => {
				laborViewModel
					.SaveLaborAsync (assignmentViewModel.SelectedAssignment, laborViewModel.SelectedLabor)
					.ContinueWith (_ => BeginInvokeOnMainThread (() => DismissViewController (true, null)));
			});
			done.SetTitleTextAttributes (new UITextAttributes() { TextColor = UIColor.White }, UIControlState.Normal);
			done.SetBackgroundImage (Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);
			
			space1 = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
			space2 = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);

			tableView.Source = 
				tableSource = new TableSource();
		}
コード例 #3
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			//UI that has to be setup from code
			View.BackgroundColor = Theme.BackgroundColor;
			descriptionBackground.Image = Theme.RowEnd;
			itemsBackground.Image = 
				hoursBackground.Image = 
				expensesBackground.Image = Theme.Inlay;
			itemsLabel.TextColor =
				items.TextColor =
				hoursLabel.TextColor = 
				hours.TextColor =
				expensesLabel.TextColor =
				expenses.TextColor = UIColor.White;
			description.TextColor =
				descriptionTitle.TextColor = Theme.LabelColor;

			//Setup our toolbar
			var label = new UILabel (new RectangleF(0, 0, 100, 36)) { 
				Text = "Description",
				TextColor = UIColor.White,
				BackgroundColor = UIColor.Clear,
				Font = Theme.BoldFontOfSize (16),
			};
			descriptionButton = new UIBarButtonItem(label);

			viewHistory = new UIBarButtonItem("View History", UIBarButtonItemStyle.Bordered, (sender, e) => {
				var menuViewModel = ServiceContainer.Resolve<MenuViewModel>();
				menuViewModel.MenuIndex = SectionIndex.History;
			});
			viewHistory.SetTitleTextAttributes (new UITextAttributes { TextColor = UIColor.White }, UIControlState.Normal);
			viewHistory.SetBackgroundImage (Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);
		}
コード例 #4
0
        public static void SetBarButtonItemAppearance(UIBarButtonItem.UIBarButtonItemAppearance appearance, UIColor color, UIColor highlightedColor, UIColor textColor, float cornerRadius, float borderWidth)
        {
            UIImage backButtonPortraitImage = FlatUI.BackButtonImage(color,
                                                                     UIBarMetrics.Default,
                                                                     cornerRadius,
                                                                     color.Darken(2),
                                                                     borderWidth);
            UIImage highlightedBackButtonPortraitImage = FlatUI.BackButtonImage(highlightedColor,
                                                                                UIBarMetrics.Default,
                                                                                cornerRadius,
                                                                                highlightedColor.Darken(2),
                                                                                borderWidth);
            UIImage backButtonLandscapeImage = FlatUI.BackButtonImage(color,
                                                                      UIBarMetrics.LandscapePhone,
                                                                      cornerRadius,
                                                                      color.Darken(2),
                                                                      borderWidth);
            UIImage highlightedBackButtonLandscapeImage = FlatUI.BackButtonImage(highlightedColor,
                                                                                 UIBarMetrics.LandscapePhone,
                                                                                 cornerRadius,
                                                                                 highlightedColor.Darken(2),
                                                                                 borderWidth);

            appearance.SetBackButtonBackgroundImage(backButtonPortraitImage, UIControlState.Normal, UIBarMetrics.Default);
            appearance.SetBackButtonBackgroundImage(backButtonLandscapeImage, UIControlState.Normal, UIBarMetrics.LandscapePhone);
            appearance.SetBackButtonBackgroundImage(highlightedBackButtonPortraitImage, UIControlState.Highlighted, UIBarMetrics.Default);
            appearance.SetBackButtonBackgroundImage(highlightedBackButtonLandscapeImage, UIControlState.Highlighted, UIBarMetrics.LandscapePhone);

            appearance.SetBackButtonTitlePositionAdjustment(new UIOffset(1f, 1f), UIBarMetrics.Default);
            appearance.SetBackButtonTitlePositionAdjustment(new UIOffset(1f, 1f), UIBarMetrics.LandscapePhone);

            UIImage buttonImageNormal = FlatUI.Image(color, cornerRadius, color.Darken(2), borderWidth);
            UIImage buttonImageHighlighted = FlatUI.Image(highlightedColor, cornerRadius, highlightedColor.Darken(2), borderWidth);

            appearance.SetBackgroundImage(buttonImageNormal, UIControlState.Normal, UIBarMetrics.Default);
            appearance.SetBackgroundImage(buttonImageHighlighted, UIControlState.Highlighted, UIBarMetrics.Default);

            UITextAttributes titleTextAttributes = appearance.GetTitleTextAttributes(UIControlState.Normal);
            if (titleTextAttributes == null)
                titleTextAttributes = new UITextAttributes();
            titleTextAttributes.TextShadowColor = UIColor.Clear;
            titleTextAttributes.TextShadowOffset = new UIOffset(0, 0);
            titleTextAttributes.TextColor = textColor;
            titleTextAttributes.Font = FlatUI.FontOfSize(0);
            appearance.SetTitleTextAttributes(titleTextAttributes, UIControlState.Normal);
            appearance.SetTitleTextAttributes(titleTextAttributes, UIControlState.Highlighted);
        }
コード例 #5
0
 public static UIBarButtonItem CreateRightIconHeaderButton(this UIViewController controller, UIImage icon, UINavigationItem item)
 {
     var iconButton = new UIBarButtonItem ();
     iconButton.Image = icon;
     iconButton.SetBackgroundImage (new UIImage().Empty(), UIControlState.Normal, new UIBarMetrics ());
     iconButton.TintColor = UIColor.White;
     item.SetRightBarButtonItem (iconButton, true);
     return iconButton;
 }
コード例 #6
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			//UI setup from code
			description.ShouldReturn = t => {
				Save ();
				return false;
			};
			cancel.SetTitleTextAttributes (new UITextAttributes () { TextColor = UIColor.White }, UIControlState.Normal);
			cancel.SetBackgroundImage (Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);
			
			var label = new UILabel (new RectangleF (0, 0, 80, 36)) { 
				Text = "Photo",
				TextColor = UIColor.White,
				BackgroundColor = UIColor.Clear,
				Font = Theme.BoldFontOfSize (18),
			};
			var labor = new UIBarButtonItem (label);

			var done = new UIBarButtonItem ("Done", UIBarButtonItemStyle.Bordered, (sender, e) => Save ());
			done.SetTitleTextAttributes (new UITextAttributes () { TextColor = UIColor.White }, UIControlState.Normal);
			done.SetBackgroundImage (Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);
			
			toolbar.Items = new UIBarButtonItem[] {
				cancel,
				new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace),
				labor,
				new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace),
				done,
			};

			if (Theme.IsiOS7) {
				photo.Frame = photoFrame.Frame;

				date.Font = Theme.BoldFontOfSize (18);
				time.Font =
					deleteButton.Font = Theme.FontOfSize (18);

				deleteButton.SetTitleColor (Theme.RedColor, UIControlState.Normal);
			} else {
				descriptionBackground.Image = Theme.ModalInlay;
				photoFrame.Image = Theme.PhotoFrame;

				deleteButton.SetBackgroundImage (Theme.DeleteButton, UIControlState.Normal);
				deleteButton.SetTitleColor (UIColor.White, UIControlState.Normal);
			}
		}
コード例 #7
0
			public override void ViewDidLoad ()
			{
				base.ViewDidLoad ();

				cancel = new UIBarButtonItem("Cancel", UIBarButtonItemStyle.Bordered, (sender, e) => {
					controller.Dismiss (true);
				});
				cancel.SetTitleTextAttributes (new UITextAttributes { TextColor = UIColor.White }, UIControlState.Normal);
				cancel.SetBackgroundImage (Theme.DarkBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

				save = new UIBarButtonItem("Save", UIBarButtonItemStyle.Bordered, (sender, e) => {

					//If blank, return
					if (signatureView.IsBlank) {
						new UIAlertView(string.Empty, "No signature!", null, "Ok").Show ();
						return;
					}

					if (assignmentViewModel.Signature == null) {
						assignmentViewModel.Signature = new Data.Signature { AssignmentId = assignmentViewModel.SelectedAssignment.Id };
					}
					assignmentViewModel.Signature.Image = signatureView.GetImage ().ToByteArray ();

					assignmentViewModel.SaveSignatureAsync ()
						.ContinueWith (_ => {
							BeginInvokeOnMainThread (() => controller.Dismiss (true));
						});
				});

				save.SetTitleTextAttributes (new UITextAttributes { TextColor = UIColor.White }, UIControlState.Normal);
				save.SetBackgroundImage (Theme.DarkBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

				NavigationItem.LeftBarButtonItem = cancel;
				NavigationItem.RightBarButtonItem = save;
				NavigationController.NavigationBar.SetBackgroundImage (null, UIBarMetrics.Default);

				signatureView = new SignaturePadView(View.Frame)
				{
					AutoresizingMask = UIViewAutoresizing.All,
				};
				View.AddSubview (signatureView);
			}
コード例 #8
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			//UI to setup from code
			title = new UILabel (new RectangleF (0, 0, 160, 36)) { 
				TextColor = UIColor.White,
				BackgroundColor = UIColor.Clear,
				Font = Theme.BoldFontOfSize (16),
				Text = "Expenses",
			};
			titleButton = new UIBarButtonItem (title);
			toolbar.Items = new UIBarButtonItem[] { titleButton };

			var textAttributes = new UITextAttributes { TextColor = UIColor.White };
			edit = new UIBarButtonItem ("Edit", UIBarButtonItemStyle.Bordered, delegate {
				edit.Title = tableView.Editing ? "Edit" : "Done";
				tableView.SetEditing (!tableView.Editing, true);
			});
			edit.SetTitleTextAttributes (textAttributes, UIControlState.Normal);
			edit.SetBackgroundImage (Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

			space = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
			
			addItem = Theme.IsiOS7 ? 
			          new UIBarButtonItem(UIBarButtonSystemItem.Add, OnAddExpense) : 
			          new UIBarButtonItem ("Add Expense", UIBarButtonItemStyle.Bordered, OnAddExpense);
			addItem.SetTitleTextAttributes (textAttributes, UIControlState.Normal);
			addItem.SetBackgroundImage (Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

			tableView.Source = new TableSource (this);

			if (Theme.IsiOS7) {
				tableView.SeparatorStyle = UITableViewCellSeparatorStyle.SingleLine;
				addItem.TintColor = UIColor.White;
			} else {
				View.BackgroundColor = Theme.BackgroundColor;
			}
		}
コード例 #9
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //Setup some of our UI
            NavigationItem.LeftItemsSupplementBackButton = true;
            menu = new UIBarButtonItem("Menu", UIBarButtonItemStyle.Bordered, (sender, e) => ShowPopover());
            menu.SetBackgroundImage(Theme.DarkBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);
            hide = new UIBarButtonItem("Hide", UIBarButtonItemStyle.Bordered, (sender, e) => HidePopover());
            hide.SetBackgroundImage(Theme.DarkBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);
            SwitchOrientation(InterfaceOrientation, false);

            //Hook up our controllers
            detailsController = ChildViewControllers[0] as AssignmentDetailsController;
            menuController    = ChildViewControllers[1] as MenuController;

            detailsController.StatusChanged += (sender, e) => {
                menuController.UpdateAssignment();
            };
            detailsController.Completed += (sender, e) => {
                //Only perform the Seque if the screen is not already visible
                if (!detailsController.IsViewLoaded || detailsController.View.Window == null)
                {
                    PerformSegue("AssignmentDetails", this);
                }
            };
            menuController.MenuChanged += (sender, e) => {
                detailsController.SectionSelected(e.TableView, e.IndexPath, e.Animated);
            };
            menuController.AssignmentCompleted += (sender, e) => {
                //Only perform the Seque if the screen is not already visible
                if (!detailsController.IsViewLoaded || detailsController.View.Window == null)
                {
                    PerformSegue("AssignmentDetails", this);
                }
            };
            menuController.StatusChanged += (sender, e) => detailsController.UpdateAssignment();
        }
コード例 #10
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //UI setup from code
            cancel.SetTitleTextAttributes(new UITextAttributes()
            {
                TextColor = UIColor.White
            }, UIControlState.Normal);

            var label = new UILabel(new RectangleF(0, 0, 80, 36))
            {
                Text            = "Labor",
                TextColor       = UIColor.White,
                BackgroundColor = UIColor.Clear,
                Font            = Theme.BoldFontOfSize(18),
            };

            labor = new UIBarButtonItem(label);

            done = new UIBarButtonItem("Done", UIBarButtonItemStyle.Bordered, (sender, e) => {
                laborViewModel
                .SaveLaborAsync(assignmentViewModel.SelectedAssignment, laborViewModel.SelectedLabor)
                .ContinueWith(_ => BeginInvokeOnMainThread(() => DismissViewController(true, null)));
            });
            done.SetTitleTextAttributes(new UITextAttributes()
            {
                TextColor = UIColor.White
            }, UIControlState.Normal);
            done.SetBackgroundImage(Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

            space1 = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
            space2 = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);

            tableView.Source =
                tableSource  = new TableSource();
        }
コード例 #11
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			//UI setup from code
			cancel.SetTitleTextAttributes (new UITextAttributes() { TextColor = UIColor.White }, UIControlState.Normal);
			
			var label = new UILabel (new RectangleF(0, 0, 80, 36)) { 
				Text = "Expense",
				TextColor = UIColor.White,
				BackgroundColor = UIColor.Clear,
				Font = Theme.BoldFontOfSize (18),
			};
			expense = new UIBarButtonItem(label);

			done = new UIBarButtonItem("Done", UIBarButtonItemStyle.Bordered, (sender, e) => {
				//Save the expense
				var task = expenseViewModel.SaveExpenseAsync (assignmentViewModel.SelectedAssignment, expenseViewModel.SelectedExpense);
				//Save the photo if we need to
				if (expenseViewModel.Photo != null) {
					task = task
						.ContinueWith (_ => expenseViewModel.Photo.ExpenseId = expenseViewModel.SelectedExpense.Id)
						.ContinueWith (expenseViewModel.SavePhotoAsync ());
				}
				//Dismiss the controller after the other tasks
				task.ContinueWith (_ => BeginInvokeOnMainThread(() => DismissViewController (true, null)));
			});
			done.SetTitleTextAttributes (new UITextAttributes() { TextColor = UIColor.White }, UIControlState.Normal);
			done.SetBackgroundImage (Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

			space1 = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
			space2 = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
			
			tableView.Source = 
				tableSource = new TableSource();
		}
コード例 #12
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			//Setup some of our UI
			NavigationItem.LeftItemsSupplementBackButton = true;
			menu = new UIBarButtonItem("Menu", UIBarButtonItemStyle.Bordered, (sender, e) => ShowPopover ());
			menu.SetBackgroundImage (Theme.DarkBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);
			hide = new UIBarButtonItem("Hide", UIBarButtonItemStyle.Bordered, (sender, e) => HidePopover ());
			hide.SetBackgroundImage (Theme.DarkBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);
			SwitchOrientation (InterfaceOrientation, false);

			//Hook up our controllers
			detailsController = ChildViewControllers[0] as AssignmentDetailsController;
			menuController = ChildViewControllers[1] as MenuController;

			detailsController.StatusChanged += (sender, e) => {
				menuController.UpdateAssignment ();
			};
			detailsController.Completed += (sender, e) => {
				//Only perform the Seque if the screen is not already visible
				if (!detailsController.IsViewLoaded || detailsController.View.Window == null) {
					PerformSegue ("AssignmentDetails", this);
				}
			};
			menuController.MenuChanged += (sender, e) => {
				detailsController.SectionSelected (e.TableView, e.IndexPath, e.Animated);
			};
			menuController.AssignmentCompleted += (sender, e) => {
				//Only perform the Seque if the screen is not already visible
				if (!detailsController.IsViewLoaded || detailsController.View.Window == null) {
					PerformSegue ("AssignmentDetails", this);
				}
			};
			menuController.StatusChanged += (sender, e) => detailsController.UpdateAssignment ();
		}
コード例 #13
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //UI to setup from code
            View.BackgroundColor = Theme.BackgroundColor;
            title = new UILabel(new RectangleF(0, 0, 160, 36))
            {
                TextColor       = UIColor.White,
                BackgroundColor = UIColor.Clear,
                Font            = Theme.BoldFontOfSize(16),
                Text            = "Labor Hours",
            };
            titleButton   = new UIBarButtonItem(title);
            toolbar.Items = new UIBarButtonItem[] { titleButton };

            var textAttributes = new UITextAttributes()
            {
                TextColor = UIColor.White
            };

            edit = new UIBarButtonItem("Edit", UIBarButtonItemStyle.Bordered, delegate {
                edit.Title = tableView.Editing ? "Edit" : "Done";
                tableView.SetEditing(!tableView.Editing, true);
            });
            edit.SetTitleTextAttributes(textAttributes, UIControlState.Normal);
            edit.SetBackgroundImage(Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

            space = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);

            addItem = new UIBarButtonItem("Add Labor", UIBarButtonItemStyle.Bordered, OnAddLabor);
            addItem.SetTitleTextAttributes(textAttributes, UIControlState.Normal);
            addItem.SetBackgroundImage(Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

            tableView.Source = new TableSource(this);
        }
コード例 #14
0
            public override void ViewDidLoad()
            {
                base.ViewDidLoad();

                clear = new UIBarButtonItem("Clear", UIBarButtonItemStyle.Bordered, (sender, e) => {
                    signatureView.Clear();
                });
                clear.SetTitleTextAttributes(new UITextAttributes {
                    TextColor = UIColor.Blue
                }, UIControlState.Normal);
                clear.SetBackgroundImage(Theme.DarkBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

                cancel = new UIBarButtonItem("Cancel", UIBarButtonItemStyle.Bordered, (sender, e) => {
                    controller.Dismiss(true);
                });
                cancel.SetTitleTextAttributes(new UITextAttributes {
                    TextColor = UIColor.Blue
                }, UIControlState.Normal);
                cancel.SetBackgroundImage(Theme.DarkBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

                save = new UIBarButtonItem("Save", UIBarButtonItemStyle.Bordered, (sender, e) => {
                    //If blank, return
                    if (signatureView.IsBlank)
                    {
                        new UIAlertView(string.Empty, "No signature!", null, "Ok").Show();
                        return;
                    }

                    if (assignmentViewModel.Signature == null)
                    {
                        assignmentViewModel.Signature = new Data.Signature {
                            AssignmentId = assignmentViewModel.SelectedAssignment.Id
                        }
                    }
                    ;

                    assignmentViewModel.Signature.Image = signatureView.GetImage().ToByteArray();

                    assignmentViewModel.SaveSignatureAsync()
                    .ContinueWith(_ => {
                        BeginInvokeOnMainThread(() => controller.Dismiss(true));
                    });
                });

                save.SetTitleTextAttributes(new UITextAttributes {
                    TextColor = UIColor.Blue
                }, UIControlState.Normal);
                save.SetBackgroundImage(Theme.DarkBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

                NavigationItem.LeftBarButtonItem = cancel;
                NavigationItem.SetRightBarButtonItems(UIDevice.CurrentDevice.CheckSystemVersion(8, 0) ?
                                                      new UIBarButtonItem [] { save, clear } :
                                                      new UIBarButtonItem [] { save },
                                                      false);

                NavigationController.NavigationBar.SetBackgroundImage(null, UIBarMetrics.Default);

                signatureView = new SignaturePadView(View.Frame)
                {
                    AutoresizingMask = UIViewAutoresizing.All
                };

                View.AddSubview(signatureView);
            }
コード例 #15
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			//UI that has to be setup from code
			View.BackgroundColor = Theme.BackgroundColor;
			description.TextColor =
				descriptionTitle.TextColor = Theme.LabelColor;

			//Setup our toolbar
			var label = new UILabel (new CGRect(0, 0, 100, 36)) {
				Text = "Description",
				TextColor = UIColor.White,
				BackgroundColor = UIColor.Clear,
				Font = Theme.BoldFontOfSize (16),
			};
			descriptionButton = new UIBarButtonItem(label);

			viewHistory = new UIBarButtonItem("View History", UIBarButtonItemStyle.Bordered, (sender, e) => {
				var menuViewModel = ServiceContainer.Resolve<MenuViewModel>();
				menuViewModel.MenuIndex = SectionIndex.History;
			});
			viewHistory.SetTitleTextAttributes (new UITextAttributes { TextColor = UIColor.White }, UIControlState.Normal);
			viewHistory.SetBackgroundImage (Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

			if (Theme.IsiOS7) {
				descriptionBackground.BackgroundColor = UIColor.White;

				itemsLabel.Font =
					items.Font =
					hoursLabel.Font = 
					hours.Font =
					expensesLabel.Font =
					expenses.Font = Theme.FontOfSize (18);

				itemsLabel.TextColor =
					items.TextColor =
					hoursLabel.TextColor = 
					hours.TextColor =
					expensesLabel.TextColor =
					expenses.TextColor = Theme.LabelColor;

				itemsBackground.BackgroundColor = 
					hoursBackground.BackgroundColor = 
					expensesBackground.BackgroundColor = Theme.LightGrayColor;

				//Move backgrounds around to appear as lines
				var frame = itemsBackground.Frame;
				frame.X = 0;
				frame.Y += frame.Height - 1;
				frame.Height = 1;
				frame.Width = View.Frame.Width;
				itemsBackground.Frame = frame;

				frame = hoursBackground.Frame;
				frame.X = 0;
				frame.Y += frame.Height - 1;
				frame.Height = 1;
				frame.Width = View.Frame.Width;
				hoursBackground.Frame = frame;

				frame = expensesBackground.Frame;
				frame.X = 0;
				frame.Y += frame.Height - 1;
				frame.Height = 1;
				frame.Width = View.Frame.Width;
				expensesBackground.Frame = frame;

			} else {
				descriptionBackground.Image = Theme.RowEnd;

				itemsBackground.Image = 
					hoursBackground.Image = 
					expensesBackground.Image = Theme.Inlay;

				itemsLabel.TextColor =
					items.TextColor =
					hoursLabel.TextColor = 
					hours.TextColor =
					expensesLabel.TextColor =
					expenses.TextColor = UIColor.White;
			}
		}
コード例 #16
0
ファイル: WhiteTheme.cs プロジェクト: praeclarum/Praeclarum
		public static void Apply (UIBarButtonItem.UIBarButtonItemAppearance appearance, string options = null)
		{
			if (IsModern)
				return;

			var font = UIFont.FromName (BarButtonFontName, BarButtonFontSize);

			appearance.SetBackgroundImage (
				ButtonImage.Value,
				UIControlState.Normal,
				UIBarMetrics.Default);

			appearance.SetBackButtonBackgroundImage (
				BackButtonImage.Value,
				UIControlState.Normal,
				UIBarMetrics.Default);

			appearance.SetTitlePositionAdjustment (new UIOffset (0, 1), UIBarMetrics.Default);

			appearance.SetTitleTextAttributes (new UITextAttributes {
				TextColor = BarTextColor,
				TextShadowColor = BarButtonTextShadowColor,
				TextShadowOffset = BarButtonTextShadowOffset,
				Font = font,
			}, UIControlState.Normal);

			appearance.SetTitleTextAttributes (new UITextAttributes {
				TextColor = UIColor.FromWhiteAlpha (0.9f, 1),
				TextShadowColor = BarButtonTextShadowColor,
				TextShadowOffset = BarButtonTextShadowOffset,
				Font = font,
			}, UIControlState.Disabled);

			appearance.SetTitleTextAttributes (new UITextAttributes {
				TextColor = UIColor.White,
				TextShadowColor = BarButtonTextShadowColor,
				TextShadowOffset = BarButtonTextShadowOffset,
				Font = font,
			}, UIControlState.Highlighted);
		}
コード例 #17
0
ファイル: Theme.cs プロジェクト: tranuydu/prebuilt-apps
 /// <summary>
 /// Apply this theme to all views with the given appearance.
 /// </summary>
 /// <param name="options">
 /// "blue", or null
 /// </para>
 public static void Apply(UIBarButtonItem.UIBarButtonItemAppearance appearance, string options = null)
 {
     if (options == "blue") {
         appearance.SetBackgroundImage (blueBarButtonBackground.Value, UIControlState.Normal, UIBarMetrics.Default);
         appearance.SetBackButtonBackgroundImage (blueBackButtonBackBackground.Value, UIControlState.Normal, UIBarMetrics.Default);
     } else {
         appearance.SetBackgroundImage (barButtonBackground.Value, UIControlState.Normal, UIBarMetrics.Default);
         appearance.SetBackButtonBackgroundImage (backButtonBackBackground.Value, UIControlState.Normal, UIBarMetrics.Default);
     }
 }
コード例 #18
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //UI that has to be setup from code
            View.BackgroundColor           = Theme.BackgroundColor;
            description.TextColor          =
                descriptionTitle.TextColor = Theme.LabelColor;

            //Setup our toolbar
            var label = new UILabel(new CGRect(0f, 0f, 100f, 36f))
            {
                Text            = "Description",
                TextColor       = UIColor.White,
                BackgroundColor = UIColor.Clear,
                Font            = Theme.BoldFontOfSize(16f),
            };

            descriptionButton = new UIBarButtonItem(label);

            viewHistory = new UIBarButtonItem("View History", UIBarButtonItemStyle.Bordered, (sender, e) => {
                var menuViewModel       = ServiceContainer.Resolve <MenuViewModel>();
                menuViewModel.MenuIndex = SectionIndex.History;
            });

            viewHistory.SetTitleTextAttributes(new UITextAttributes {
                TextColor = UIColor.White
            }, UIControlState.Normal);
            viewHistory.SetBackgroundImage(Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

            if (!Theme.IsiOS7)
            {
                descriptionBackground.Image = Theme.RowEnd;

                itemsBackground.Image            =
                    hoursBackground.Image        =
                        expensesBackground.Image = Theme.Inlay;

                itemsLabel.TextColor                    =
                    items.TextColor                     =
                        hoursLabel.TextColor            =
                            hours.TextColor             =
                                expensesLabel.TextColor =
                                    expenses.TextColor  = UIColor.White;
                return;
            }

            descriptionBackground.BackgroundColor = UIColor.White;

            itemsLabel.Font                    =
                items.Font                     =
                    hoursLabel.Font            =
                        hours.Font             =
                            expensesLabel.Font =
                                expenses.Font  = Theme.FontOfSize(18f);

            itemsLabel.TextColor                    =
                items.TextColor                     =
                    hoursLabel.TextColor            =
                        hours.TextColor             =
                            expensesLabel.TextColor =
                                expenses.TextColor  = Theme.LabelColor;

            itemsBackground.BackgroundColor            =
                hoursBackground.BackgroundColor        =
                    expensesBackground.BackgroundColor = Theme.LightGrayColor;

            //Move backgrounds around to appear as lines
            var frame = itemsBackground.Frame;

            frame.X               = 0f;
            frame.Y              += frame.Height - 1f;
            frame.Height          = 1f;
            frame.Width           = View.Frame.Width;
            itemsBackground.Frame = frame;

            frame                 = hoursBackground.Frame;
            frame.X               = 0f;
            frame.Y              += frame.Height - 1f;
            frame.Height          = 1f;
            frame.Width           = View.Frame.Width;
            hoursBackground.Frame = frame;

            frame                    = expensesBackground.Frame;
            frame.X                  = 0f;
            frame.Y                 += frame.Height - 1f;
            frame.Height             = 1f;
            frame.Width              = View.Frame.Width;
            expensesBackground.Frame = frame;
        }