Ejemplo n.º 1
0
    public MenuPage()
    {
        Icon = "settings.png";
        Title = "menu"; // The Title property must be set.
        BackgroundColor = Color.FromHex ("333333");

        Menu = new MenuListView ();

        var menuLabel = new ContentView {
            Padding = new Thickness (10, 36, 0, 5),
            Content = new Label {
                TextColor = Color.FromHex ("AAAAAA"),
                Text = "MENU",
            }
        };

        var layout = new StackLayout {
            Spacing = 0,
            VerticalOptions = LayoutOptions.FillAndExpand
        };
        layout.Children.Add (menuLabel);
        layout.Children.Add (Menu);

        Content = layout;
    }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the ContentViewDecorator class with view model and data context.
 /// </summary>
 /// <param name="model">The content view model.</param>
 /// <param name="dataContext">The data context object.</param>
 public ContentViewDecorator(ContentView model, IDataContext dataContext)
 {
     Model = model;
     model.CopyTo(this, "Parent", "FieldRefs", "Roles");
     Context = dataContext;
     this.Parent = new ContentListDecorator(dataContext, model.Parent);
 }
Ejemplo n.º 3
0
		protected override void Init ()
		{
			var rootGrid = new Grid {
				RowDefinitions = new RowDefinitionCollection
														  {
															 new RowDefinition { Height = new GridLength(1, GridUnitType.Star) },
															 new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) },
														 },
			};


			_mainContent = new ContentView { Content = new ScrollView { Content = new Label { Text = Description } } };
			rootGrid.AddChild (_mainContent, 0, 0);


			var buttons = new StackLayout { Orientation = StackOrientation.Horizontal };

			var button1A = new Button { Text = "View 1A" };
			button1A.Clicked += (sender, args) => ShowView (_view1A);
			buttons.Children.Add (button1A);

			var button1B = new Button { Text = "View 1B" };
			button1B.Clicked += (sender, args) => ShowView (_view1B);
			buttons.Children.Add (button1B);

			var button2 = new Button { Text = "View 2" };
			button2.Clicked += (sender, args) => ShowView (_view2);
			buttons.Children.Add (button2);

			rootGrid.AddChild (buttons, 0, 1);


			Content = rootGrid;
		}
Ejemplo n.º 4
0
		public RelativeLayoutGallery()
		{
			var layout = new RelativeLayout ();

			var box1 = new ContentView {
				BackgroundColor = Color.Gray,
				Content = new Label {
					Text = "0"
				}
			};

			double padding = 10;
			layout.Children.Add (box1, () => new Rectangle (((layout.Width + padding) % 60) / 2, padding, 50, 50));

			var last = box1;
			for (int i = 0; i < 200; i++) {
				var relativeTo = last; // local copy
				var box = new ContentView {
					BackgroundColor = Color.Gray,
					Content = new Label {
						Text = (i+1).ToString ()
					}
				};

				Func<View, bool> pastBounds = view => relativeTo.Bounds.Right + padding + relativeTo.Width > layout.Width;
				layout.Children.Add (box, () => new Rectangle (pastBounds (relativeTo) ? box1.X : relativeTo.Bounds.Right + padding,
													  pastBounds (relativeTo) ? relativeTo.Bounds.Bottom + padding : relativeTo.Y, 
													  relativeTo.Width, 
													  relativeTo.Height));

				last = box;
			}

			Content = new ScrollView {Content = layout, Padding = new Thickness(50)};
		}
Ejemplo n.º 5
0
		public void TestConstructor ()
		{
			var contentView = new ContentView ();

			Assert.Null (contentView.Content);
			Assert.AreEqual (Color.Default, contentView.BackgroundColor);
			Assert.AreEqual (new Thickness (0), contentView.Padding);
		}
Ejemplo n.º 6
0
		public Issue1228 ()
		{
			var grd = new Grid ();
		
			var layout = new StackLayout ();

			var picker = new Picker { BackgroundColor = Color.Pink };
			picker.Items.Add ("A");
			picker.Items.Add ("B");
			picker.Items.Add ("C");
			picker.Items.Add ("D");
			picker.Items.Add ("E");
			layout.Children.Add (picker);

			layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End });
			layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End });
			layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End });
			layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End });
			layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End });
			layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End });

			layout.Children.Add (new SearchBar {
				BackgroundColor = Color.Gray,
				CancelButtonColor = Color.Red
			});

			layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End });
			layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End });
			layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End });
			layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End });
			layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End });
			layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End });
			layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End });
			layout.Children.Add (new Editor { BackgroundColor = Color.Red, VerticalOptions = LayoutOptions.End });

			layout.Children.Add (new Entry { BackgroundColor = Color.Blue });
			layout.Children.Add (new SearchBar {
				BackgroundColor = Color.Gray,
				CancelButtonColor = Color.Red
			});
			grd.Children.Add (layout);
		

			Content = new ContentView { 
				Content = new ScrollView {
					Padding = new Thickness (0, 20, 0, 0),
					Orientation = ScrollOrientation.Vertical,
					Content = grd, 
					HeightRequest = 400, 
					VerticalOptions = LayoutOptions.Start
				},
				BackgroundColor = Color.Lime,
				HeightRequest = 400

			};
		}
Ejemplo n.º 7
0
    private void Awake()
    {
        contentRenderer = GetComponent<MeshRenderer>();
        if (!contentRenderer)
        {
            Destroy(this);
        }

        contentRoot = GetComponentInParent<ContentView>();
    }
Ejemplo n.º 8
0
        public InvokationBlockView(InvokationBlock model, BlockAttributes attribute, ContentView content)
        {
            this.model = model;
            this.content = content;
            this.attribute = attribute;

            Changed += delegate(object sender) { };
            content.Changed += new ViewChangedEvent(content_Changed);
            content.Parent = this;
            content.RelativePos = new Point(0, 0);

            Reassemble();
        }
Ejemplo n.º 9
0
		public ControlTemplatePage ()
		{
			var button = new Button { Text = "Replace Template" };
			var content = new ContentView {
				Content = button,
				ControlTemplate = new ControlTemplate (typeof (MyLayout))
			};

			button.Clicked += (sender, args) => {
				content.ControlTemplate = new ControlTemplate (typeof (MyOtherLayout));
			};

			Content = content;
		}
Ejemplo n.º 10
0
        public ProcDefView(ProcDefBlock model, ContentView surroundingContent,
        ContentView invokationContent)
        {
            this._model = model;
            this.surroundingContent = surroundingContent;
            this.invokationContent = invokationContent;

            Changed += delegate(object sender) { };

            surroundingContent.Changed += new ViewChangedEvent(content_Changed);
            surroundingContent.Parent = this;
            invokationContent.RelativePos = new Point(0, 0);

            Reassemble();
        }
Ejemplo n.º 11
0
		public void TestSetChild ()
		{
			var contentView = new ContentView ();

			var child1 = new Label ();

			bool added = false;

			contentView.ChildAdded += (sender, e) => added = true;

			contentView.Content = child1;

			Assert.True (added);
			Assert.AreEqual (child1, contentView.Content);

			added = false;
			contentView.Content = child1;

			Assert.False (added);
		}
Ejemplo n.º 12
0
		public Issue1777 ()
		{
			StackLayout stackLayout = new StackLayout();
			Content = stackLayout;

			TableView tableView = new TableView();
			stackLayout.Children.Add( tableView);

			TableRoot tableRoot = new TableRoot();
			tableView.Root = tableRoot;

			TableSection tableSection = new TableSection("Table");
			tableRoot.Add(tableSection);

			ViewCell viewCell = new ViewCell ();
			tableSection.Add (viewCell);

			ContentView contentView = new ContentView ();
			contentView.HorizontalOptions = LayoutOptions.FillAndExpand;
			viewCell.View = contentView;

			_pickerTable = new Picker ();
			_pickerTable.HorizontalOptions = LayoutOptions.FillAndExpand;
			contentView.Content = _pickerTable;

			Label label = new Label ();
			label.Text = "Normal";
			stackLayout.Children.Add (label);

			_pickerNormal = new Picker ();
			stackLayout.Children.Add (_pickerNormal);

			Button button = new Button ();
			button.Clicked += button_Clicked;
			button.Text = "do magic";
			stackLayout.Children.Add (button);

			//button_Clicked(button, EventArgs.Empty);
			_pickerTable.SelectedIndex = 0;
			_pickerNormal.SelectedIndex = 0;
		}
Ejemplo n.º 13
0
		public void TestReplaceChild ()
		{
			var contentView = new ContentView ();

			var child1 = new Label ();
			var child2 = new Label ();

			contentView.Content = child1;

			bool removed = false;
			bool added = false;

			contentView.ChildRemoved += (sender, e) => removed = true;
			contentView.ChildAdded += (sender, e) => added = true;

			contentView.Content = child2;

			Assert.True (removed);
			Assert.True (added);
			Assert.AreEqual (child2, contentView.Content);
		}
Ejemplo n.º 14
0
		protected override void Init ()
		{
			var boxview = new BoxView{ BackgroundColor = Color.Aqua, AutomationId = "Victory" };

			var contentView = new ContentView { 
				Content = boxview
			};

			contentView.SetBinding (IsVisibleProperty, Binding.Create<SampleViewModel> (t => t.IsContentVisible));

			var layout = new AbsoluteLayout {
				Children = { contentView }
			};

			Content = layout;

			var vm = new SampleViewModel ();

			BindingContext = vm;

			vm.IsContentVisible = true;
		}
        public MyReviewCellView(NSString cellId) : base(UITableViewCellStyle.Default, cellId)
        {
            try
            {
                btnBack = new UIButton();
                btnBack.BackgroundColor        = UIColor.FromRGB(63, 63, 63);
                btnBack.UserInteractionEnabled = false;
                SelectionStyle             = UITableViewCellSelectionStyle.Gray;
                imageView                  = new UIButton();
                imageView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
                imageView.ContentMode      = UIViewContentMode.Center;
                imageView.ClipsToBounds    = true;
                //imageView.TouchDown += (object sender, EventArgs e) =>
                //{
                //	BTProgressHUD.Show("Loading...");
                //};
                imageView.TouchUpInside += (object sender, EventArgs e) =>
                {
                    BTProgressHUD.Show(LoggingClass.txtloading);
                    NavController.PushViewController(new DetailViewController(WineIdLabel.Text, storeid.ToString(), false, true), false);
                };
                Review review = new Review();
                separator = new UIImageView();

                btnItemname = new UIButton();
                btnItemname.SetTitle("", UIControlState.Normal);
                btnItemname.SetTitleColor(UIColor.FromRGB(127, 51, 0), UIControlState.Normal);
                btnItemname.Font                = UIFont.FromName("Verdana-Bold", 13f);
                btnItemname.LineBreakMode       = UILineBreakMode.WordWrap;
                btnItemname.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;
                btnItemname.TouchUpInside      += delegate
                {
                    BTProgressHUD.Show("Loading...");
                    NavController.PushViewController(new DetailViewController(WineIdLabel.Text, storeid.ToString(), false, true), false);
                };
                ReviewDate = new UILabel()
                {
                    Font      = UIFont.FromName("AmericanTypewriter", 10f),
                    TextColor = UIColor.FromRGB(38, 127, 200),
                    //TextAlignment = UITextAlignment.Center,
                    BackgroundColor = UIColor.Clear
                };
                Comments = new UITextView()
                {
                    Font          = UIFont.FromName("AmericanTypewriter", 14f),
                    TextColor     = UIColor.FromRGB(55, 127, 0),
                    TextAlignment = UITextAlignment.Justified,
                    //TextAlignment = UITextAlignment.Natural,
                    BackgroundColor = UIColor.Clear,
                    //LineBreakMode = UILineBreakMode.WordWrap
                    Editable   = false,
                    Selectable = false
                };
                ReadMore = new UIButton()
                {
                    Font            = UIFont.FromName("Verdana", 10f),
                    BackgroundColor = UIColor.White
                };
                Vintage = new UILabel()
                {
                    Font            = UIFont.FromName("Verdana", 10f),
                    TextColor       = UIColor.FromRGB(127, 51, 100),
                    BackgroundColor = UIColor.Clear
                };
                decimal averageRating = 0.0m;
                var     ratingConfig  = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/star-silver2.png"),
                                                         filledImage: UIImage.FromBundle("Stars/star.png"),
                                                         chosenImage: UIImage.FromBundle("Stars/star.png"));
                stars   = new PDRatingView(new CGRect(110, 60, 60, 20), ratingConfig, averageRating);
                btnEdit = new UIButton();
                btnEdit.SetImage(UIImage.FromFile("edit.png"), UIControlState.Normal);
                btnEdit.TouchUpInside += (sender, e) =>
                {
                    PopupView yourController = new PopupView(WineIdLabel.Text, storeid);
                    yourController.NavController  = NavController;
                    yourController.parent         = Parent;
                    yourController.StartsSelected = stars.AverageRating;
                    yourController.Comments       = Comments.Text;
                    LoggingClass.LogInfo("Edited the review of " + wineId, screenid);


                    //yourController.WineId = Convert.ToInt32(WineIdLabel.Text);
                    yourController.ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext;
                    //this.PresentViewController(yourController, true, null);
                    Parent.PresentModalViewController(yourController, false);
                };
                btnDelete = new UIButton();
                btnDelete.SetImage(UIImage.FromFile("delete.png"), UIControlState.Normal);
                btnDelete.TouchUpInside += (sender, e) =>
                {
                    UIAlertView alert = new UIAlertView()
                    {
                        Title   = "Delete Review ",
                        Message = LoggingClass.txtdeletereview,
                    };
                    alert.AddButton("Yes");
                    alert.AddButton("No");

                    alert.Clicked += async(senderalert, buttonArgs) =>
                    {
                        if (buttonArgs.ButtonIndex == 0)
                        {
                            review.Barcode      = WineIdLabel.Text;
                            review.ReviewUserId = Convert.ToInt32(CurrentUser.RetreiveUserId());
                            BTProgressHUD.Show("Deleting review");
                            await sw.DeleteReview(review);

                            LoggingClass.LogInfo("Deleting the review of " + wineId, screenid);
                            BTProgressHUD.ShowSuccessWithStatus("Done");
                            ((IPopupParent)Parent).RefreshParent();
                        }
                    };

                    alert.Show();
                };
                btnLike = new UIButton();
                btnLike.ClipsToBounds              = true;
                btnLike.Layer.BorderColor          = UIColor.White.CGColor;
                btnLike.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;
                btnLike.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                btnLike.Tag = 0;
                //myItem = new Item();
                //bool count =Convert.ToBoolean( myItem.IsLike);
                //if (count == true)
                //{
                //btnLike.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);}
                //else
                //{
                //	btnLike.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                //}
                btnLike.TouchUpInside += async(object sender, EventArgs e) =>
                {
                    try
                    {
                        UIButton temp = (UIButton)sender;
                        if (temp.Tag == 0)
                        {
                            btnLike.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
                            temp.Tag   = 1;
                            Data.Liked = 1;
                            //btnLike.Tag = 1;
                            LoggingClass.LogInfo("Liked Wine " + WineIdLabel.Text, screenid);
                        }
                        else
                        {
                            btnLike.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                            temp.Tag   = 0;
                            Data.Liked = 0;

                            LoggingClass.LogInfo("Unliked Wine " + WineIdLabel.Text, screenid);
                        }
                        SKULike like = new SKULike();
                        like.UserID  = Convert.ToInt32(CurrentUser.RetreiveUserId());
                        like.BarCode = WineIdLabel.Text;
                        like.Liked   = Convert.ToBoolean(temp.Tag);

                        Data.Liked = Convert.ToInt32(temp.Tag);
                        await sw.InsertUpdateLike(like);
                    }
                    catch (Exception ex)
                    {
                        LoggingClass.LogError(ex.Message, screenid, ex.StackTrace);
                    }
                };
                WineIdLabel = new UILabel();
                ContentView.AddSubviews(new UIView[] { btnBack, btnItemname, ReadMore, ReviewDate, Comments, stars, imageView, Vintage, separator, btnEdit, btnDelete, btnLike });
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screenid, ex.StackTrace);
            }
        }
Ejemplo n.º 16
0
        private void BuildContentView(string contentTypeName, Node parent, ViewMode viewMode)
        {
            var viewPath = string.Empty;

            #region creates container)
            if (_container == null)
            {
                CreateContainer();
            }
            else
            {
                _container.Controls.Clear();
                //this.Controls.Remove(_container);
            }

            if (this._container.Parent == null)
            {
                this.Controls.Add(this._container);
            }
            #endregion

            #region creates new content or loads an existing one
            // when we are in InlineNew creates an empty content
            if (viewMode == ViewMode.InlineNew)
            {
                _content = SNC.Content.CreateNew(contentTypeName, parent, string.Empty);
            }

            // when the portlet is in browse, edit, inlineedit states, loads the content
            if (viewMode == ViewMode.Browse ||
                viewMode == ViewMode.Edit ||
                viewMode == ViewMode.InlineEdit)
            {
                Node node = Node.LoadNode(this.AbsoulteContentPath);

                // check if can select a single node (ie smartfolderex)
                ICustomSingleNode singleNode = node as ICustomSingleNode;

                // select single node
                if (singleNode != null)
                {
                    node = singleNode.SelectedItem();
                }

                if (node == null)
                {
                    _content = null;
                }
                else
                {
                    _content = SNC.Content.Create(node);
                }

                //_content = SNC.Content.Load(this.AbsoulteContentPath);
            }

            #endregion

            if (viewMode == ViewMode.InlineEdit || viewMode == ViewMode.Edit)
            {
                this._displayMode = GetViewModeName(ViewMode.Edit);
            }

            // if content does not exist stop creating controls.
            if (_content == null)
            {
                this._errorMessage = String.Format(HttpContext.GetGlobalResourceObject("SingleContentPortlet", "PathNotFound") as string, AbsoulteContentPath);
                return;
            }

            #region checks validity
            // if content is not valid, exit the method, and an empty contol will be shown to the user.

            if (User.Current.Id == User.Visitor.Id)
            {
                if (this.ValidationSetting != ValidationOption.DontCheckValidity)
                {
                    _validitySetting = GetValiditySetting(_content);
                    if (_validitySetting != null)
                    {
                        // User has been set the ValidationSetting,
                        // and checks the content will be displayed or not.
                        // if the content is not visible, just return (and don't do anything else)
                        // otherwise the content processing will be going on.
                        switch (this.ValidationSetting)
                        {
                        case ValidationOption.ShowAllValid:
                            if (!_validitySetting.ShowAllValidContent)
                            {
                                return;
                            }
                            break;

                        case ValidationOption.ShowValidButArchived:
                            if (!_validitySetting.ShowValidAndArchived)
                            {
                                return;
                            }
                            break;

                        case ValidationOption.ShowValidButNotArchived:
                            if (!_validitySetting.ShowValidAndNotArchived)
                            {
                                return;
                            }
                            break;

                        case ValidationOption.DontCheckValidity:        // not used
                        default:
                            break;
                        }
                    }
                }
            }
            #endregion


            viewPath = GetViewPath();


            // try to create ContentView which contains all webcontrols of the content
            try
            {
                if (this.UseUrlPath)
                {
                    _contentView = ContentView.Create(_content, this.Page, viewMode, String.IsNullOrEmpty(this.ContentViewPath) ? viewPath : this.ContentViewPath);
                }
                else
                {
                    _contentView = ContentView.Create(_content, this.Page, viewMode, viewPath);
                }

                _container.Controls.Remove(_contentView);
            }
            catch (Exception e) //logged
            {
                Logger.WriteException(e);
                this._errorMessage = String.Format("Message: {0} {1} Source: {2} {3} StackTrace: {4} {5}", e.Message, Environment.NewLine, e.Source, Environment.NewLine, e.StackTrace, Environment.NewLine);
                return;
            }

            _contentView.UserAction += new EventHandler <UserActionEventArgs>(_contentView_UserAction);
            _container.Controls.Add(_contentView);
        }
Ejemplo n.º 17
0
        public PickerTableViewCell(
            string labelName,
            nfloat?height = null)
            : base(UITableViewCellStyle.Default, nameof(PickerTableViewCell))
        {
            var descriptor = UIFontDescriptor.PreferredBody;
            var pointSize  = descriptor.PointSize;

            Label = new UILabel
            {
                Text = labelName,
                TranslatesAutoresizingMaskIntoConstraints = false,
                Font      = UIFont.FromDescriptor(descriptor, 0.8f * pointSize),
                TextColor = ThemeHelpers.MutedColor
            };

            ContentView.Add(Label);

            TextField = new NoCaretField
            {
                BorderStyle = UITextBorderStyle.None,
                TranslatesAutoresizingMaskIntoConstraints = false,
                Font            = UIFont.FromDescriptor(descriptor, pointSize),
                TextColor       = ThemeHelpers.TextColor,
                TintColor       = ThemeHelpers.TextColor,
                BackgroundColor = ThemeHelpers.BackgroundColor
            };

            if (!ThemeHelpers.LightTheme)
            {
                TextField.KeyboardAppearance = UIKeyboardAppearance.Dark;
            }

            var width   = (float)UIScreen.MainScreen.Bounds.Width;
            var toolbar = new UIToolbar(new RectangleF(0, 0, width, 44))
            {
                BarStyle    = UIBarStyle.Default,
                Translucent = true
            };
            var spacer     = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
            var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, (o, a) =>
            {
                var s = (PickerSource)Picker.Model;
                if (s.SelectedIndex == -1 && Items != null && Items.Count > 0)
                {
                    UpdatePickerSelectedIndex(0);
                }
                TextField.Text = s.SelectedItem;
                TextField.ResignFirstResponder();
            });

            toolbar.SetItems(new[] { spacer, doneButton }, false);

            TextField.InputView          = Picker;
            TextField.InputAccessoryView = toolbar;

            ContentView.Add(TextField);

            ContentView.AddConstraints(new NSLayoutConstraint[] {
                NSLayoutConstraint.Create(TextField, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Leading, 1f, 15f),
                NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, TextField, NSLayoutAttribute.Trailing, 1f, 15f),
                NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, TextField, NSLayoutAttribute.Bottom, 1f, 10f),
                NSLayoutConstraint.Create(TextField, NSLayoutAttribute.Top, NSLayoutRelation.Equal, Label, NSLayoutAttribute.Bottom, 1f, 10f),
                NSLayoutConstraint.Create(Label, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Leading, 1f, 15f),
                NSLayoutConstraint.Create(Label, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Top, 1f, 10f),
                NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, Label, NSLayoutAttribute.Trailing, 1f, 15f)
            });

            if (height.HasValue)
            {
                ContentView.AddConstraint(
                    NSLayoutConstraint.Create(TextField, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1f, height.Value));
            }

            Picker.Model = new PickerSource(this);
        }
Ejemplo n.º 18
0
        public LeadListHeaderView(Command newLeadTappedCommand)
        {
            _NewLeadTappedCommand = newLeadTappedCommand;

            #region title label
            Label headerTitleLabel = new Label()
            {
                Text                    = TextResources.Leads_LeadListHeaderTitle.ToUpperInvariant(),
                TextColor               = Palette._003,
                FontSize                = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                FontAttributes          = FontAttributes.Bold,
                HorizontalTextAlignment = TextAlignment.Start,
                VerticalTextAlignment   = TextAlignment.Center
            };
            #endregion

            #region new lead image "button"
            var newLeadImage = new Image
            {
                Source = new FileImageSource {
                    File = Device.OnPlatform("add_ios_gray", "add_android_gray", null)
                },
                Aspect            = Aspect.AspectFit,
                HorizontalOptions = LayoutOptions.EndAndExpand,
            };
            //Going to use FAB
            newLeadImage.IsVisible = false;
            newLeadImage.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = _NewLeadTappedCommand,
                NumberOfTapsRequired = 1
            });
            #endregion

            #region absolutLayout
            AbsoluteLayout absolutLayout = new AbsoluteLayout();

            absolutLayout.Children.Add(
                headerTitleLabel,
                new Rectangle(0, .5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize),
                AbsoluteLayoutFlags.PositionProportional);

            absolutLayout.Children.Add(
                newLeadImage,
                new Rectangle(1, .5, AbsoluteLayout.AutoSize, .5),
                AbsoluteLayoutFlags.PositionProportional | AbsoluteLayoutFlags.HeightProportional);
            #endregion

            #region setup contentView
            ContentView contentView = new ContentView()
            {
                Padding       = new Thickness(10, 0),           // give the content some padding on the left and right
                HeightRequest = RowSizes.MediumRowHeightDouble, // set the height of the content view
            };
            #endregion

            #region compose the view hierarchy
            contentView.Content = absolutLayout;
            #endregion

            Content = contentView;
        }
Ejemplo n.º 19
0
 private void InitializeComponent()
 {
     ResourceLoader.ResourceLoadingQuery resourceLoadingQuery = new ResourceLoader.ResourceLoadingQuery();
     resourceLoadingQuery.set_AssemblyName(typeof(EmptyView).GetTypeInfo().Assembly.GetName());
     resourceLoadingQuery.set_ResourcePath("Controls/EmptyView.xaml");
     resourceLoadingQuery.set_Instance((object)this);
     if (ResourceLoader.CanProvideContentFor(resourceLoadingQuery))
     {
         this.__InitComponentRuntime();
     }
     else if (XamlLoader.get_XamlFileProvider() != null && XamlLoader.get_XamlFileProvider()(((object)this).GetType()) != null)
     {
         this.__InitComponentRuntime();
     }
     else
     {
         BindingExtension        bindingExtension1   = new BindingExtension();
         Setter                  setter              = new Setter();
         DataTrigger             dataTrigger         = new DataTrigger(typeof(ContentView));
         StaticResourceExtension resourceExtension1  = new StaticResourceExtension();
         ReferenceExtension      referenceExtension1 = new ReferenceExtension();
         BindingExtension        bindingExtension2   = new BindingExtension();
         CachedImage             cachedImage         = new CachedImage();
         StaticResourceExtension resourceExtension2  = new StaticResourceExtension();
         ReferenceExtension      referenceExtension2 = new ReferenceExtension();
         BindingExtension        bindingExtension3   = new BindingExtension();
         Label label1 = new Label();
         ReferenceExtension      referenceExtension3 = new ReferenceExtension();
         BindingExtension        bindingExtension4   = new BindingExtension();
         StaticResourceExtension resourceExtension3  = new StaticResourceExtension();
         TranslateExtension      translateExtension1 = new TranslateExtension();
         Label       label2      = new Label();
         StackLayout stackLayout = new StackLayout();
         Frame       frame       = new Frame();
         EmptyView   emptyView;
         NameScope   nameScope = (NameScope)(NameScope.GetNameScope((BindableObject)(emptyView = this)) ?? (INameScope) new NameScope());
         NameScope.SetNameScope((BindableObject)emptyView, (INameScope)nameScope);
         ((INameScope)nameScope).RegisterName("View", (object)emptyView);
         if (((Element)emptyView).get_StyleId() == null)
         {
             ((Element)emptyView).set_StyleId("View");
         }
         this.View = (ContentView)emptyView;
         ((BindableObject)emptyView).SetValue((BindableProperty)VisualElement.IsVisibleProperty, new VisualElement.VisibilityConverter().ConvertFromInvariantString("False"));
         BindingBase bindingBase1 = ((IMarkupExtension <BindingBase>)bindingExtension1).ProvideValue((IServiceProvider)null);
         dataTrigger.set_Binding(bindingBase1);
         dataTrigger.set_Value((object)"0");
         setter.set_Property((BindableProperty)VisualElement.IsVisibleProperty);
         setter.set_Value((object)"True");
         setter.set_Value(new VisualElement.VisibilityConverter().ConvertFromInvariantString("True"));
         ((ICollection <Setter>)dataTrigger.get_Setters()).Add(setter);
         ((ICollection <TriggerBase>)((BindableObject)emptyView).GetValue((BindableProperty)VisualElement.TriggersProperty)).Add((TriggerBase)dataTrigger);
         ((BindableObject)frame).SetValue((BindableProperty)Xamarin.Forms.View.MarginProperty, (object)new Thickness(12.0));
         resourceExtension1.set_Key("AccentContrastColor");
         StaticResourceExtension resourceExtension4   = resourceExtension1;
         XamlServiceProvider     xamlServiceProvider1 = new XamlServiceProvider();
         Type     type1     = typeof(IProvideValueTarget);
         object[] objArray1 = new object[0 + 2];
         objArray1[0] = (object)frame;
         objArray1[1] = (object)emptyView;
         SimpleValueTargetProvider valueTargetProvider1;
         object obj1 = (object)(valueTargetProvider1 = new SimpleValueTargetProvider(objArray1, (object)VisualElement.BackgroundColorProperty, (INameScope)nameScope));
         xamlServiceProvider1.Add(type1, (object)valueTargetProvider1);
         xamlServiceProvider1.Add(typeof(IReferenceProvider), obj1);
         Type type2 = typeof(IXamlTypeResolver);
         XmlNamespaceResolver namespaceResolver1 = new XmlNamespaceResolver();
         namespaceResolver1.Add("", "http://xamarin.com/schemas/2014/forms");
         namespaceResolver1.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
         namespaceResolver1.Add("extensions", "clr-namespace:Ekreta.Mobile.Core.Extensions;assembly=Ekreta.Mobile.Core");
         namespaceResolver1.Add("ffimageloading", "clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms");
         XamlTypeResolver xamlTypeResolver1 = new XamlTypeResolver((IXmlNamespaceResolver)namespaceResolver1, typeof(EmptyView).GetTypeInfo().Assembly);
         xamlServiceProvider1.Add(type2, (object)xamlTypeResolver1);
         xamlServiceProvider1.Add(typeof(IXmlLineInfoProvider), (object)new XmlLineInfoProvider((IXmlLineInfo) new XmlLineInfo(21, 13)));
         object obj2 = ((IMarkupExtension)resourceExtension4).ProvideValue((IServiceProvider)xamlServiceProvider1);
         ((VisualElement)frame).set_BackgroundColor((Color)obj2);
         ((BindableObject)frame).SetValue((BindableProperty)Frame.HasShadowProperty, (object)false);
         ((BindableObject)frame).SetValue((BindableProperty)Xamarin.Forms.View.VerticalOptionsProperty, (object)(LayoutOptions)LayoutOptions.FillAndExpand);
         ((BindableObject)stackLayout).SetValue((BindableProperty)Xamarin.Forms.View.HorizontalOptionsProperty, (object)(LayoutOptions)LayoutOptions.Center);
         ((BindableObject)stackLayout).SetValue((BindableProperty)Xamarin.Forms.View.VerticalOptionsProperty, (object)(LayoutOptions)LayoutOptions.Center);
         ((BindableObject)cachedImage).SetValue((BindableProperty)Xamarin.Forms.View.MarginProperty, (object)new Thickness(12.0, 32.0));
         ((BindableObject)cachedImage).SetValue((BindableProperty)CachedImage.DownsampleToViewSizeProperty, (object)true);
         ((BindableObject)cachedImage).SetValue((BindableProperty)VisualElement.HeightRequestProperty, (object)240.0);
         referenceExtension1.set_Name("View");
         ReferenceExtension  referenceExtension4  = referenceExtension1;
         XamlServiceProvider xamlServiceProvider2 = new XamlServiceProvider();
         Type     type3     = typeof(IProvideValueTarget);
         object[] objArray2 = new object[0 + 5];
         objArray2[0] = (object)bindingExtension2;
         objArray2[1] = (object)cachedImage;
         objArray2[2] = (object)stackLayout;
         objArray2[3] = (object)frame;
         objArray2[4] = (object)emptyView;
         SimpleValueTargetProvider valueTargetProvider2;
         object obj3 = (object)(valueTargetProvider2 = new SimpleValueTargetProvider(objArray2, (object)typeof(BindingExtension).GetRuntimeProperty("Source"), (INameScope)nameScope));
         xamlServiceProvider2.Add(type3, (object)valueTargetProvider2);
         xamlServiceProvider2.Add(typeof(IReferenceProvider), obj3);
         Type type4 = typeof(IXamlTypeResolver);
         XmlNamespaceResolver namespaceResolver2 = new XmlNamespaceResolver();
         namespaceResolver2.Add("", "http://xamarin.com/schemas/2014/forms");
         namespaceResolver2.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
         namespaceResolver2.Add("extensions", "clr-namespace:Ekreta.Mobile.Core.Extensions;assembly=Ekreta.Mobile.Core");
         namespaceResolver2.Add("ffimageloading", "clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms");
         XamlTypeResolver xamlTypeResolver2 = new XamlTypeResolver((IXmlNamespaceResolver)namespaceResolver2, typeof(EmptyView).GetTypeInfo().Assembly);
         xamlServiceProvider2.Add(type4, (object)xamlTypeResolver2);
         xamlServiceProvider2.Add(typeof(IXmlLineInfoProvider), (object)new XmlLineInfoProvider((IXmlLineInfo) new XmlLineInfo(29, 21)));
         object obj4 = ((IMarkupExtension)referenceExtension4).ProvideValue((IServiceProvider)xamlServiceProvider2);
         bindingExtension2.set_Source(obj4);
         bindingExtension2.set_Path("Image");
         BindingBase bindingBase2 = ((IMarkupExtension <BindingBase>)bindingExtension2).ProvideValue((IServiceProvider)null);
         ((BindableObject)cachedImage).SetBinding((BindableProperty)CachedImage.SourceProperty, bindingBase2);
         ((BindableObject)cachedImage).SetValue((BindableProperty)VisualElement.WidthRequestProperty, (object)320.0);
         ((ICollection <Xamarin.Forms.View>)((Layout <Xamarin.Forms.View>)stackLayout).get_Children()).Add((Xamarin.Forms.View)cachedImage);
         ((BindableObject)label1).SetValue((BindableProperty)Xamarin.Forms.View.HorizontalOptionsProperty, (object)(LayoutOptions)LayoutOptions.Center);
         ((BindableObject)label1).SetValue((BindableProperty)Label.LineBreakModeProperty, (object)(LineBreakMode)1);
         resourceExtension2.set_Key("ListItemTitleStyle");
         StaticResourceExtension resourceExtension5   = resourceExtension2;
         XamlServiceProvider     xamlServiceProvider3 = new XamlServiceProvider();
         Type     type5     = typeof(IProvideValueTarget);
         object[] objArray3 = new object[0 + 4];
         objArray3[0] = (object)label1;
         objArray3[1] = (object)stackLayout;
         objArray3[2] = (object)frame;
         objArray3[3] = (object)emptyView;
         SimpleValueTargetProvider valueTargetProvider3;
         object obj5 = (object)(valueTargetProvider3 = new SimpleValueTargetProvider(objArray3, (object)VisualElement.StyleProperty, (INameScope)nameScope));
         xamlServiceProvider3.Add(type5, (object)valueTargetProvider3);
         xamlServiceProvider3.Add(typeof(IReferenceProvider), obj5);
         Type type6 = typeof(IXamlTypeResolver);
         XmlNamespaceResolver namespaceResolver3 = new XmlNamespaceResolver();
         namespaceResolver3.Add("", "http://xamarin.com/schemas/2014/forms");
         namespaceResolver3.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
         namespaceResolver3.Add("extensions", "clr-namespace:Ekreta.Mobile.Core.Extensions;assembly=Ekreta.Mobile.Core");
         namespaceResolver3.Add("ffimageloading", "clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms");
         XamlTypeResolver xamlTypeResolver3 = new XamlTypeResolver((IXmlNamespaceResolver)namespaceResolver3, typeof(EmptyView).GetTypeInfo().Assembly);
         xamlServiceProvider3.Add(type6, (object)xamlTypeResolver3);
         xamlServiceProvider3.Add(typeof(IXmlLineInfoProvider), (object)new XmlLineInfoProvider((IXmlLineInfo) new XmlLineInfo(34, 21)));
         object obj6 = ((IMarkupExtension)resourceExtension5).ProvideValue((IServiceProvider)xamlServiceProvider3);
         ((NavigableElement)label1).set_Style((Style)obj6);
         referenceExtension2.set_Name("View");
         ReferenceExtension  referenceExtension5  = referenceExtension2;
         XamlServiceProvider xamlServiceProvider4 = new XamlServiceProvider();
         Type     type7     = typeof(IProvideValueTarget);
         object[] objArray4 = new object[0 + 5];
         objArray4[0] = (object)bindingExtension3;
         objArray4[1] = (object)label1;
         objArray4[2] = (object)stackLayout;
         objArray4[3] = (object)frame;
         objArray4[4] = (object)emptyView;
         SimpleValueTargetProvider valueTargetProvider4;
         object obj7 = (object)(valueTargetProvider4 = new SimpleValueTargetProvider(objArray4, (object)typeof(BindingExtension).GetRuntimeProperty("Source"), (INameScope)nameScope));
         xamlServiceProvider4.Add(type7, (object)valueTargetProvider4);
         xamlServiceProvider4.Add(typeof(IReferenceProvider), obj7);
         Type type8 = typeof(IXamlTypeResolver);
         XmlNamespaceResolver namespaceResolver4 = new XmlNamespaceResolver();
         namespaceResolver4.Add("", "http://xamarin.com/schemas/2014/forms");
         namespaceResolver4.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
         namespaceResolver4.Add("extensions", "clr-namespace:Ekreta.Mobile.Core.Extensions;assembly=Ekreta.Mobile.Core");
         namespaceResolver4.Add("ffimageloading", "clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms");
         XamlTypeResolver xamlTypeResolver4 = new XamlTypeResolver((IXmlNamespaceResolver)namespaceResolver4, typeof(EmptyView).GetTypeInfo().Assembly);
         xamlServiceProvider4.Add(type8, (object)xamlTypeResolver4);
         xamlServiceProvider4.Add(typeof(IXmlLineInfoProvider), (object)new XmlLineInfoProvider((IXmlLineInfo) new XmlLineInfo(35, 21)));
         object obj8 = ((IMarkupExtension)referenceExtension5).ProvideValue((IServiceProvider)xamlServiceProvider4);
         bindingExtension3.set_Source(obj8);
         bindingExtension3.set_Path("Title");
         BindingBase bindingBase3 = ((IMarkupExtension <BindingBase>)bindingExtension3).ProvideValue((IServiceProvider)null);
         ((BindableObject)label1).SetBinding((BindableProperty)Label.TextProperty, bindingBase3);
         ((BindableObject)label1).SetValue((BindableProperty)Label.XAlignProperty, new TextAlignmentConverter().ConvertFromInvariantString("Center"));
         ((ICollection <Xamarin.Forms.View>)((Layout <Xamarin.Forms.View>)stackLayout).get_Children()).Add((Xamarin.Forms.View)label1);
         ((BindableObject)label2).SetValue((BindableProperty)Xamarin.Forms.View.HorizontalOptionsProperty, (object)(LayoutOptions)LayoutOptions.Center);
         referenceExtension3.set_Name("View");
         ReferenceExtension  referenceExtension6  = referenceExtension3;
         XamlServiceProvider xamlServiceProvider5 = new XamlServiceProvider();
         Type     type9     = typeof(IProvideValueTarget);
         object[] objArray5 = new object[0 + 5];
         objArray5[0] = (object)bindingExtension4;
         objArray5[1] = (object)label2;
         objArray5[2] = (object)stackLayout;
         objArray5[3] = (object)frame;
         objArray5[4] = (object)emptyView;
         SimpleValueTargetProvider valueTargetProvider5;
         object obj9 = (object)(valueTargetProvider5 = new SimpleValueTargetProvider(objArray5, (object)typeof(BindingExtension).GetRuntimeProperty("Source"), (INameScope)nameScope));
         xamlServiceProvider5.Add(type9, (object)valueTargetProvider5);
         xamlServiceProvider5.Add(typeof(IReferenceProvider), obj9);
         Type type10 = typeof(IXamlTypeResolver);
         XmlNamespaceResolver namespaceResolver5 = new XmlNamespaceResolver();
         namespaceResolver5.Add("", "http://xamarin.com/schemas/2014/forms");
         namespaceResolver5.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
         namespaceResolver5.Add("extensions", "clr-namespace:Ekreta.Mobile.Core.Extensions;assembly=Ekreta.Mobile.Core");
         namespaceResolver5.Add("ffimageloading", "clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms");
         XamlTypeResolver xamlTypeResolver5 = new XamlTypeResolver((IXmlNamespaceResolver)namespaceResolver5, typeof(EmptyView).GetTypeInfo().Assembly);
         xamlServiceProvider5.Add(type10, (object)xamlTypeResolver5);
         xamlServiceProvider5.Add(typeof(IXmlLineInfoProvider), (object)new XmlLineInfoProvider((IXmlLineInfo) new XmlLineInfo(39, 21)));
         object obj10 = ((IMarkupExtension)referenceExtension6).ProvideValue((IServiceProvider)xamlServiceProvider5);
         bindingExtension4.set_Source(obj10);
         bindingExtension4.set_Path("IsSubtitleVisible");
         BindingBase bindingBase4 = ((IMarkupExtension <BindingBase>)bindingExtension4).ProvideValue((IServiceProvider)null);
         ((BindableObject)label2).SetBinding((BindableProperty)VisualElement.IsVisibleProperty, bindingBase4);
         ((BindableObject)label2).SetValue((BindableProperty)Label.LineBreakModeProperty, (object)(LineBreakMode)1);
         resourceExtension3.set_Key("ListItemDescriptionStyle");
         StaticResourceExtension resourceExtension6   = resourceExtension3;
         XamlServiceProvider     xamlServiceProvider6 = new XamlServiceProvider();
         Type     type11    = typeof(IProvideValueTarget);
         object[] objArray6 = new object[0 + 4];
         objArray6[0] = (object)label2;
         objArray6[1] = (object)stackLayout;
         objArray6[2] = (object)frame;
         objArray6[3] = (object)emptyView;
         SimpleValueTargetProvider valueTargetProvider6;
         object obj11 = (object)(valueTargetProvider6 = new SimpleValueTargetProvider(objArray6, (object)VisualElement.StyleProperty, (INameScope)nameScope));
         xamlServiceProvider6.Add(type11, (object)valueTargetProvider6);
         xamlServiceProvider6.Add(typeof(IReferenceProvider), obj11);
         Type type12 = typeof(IXamlTypeResolver);
         XmlNamespaceResolver namespaceResolver6 = new XmlNamespaceResolver();
         namespaceResolver6.Add("", "http://xamarin.com/schemas/2014/forms");
         namespaceResolver6.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
         namespaceResolver6.Add("extensions", "clr-namespace:Ekreta.Mobile.Core.Extensions;assembly=Ekreta.Mobile.Core");
         namespaceResolver6.Add("ffimageloading", "clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms");
         XamlTypeResolver xamlTypeResolver6 = new XamlTypeResolver((IXmlNamespaceResolver)namespaceResolver6, typeof(EmptyView).GetTypeInfo().Assembly);
         xamlServiceProvider6.Add(type12, (object)xamlTypeResolver6);
         xamlServiceProvider6.Add(typeof(IXmlLineInfoProvider), (object)new XmlLineInfoProvider((IXmlLineInfo) new XmlLineInfo(41, 21)));
         object obj12 = ((IMarkupExtension)resourceExtension6).ProvideValue((IServiceProvider)xamlServiceProvider6);
         ((NavigableElement)label2).set_Style((Style)obj12);
         translateExtension1.Text = "Common_NoElement";
         TranslateExtension  translateExtension2  = translateExtension1;
         XamlServiceProvider xamlServiceProvider7 = new XamlServiceProvider();
         Type     type13    = typeof(IProvideValueTarget);
         object[] objArray7 = new object[0 + 4];
         objArray7[0] = (object)label2;
         objArray7[1] = (object)stackLayout;
         objArray7[2] = (object)frame;
         objArray7[3] = (object)emptyView;
         SimpleValueTargetProvider valueTargetProvider7;
         object obj13 = (object)(valueTargetProvider7 = new SimpleValueTargetProvider(objArray7, (object)Label.TextProperty, (INameScope)nameScope));
         xamlServiceProvider7.Add(type13, (object)valueTargetProvider7);
         xamlServiceProvider7.Add(typeof(IReferenceProvider), obj13);
         Type type14 = typeof(IXamlTypeResolver);
         XmlNamespaceResolver namespaceResolver7 = new XmlNamespaceResolver();
         namespaceResolver7.Add("", "http://xamarin.com/schemas/2014/forms");
         namespaceResolver7.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml");
         namespaceResolver7.Add("extensions", "clr-namespace:Ekreta.Mobile.Core.Extensions;assembly=Ekreta.Mobile.Core");
         namespaceResolver7.Add("ffimageloading", "clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms");
         XamlTypeResolver xamlTypeResolver7 = new XamlTypeResolver((IXmlNamespaceResolver)namespaceResolver7, typeof(EmptyView).GetTypeInfo().Assembly);
         xamlServiceProvider7.Add(type14, (object)xamlTypeResolver7);
         xamlServiceProvider7.Add(typeof(IXmlLineInfoProvider), (object)new XmlLineInfoProvider((IXmlLineInfo) new XmlLineInfo(42, 21)));
         object obj14 = ((IMarkupExtension)translateExtension2).ProvideValue((IServiceProvider)xamlServiceProvider7);
         label2.set_Text((string)obj14);
         ((ICollection <Xamarin.Forms.View>)((Layout <Xamarin.Forms.View>)stackLayout).get_Children()).Add((Xamarin.Forms.View)label2);
         ((BindableObject)frame).SetValue((BindableProperty)ContentView.ContentProperty, (object)stackLayout);
         ((BindableObject)emptyView).SetValue((BindableProperty)ContentView.ContentProperty, (object)frame);
     }
 }
Ejemplo n.º 20
0
		public void ContentDoesGetBindingContext ()
		{
			var platform = new UnitPlatform ();

			var contentView = new ContentView ();
			var child = new View ();

			contentView.ControlTemplate = new ControlTemplate (typeof (SimpleTemplate));
			contentView.Content = child;
			contentView.Platform = platform;

			var bc = "Test";
			contentView.BindingContext = bc;

			Assert.AreEqual (bc, child.BindingContext);
		}
Ejemplo n.º 21
0
 public void Transform(string text, ContentView view)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 22
0
        public void ShowServerForm()
        {
            Reset();

            Header      = "Where is your remote folder?";
            Description = "";


            ServerTypeLabel = new NSTextField()
            {
                Alignment       = NSTextAlignment.Right,
                BackgroundColor = NSColor.WindowBackground,
                Bordered        = false,
                Editable        = false,
                Frame           = new RectangleF(150, Frame.Height - 139, 160, 17),
                StringValue     = "Server Type:",
                Font            = SparkleUI.Font
            };

            AddressLabel = new NSTextField()
            {
                Alignment       = NSTextAlignment.Right,
                BackgroundColor = NSColor.WindowBackground,
                Bordered        = false,
                Editable        = false,
                Frame           = new RectangleF(150, Frame.Height - 237, 160, 17),
                StringValue     = "Address:",
                Font            = SparkleUI.Font
            };

            FolderNameLabel = new NSTextField()
            {
                Alignment       = NSTextAlignment.Right,
                BackgroundColor = NSColor.WindowBackground,
                Bordered        = false,
                Editable        = false,
                Frame           = new RectangleF(150, Frame.Height - 264, 160, 17),
                StringValue     = "Folder Name:",
                Font            = SparkleUI.Font
            };


            AddressTextField = new NSTextField()
            {
                Frame = new RectangleF(320, Frame.Height - 240, 256, 22),
                Font  = SparkleUI.Font
            };

            FolderNameTextField = new NSTextField()
            {
                Frame       = new RectangleF(320, Frame.Height - (240 + 22 + 4), 256, 22),
                StringValue = ""
            };


            FolderNameHelpLabel = new NSTextField()
            {
                BackgroundColor = NSColor.WindowBackground,
                Bordered        = false,
                TextColor       = NSColor.DisabledControlText,
                Editable        = false,
                Frame           = new RectangleF(320, Frame.Height - 285, 200, 17),
                StringValue     = "e.g. ‘rupert/website-design’"
            };


            ServerType = 0;

            ButtonCellProto = new NSButtonCell();
            ButtonCellProto.SetButtonType(NSButtonType.Radio);

            Matrix = new NSMatrix(new RectangleF(315, 180, 256, 78),
                                  NSMatrixMode.Radio, ButtonCellProto, 4, 1);

            Matrix.CellSize = new SizeF(256, 18);

            Matrix.Cells [0].Title = "My own server";
            Matrix.Cells [1].Title = "Github";
            Matrix.Cells [2].Title = "Gitorious";
            Matrix.Cells [3].Title = "The GNOME Project";

            foreach (NSCell cell in Matrix.Cells)
            {
                cell.Font = SparkleUI.Font;
            }

            // TODO: Ugly hack, do properly with events
            Timer timer = new Timer()
            {
                Interval = 50
            };

            timer.Elapsed += delegate {
                InvokeOnMainThread(delegate {
                    if (Matrix.SelectedRow != ServerType)
                    {
                        ServerType = Matrix.SelectedRow;

                        AddressTextField.Enabled = (ServerType == 0);

                        switch (ServerType)
                        {
                        case 0:
                            AddressTextField.StringValue    = "";
                            FolderNameHelpLabel.StringValue = "e.g. ‘rupert/website-design’";
                            break;

                        case 1:
                            AddressTextField.StringValue    = "ssh://[email protected]/";
                            FolderNameHelpLabel.StringValue = "e.g. ‘rupert/website-design’";
                            break;

                        case 2:
                            AddressTextField.StringValue    = "ssh://[email protected]/";
                            FolderNameHelpLabel.StringValue = "e.g. ‘project/website-design’";
                            break;

                        case 3:
                            AddressTextField.StringValue    = "ssh://[email protected]/git/";
                            FolderNameHelpLabel.StringValue = "e.g. ‘gnome-icon-theme’";
                            break;
                        }
                    }


                    if (ServerType == 0 && !AddressTextField.StringValue.Trim().Equals("") &&
                        !FolderNameTextField.StringValue.Trim().Equals(""))
                    {
                        SyncButton.Enabled = true;
                    }
                    else if (ServerType != 0 &&
                             !FolderNameTextField.StringValue.Trim().Equals(""))
                    {
                        SyncButton.Enabled = true;
                    }
                    else
                    {
                        SyncButton.Enabled = false;
                    }
                });
            };

            timer.Start();


            ContentView.AddSubview(ServerTypeLabel);
            ContentView.AddSubview(Matrix);

            ContentView.AddSubview(AddressLabel);
            ContentView.AddSubview(AddressTextField);

            ContentView.AddSubview(FolderNameLabel);
            ContentView.AddSubview(FolderNameTextField);
            ContentView.AddSubview(FolderNameHelpLabel);


            SyncButton = new NSButton()
            {
                Title   = "Sync",
                Enabled = false
            };


            SyncButton.Activated += delegate {
                string name = FolderNameTextField.StringValue;

                // Remove the starting slash if there is one
                if (name.StartsWith("/"))
                {
                    name = name.Substring(1);
                }

                string server = AddressTextField.StringValue;

                if (name.EndsWith("/"))
                {
                    name = name.TrimEnd("/".ToCharArray());
                }

                if (name.StartsWith("/"))
                {
                    name = name.TrimStart("/".ToCharArray());
                }

                if (server.StartsWith("ssh://"))
                {
                    server = server.Substring(6);
                }

                if (ServerType == 0)
                {
                    // Use the default user 'git' if no username is specified
                    if (!server.Contains("@"))
                    {
                        server = "git@" + server;
                    }

                    // Prepend the Secure Shell protocol when it isn't specified
                    if (!server.StartsWith("ssh://"))
                    {
                        server = "ssh://" + server;
                    }

                    // Remove the trailing slash if there is one
                    if (server.EndsWith("/"))
                    {
                        server = server.TrimEnd("/".ToCharArray());
                    }
                }

                if (ServerType == 2)
                {
                    server = "ssh://[email protected]";

                    if (!name.EndsWith(".git"))
                    {
                        if (!name.Contains("/"))
                        {
                            name = name + "/" + name;
                        }

                        name += ".git";
                    }
                }

                if (ServerType == 1)
                {
                    server = "ssh://[email protected]";
                }

                if (ServerType == 3)
                {
                    server = "ssh://[email protected]/git/";
                }

                string url            = server + "/" + name;
                string canonical_name = Path.GetFileNameWithoutExtension(name);


                ShowSyncingPage(canonical_name);


                SparkleShare.Controller.FolderFetched += delegate {
                    InvokeOnMainThread(delegate {
                        ShowSuccessPage(canonical_name);
                    });
                };

                SparkleShare.Controller.FolderFetchError += delegate {
                    InvokeOnMainThread(delegate {
                        ShowErrorPage();
                    });
                };


                SparkleShare.Controller.FetchFolder(url, name);
            };


            Buttons.Add(SyncButton);


            if (ServerFormOnly)
            {
                CancelButton = new NSButton()
                {
                    Title = "Cancel"
                };

                CancelButton.Activated += delegate {
                    InvokeOnMainThread(delegate {
                        PerformClose(this);
                    });
                };

                Buttons.Add(CancelButton);
            }
            else
            {
                SkipButton = new NSButton()
                {
                    Title = "Skip"
                };

                SkipButton.Activated += delegate {
                    InvokeOnMainThread(delegate {
                        ShowCompletedPage();
                    });
                };

                Buttons.Add(SkipButton);
            }

            ShowAll();
        }
Ejemplo n.º 23
0
 public MessageCell() : base(UITableViewCellStyle.Default, mKey)
 {
     view = new MessageSummaryView();
     ContentView.Add(view);
     Accessory = UITableViewCellAccessory.DisclosureIndicator;
 }
        public ContractInstanceNotificaitonViewCell()
        {
            var grid = new Grid
            {
                Padding           = 10,
                BackgroundColor   = Color.FromHex("#E3E3E3"),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                ColumnDefinitions = new ColumnDefinitionCollection
                {
                    new ColumnDefinition {
                        Width = GridLength.Star
                    },
                    new ColumnDefinition {
                        Width = GridLength.Auto
                    },
                },
            };

            title = new Label
            {
                FontSize        = 18,
                VerticalOptions = LayoutOptions.End,
                FontAttributes  = FontAttributes.Bold,
                LineBreakMode   = LineBreakMode.WordWrap
            };
            message = new Label
            {
                FontSize      = 14,
                LineBreakMode = LineBreakMode.WordWrap
            };

            grid.Children.Add(title, 0, 1, 0, 1);
            grid.Children.Add(message, 0, 1, 1, 2);

            switch (Device.RuntimePlatform)
            {
            case Device.iOS:
                var iOSViewButton = new ContentView
                {
                    Content = new Label
                    {
                        Text                  = " VIEW ",
                        TextColor             = Constants.ButtonTextColor,
                        VerticalTextAlignment = TextAlignment.Center,
                        FontAttributes        = FontAttributes.Bold,
                        HeightRequest         = 50,
                        FontSize              = 20
                    },
                    Padding           = new Thickness(10, 0),
                    BackgroundColor   = Constants.ButtonBackgroundColor,
                    HorizontalOptions = LayoutOptions.End,
                    VerticalOptions   = LayoutOptions.Center,
                };


                grid.Children.Add(iOSViewButton, 1, 2, 0, 2);

                View = new ContentView
                {
                    Content           = grid,
                    Padding           = 10,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    BackgroundColor   = Color.FromRgb(210, 210, 210),
                };
                break;

            case Device.Android:
                var androidViewButton = new Frame
                {
                    Content = new Label
                    {
                        Text                  = " VIEW ",
                        TextColor             = Constants.ButtonTextColor,
                        VerticalTextAlignment = TextAlignment.Center,
                        FontAttributes        = FontAttributes.Bold,
                        HeightRequest         = 50,
                        FontSize              = 20
                    },
                    Padding           = new Thickness(10, 0),
                    BackgroundColor   = Constants.ButtonBackgroundColor,
                    HorizontalOptions = LayoutOptions.End,
                    VerticalOptions   = LayoutOptions.Center,
                };


                grid.Children.Add(androidViewButton, 1, 2, 0, 2);
                View = new ContentView
                {
                    Content = new Frame {
                        Content = grid, Margin = 5, Padding = 0
                    },
                    Padding           = 10,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    BackgroundColor   = Color.FromRgb(210, 210, 210),
                };
                break;
            }
        }
Ejemplo n.º 25
0
        public void init(ContentView cv)
        {
            PointContentView.Content = cv;

            // 적립 내역 이벤트
            AddGrid.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = new Command(async() =>
                {
                    // 로딩 시작
                    await Global.LoadingStartAsync();

                    pal = new PointAddList(this, pp);
                    PointContentView.Content = pal;

                    ((CustomLabel)AddGrid.Children[0]).TextColor        = Color.CornflowerBlue;
                    ((BoxView)AddGrid.Children[1]).BackgroundColor      = Color.CornflowerBlue;
                    ((CustomLabel)UsedGrid.Children[0]).TextColor       = Color.Black;
                    ((BoxView)UsedGrid.Children[1]).BackgroundColor     = Color.White;
                    ((CustomLabel)ChargeGrid.Children[0]).TextColor     = Color.Black;
                    ((BoxView)ChargeGrid.Children[1]).BackgroundColor   = Color.White;
                    ((CustomLabel)WidhdrawGrid.Children[0]).TextColor   = Color.Black;
                    ((BoxView)WidhdrawGrid.Children[1]).BackgroundColor = Color.White;

                    // 로딩 완료
                    await Global.LoadingEndAsync();
                })
            });
            // 사용 내역 이벤트
            UsedGrid.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = new Command(async() =>
                {
                    // 로딩 시작
                    await Global.LoadingStartAsync();

                    pul = new PointUsedList(this, pp);
                    PointContentView.Content = pul;

                    ((CustomLabel)AddGrid.Children[0]).TextColor        = Color.Black;
                    ((BoxView)AddGrid.Children[1]).BackgroundColor      = Color.White;
                    ((CustomLabel)UsedGrid.Children[0]).TextColor       = Color.CornflowerBlue;
                    ((BoxView)UsedGrid.Children[1]).BackgroundColor     = Color.CornflowerBlue;
                    ((CustomLabel)ChargeGrid.Children[0]).TextColor     = Color.Black;
                    ((BoxView)ChargeGrid.Children[1]).BackgroundColor   = Color.White;
                    ((CustomLabel)WidhdrawGrid.Children[0]).TextColor   = Color.Black;
                    ((BoxView)WidhdrawGrid.Children[1]).BackgroundColor = Color.White;

                    // 로딩 완료
                    await Global.LoadingEndAsync();
                })
            });
            // 포인트 충전 이벤트
            ChargeGrid.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = new Command(() =>
                {
                    pcv = new PointChargeView(this, pp);
                    PointContentView.Content = pcv;

                    ((CustomLabel)AddGrid.Children[0]).TextColor        = Color.Black;
                    ((BoxView)AddGrid.Children[1]).BackgroundColor      = Color.White;
                    ((CustomLabel)UsedGrid.Children[0]).TextColor       = Color.Black;
                    ((BoxView)UsedGrid.Children[1]).BackgroundColor     = Color.White;
                    ((CustomLabel)ChargeGrid.Children[0]).TextColor     = Color.CornflowerBlue;
                    ((BoxView)ChargeGrid.Children[1]).BackgroundColor   = Color.CornflowerBlue;
                    ((CustomLabel)WidhdrawGrid.Children[0]).TextColor   = Color.Black;
                    ((BoxView)WidhdrawGrid.Children[1]).BackgroundColor = Color.White;
                })
            });
            // 포인트 출금 이벤트
            WidhdrawGrid.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = new Command(() =>
                {
                    pwv = new PointWidhdrawView(this, pp);
                    PointContentView.Content = pwv;
                    ((CustomLabel)AddGrid.Children[0]).TextColor        = Color.Black;
                    ((BoxView)AddGrid.Children[1]).BackgroundColor      = Color.White;
                    ((CustomLabel)UsedGrid.Children[0]).TextColor       = Color.Black;
                    ((BoxView)UsedGrid.Children[1]).BackgroundColor     = Color.White;
                    ((CustomLabel)ChargeGrid.Children[0]).TextColor     = Color.Black;
                    ((BoxView)ChargeGrid.Children[1]).BackgroundColor   = Color.White;
                    ((CustomLabel)WidhdrawGrid.Children[0]).TextColor   = Color.CornflowerBlue;
                    ((BoxView)WidhdrawGrid.Children[1]).BackgroundColor = Color.CornflowerBlue;
                })
            });
        }
Ejemplo n.º 26
0
        public NewsItemCell(NSString cellIdentifier) : base(UITableViewCellStyle.Default, cellIdentifier)
        {
            //width = ContentView.Bounds.Width - 5;
            img = new UIImageView()
            {
                ContentMode = UIViewContentMode.ScaleAspectFit
                              BackgroundColor = UIColor.White
            };
            timeimg = new UIImageView()
            {
                Image           = UIImage.FromFile("ic_schedule").ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate),
                TintColor       = Xamarin.Forms.Color.FromHex(Constants.ColorPrimary).ToUIColor(),
                ContentMode     = UIViewContentMode.ScaleAspectFit,
                BackgroundColor = UIColor.Clear
            };
            //this.cellIdentifier = cellIdentifier;
            title = new UILabel()
            {
                Font            = UIFont.BoldSystemFontOfSize(15f),
                TextAlignment   = UITextAlignment.Center,
                TextColor       = UIColor.Black,
                BackgroundColor = UIColor.Clear
            };
            time = new UILabel()
            {
                Font            = UIFont.SystemFontOfSize(11f),
                TextAlignment   = UITextAlignment.Justified,
                TextColor       = UIColor.Black,
                BackgroundColor = UIColor.Clear
            };
            content = new UITextView()
            {
                Editable        = false, Font = UIFont.SystemFontOfSize(11f),
                TextAlignment   = UITextAlignment.Left,
                TextColor       = UIColor.Black,
                BackgroundColor = UIColor.Clear
            };
            ContentView.AddSubviews(new UIView()
            {
                title, time, timeimg, img, content
            });

            /*mainview = new UIView()
             * {
             *  ContentMode = UIViewContentMode.ScaleToFill
             * };
             * mainview.AddSubviews(title, time, timeimg, img, content);
             * ContentView.Add(mainview);
             * mainview.BackgroundColor = UIColor.Cyan;
             * //mainview.Bounds.Size = 20f;
             * //mainview.TranslatesAutoresizingMaskIntoConstraints = false;
             * //mainview.Frame = new CGRect(0, 0, ContentView.Bounds.Width, 280);
             * //ContentView.AddConstraint(NSLayoutConstraint.Create(mainview, NSLayoutAttribute.Width, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Width, 1, 0));
             * //ContentView.AddConstraint(NSLayoutConstraint.Create(mainview, NSLayoutAttribute.Height, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Height, 1, 0));
             * //mainview.BottomAnchor.ConstraintEqualTo(ContentView.BottomAnchor).Active = true;
             * ContentView.AddConstraint(NSLayoutConstraint.Create(mainview, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.TopMargin, 1, 0));
             * ContentView.AddConstraint(NSLayoutConstraint.Create(mainview, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.BottomMargin, 1, 0));
             * ContentView.AddConstraint(NSLayoutConstraint.Create(mainview, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.LeadingMargin, 1, 0));
             * ContentView.AddConstraint(NSLayoutConstraint.Create(mainview, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.TrailingMargin, 1, 0));
             */
        }
Ejemplo n.º 27
0
        protected override void Init()
        {
            StackLayout parentLayout1 = null;
            StackLayout parentLayout2 = null;
            StackLayout parentLayout3 = null;

            StackLayout stackLayout = new StackLayout
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                BackgroundColor   = Color.Blue,
                Children          =
                {
                    new BoxView
                    {
                        Color         = Color.Red,
                        HeightRequest = 100,
                        WidthRequest  = 100,
                    }
                }
            };

            ContentView contentView = new ContentView
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                BackgroundColor   = Color.Blue,
                Content           =
                    new BoxView
                {
                    Color         = Color.Red,
                    HeightRequest = 100,
                    WidthRequest  = 100,
                }
            };

            FlexLayout flex = new FlexLayout
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                BackgroundColor   = Color.Blue,
                Children          =
                {
                    new BoxView
                    {
                        Color         = Color.Red,
                        HeightRequest = 100,
                        WidthRequest  = 100,
                    }
                }
            };

            Slider paddingSlider = new Slider
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Minimum           = 0.0,
                Maximum           = 100.0,
            };

            stackLayout.SetBinding(Forms.Layout.PaddingProperty, new Binding()
            {
                Path = "Value", Source = paddingSlider
            });
            contentView.SetBinding(Forms.Layout.PaddingProperty, new Binding()
            {
                Path = "Value", Source = paddingSlider
            });
            flex.SetBinding(Forms.Layout.PaddingProperty, new Binding()
            {
                Path = "Value", Source = paddingSlider
            });

            // Build the page.
            this.Padding = new Thickness(20);
            this.Content = new StackLayout
            {
                Spacing  = 20,
                Children =
                {
                    new StackLayout
                    {
                        Orientation = StackOrientation.Horizontal,
                        Children    =
                        {
                            new Label
                            {
                                Text = "Padding"
                            },
                            paddingSlider,
                        }
                    },
                    new Button()
                    {
                        Text    = "Force update",
                        Command = new Command(() =>
                        {
                            var boxview = new BoxView();
                            parentLayout1.Children.Add(boxview);
                            parentLayout1.Children.Remove(boxview);
                            parentLayout2.Children.Add(boxview);
                            parentLayout2.Children.Remove(boxview);
                            parentLayout3.Children.Add(boxview);
                            parentLayout3.Children.Remove(boxview);
                        })
                    },
                    new ScrollView
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions   = LayoutOptions.FillAndExpand,
                        Content           = new StackLayout
                        {
                            Spacing  = 20,
                            Children =
                            {
                                (parentLayout1            = new StackLayout
                                {
                                    Children              ={ new Label                {
                                                   Text = "StackLayout"
                                               }, stackLayout },
                                }),
                                (parentLayout2            = new StackLayout
                                {
                                    Children              ={ new Label                {
                                                   Text = "ContentView"
                                               }, contentView }
                                }),
                                (parentLayout3            = new StackLayout
                                {
                                    Children              ={ new Label                {
                                                   Text = "FlexLayout"
                                               }, flex }
                                })
                            }
                        }
                    }
                }
            };
        }
Ejemplo n.º 28
0
		//Issue 1384
		public void ImageInAutoCellIsProperlyConstrained ()
		{
			var platform = new UnitPlatform ();

			var content = new Image { 
				Aspect= Aspect.AspectFit,
				Platform = platform, 
				IsPlatformEnabled = true 
			};
			var grid = new Grid {
				Platform = platform, 
				IsPlatformEnabled = true,
				BackgroundColor = Color.Red, 
				VerticalOptions=LayoutOptions.Start,
				Children = {
					content
				},
				RowDefinitions = { new RowDefinition { Height = GridLength.Auto} },
				ColumnDefinitions = { new ColumnDefinition { Width = GridLength.Auto } }
			};
			var view = new ContentView {
				Platform = platform, 
				IsPlatformEnabled = true,
				Content = grid,
			};
			view.Layout (new Rectangle (0, 0, 100, 100));
			Assert.AreEqual (100, grid.Width);
			Assert.AreEqual (20, grid.Height);

			view.Layout (new Rectangle (0, 0, 50, 50));
			Assert.AreEqual (50, grid.Width);
			Assert.AreEqual (10, grid.Height);
		}
Ejemplo n.º 29
0
		public void NonTemplatedContentInheritsBindingContext ()
		{
			var platform = new UnitPlatform ();

			var contentView = new ContentView ();
			var child = new View ();
			
			contentView.Content = child;
			contentView.Platform = platform;
			contentView.BindingContext = "Foo";

			Assert.AreEqual ("Foo", child.BindingContext);
		}
Ejemplo n.º 30
0
        public void ShowAccountForm()
        {
            Reset();

            Header      = "Welcome to SparkleShare!";
            Description = "Before we can create a SparkleShare folder on this " +
                          "computer, we need some information from you.";


            UserInfoForm = new NSForm(new RectangleF(250, 115, 350, 64));
            UserInfoForm.AddEntry("Full Name:");
            UserInfoForm.AddEntry("Email Address:");
            UserInfoForm.CellSize         = new SizeF(280, 22);
            UserInfoForm.IntercellSpacing = new SizeF(4, 4);

            string full_name = new UnixUserInfo(UnixEnvironment.UserName).RealName;

            UserInfoForm.Cells [0].StringValue = full_name.TrimEnd(",".ToCharArray());;
            UserInfoForm.Cells [1].StringValue = SparkleShare.Controller.UserEmail;


            ContinueButton = new NSButton()
            {
                Title   = "Continue",
                Enabled = false
            };

            ContinueButton.Activated += delegate {
                SparkleShare.Controller.UserName  = UserInfoForm.Cells [0].StringValue.Trim();
                SparkleShare.Controller.UserEmail = UserInfoForm.Cells [1].StringValue.Trim();
                SparkleShare.Controller.GenerateKeyPair();
                SparkleShare.Controller.FirstRun = false;

                InvokeOnMainThread(delegate {
                    ShowServerForm();
                });
            };


            // TODO: Ugly hack, do properly with events
            Timer timer = new Timer()
            {
                Interval = 50
            };

            timer.Elapsed += delegate {
                InvokeOnMainThread(delegate {
                    bool name_is_correct =
                        !UserInfoForm.Cells [0].StringValue.Trim().Equals("");

                    bool email_is_correct = SparkleShare.Controller.IsValidEmail
                                                (UserInfoForm.Cells [1].StringValue.Trim());

                    ContinueButton.Enabled = (name_is_correct && email_is_correct);
                });
            };

            timer.Start();

            ContentView.AddSubview(UserInfoForm);
            Buttons.Add(ContinueButton);

            ShowAll();
        }
Ejemplo n.º 31
0
        protected NewFeedCollectionViewCell(IntPtr handle) : base(handle)
        {
            //ContentView.BackgroundColor = UIColor.Cyan;

            _avatarImage = new UIImageView(new CGRect(leftMargin, 20, 30, 30));
            _avatarImage.Layer.CornerRadius = _avatarImage.Frame.Size.Width / 2;
            _avatarImage.ClipsToBounds      = true;
            _avatarImage.ContentMode        = UIViewContentMode.ScaleAspectFill;
            ContentView.AddSubview(_avatarImage);

            _moreButton       = new UIButton();
            _moreButton.Frame = new CGRect(ContentView.Frame.Width - moreButtonWidth, 0, moreButtonWidth, likeButtonWidthConst);
            _moreButton.SetImage(UIImage.FromBundle("ic_more"), UIControlState.Normal);
            //_moreButton.BackgroundColor = UIColor.Black;
            ContentView.AddSubview(_moreButton);

            var authorX = _avatarImage.Frame.Right + 10;

            _author      = new UILabel(new CGRect(authorX, _avatarImage.Frame.Top, _moreButton.Frame.Left - authorX, 16));
            _author.Font = Constants.Semibold14;
            //_author.BackgroundColor = UIColor.Yellow;
            _author.LineBreakMode = UILineBreakMode.TailTruncation;
            _author.TextColor     = Constants.R15G24B30;
            ContentView.AddSubview(_author);

            _timestamp      = new UILabel(new CGRect(authorX, _author.Frame.Bottom, _moreButton.Frame.Left - authorX, 14));
            _timestamp.Font = Constants.Regular12;
            //_timestamp.BackgroundColor = UIColor.Green;
            _timestamp.LineBreakMode = UILineBreakMode.TailTruncation;
            _timestamp.TextColor     = Constants.R151G155B158;
            ContentView.AddSubview(_timestamp);

            _bodyImage = new UIImageView();
            _bodyImage.ClipsToBounds          = true;
            _bodyImage.UserInteractionEnabled = true;
            _bodyImage.ContentMode            = UIViewContentMode.ScaleAspectFill;
            ContentView.AddSubview(_bodyImage);

            var likersCornerRadius = likersImageSide / 2;

            _firstLikerImage = new UIImageView();
            _firstLikerImage.Layer.CornerRadius = likersCornerRadius;
            _firstLikerImage.ClipsToBounds      = true;
            _firstLikerImage.ContentMode        = UIViewContentMode.ScaleAspectFill;
            ContentView.AddSubview(_firstLikerImage);

            _secondLikerImage = new UIImageView();
            _secondLikerImage.Layer.CornerRadius = likersCornerRadius;
            _secondLikerImage.ClipsToBounds      = true;
            _secondLikerImage.ContentMode        = UIViewContentMode.ScaleAspectFill;
            ContentView.AddSubview(_secondLikerImage);

            _thirdLikerImage = new UIImageView();
            _thirdLikerImage.Layer.CornerRadius = likersCornerRadius;
            _thirdLikerImage.ClipsToBounds      = true;
            _thirdLikerImage.ContentMode        = UIViewContentMode.ScaleAspectFill;
            ContentView.AddSubview(_thirdLikerImage);

            _likes      = new UILabel();
            _likes.Font = Constants.Semibold14;
            //_likes.BackgroundColor = UIColor.Magenta;
            _likes.LineBreakMode          = UILineBreakMode.TailTruncation;
            _likes.TextColor              = Constants.R15G24B30;
            _likes.UserInteractionEnabled = true;
            ContentView.AddSubview(_likes);

            _flags      = new UILabel();
            _flags.Font = Constants.Semibold14;
            //_flags.BackgroundColor = UIColor.Orange;
            _flags.LineBreakMode = UILineBreakMode.TailTruncation;
            _flags.TextColor     = Constants.R15G24B30;
            ContentView.AddSubview(_flags);

            _rewards      = new UILabel();
            _rewards.Font = Constants.Semibold14;
            //_rewards.BackgroundColor = UIColor.Orange;
            _rewards.LineBreakMode          = UILineBreakMode.TailTruncation;
            _rewards.TextColor              = Constants.R15G24B30;
            _rewards.UserInteractionEnabled = true;
            ContentView.AddSubview(_rewards);

            _like = new UIButton();
            _like.SetImage(UIImage.FromBundle("ic_like"), UIControlState.Normal);
            _like.SetImage(UIImage.FromBundle("ic_like_active"), UIControlState.Selected);
            //_like.BackgroundColor = UIColor.Brown;
            ContentView.AddSubview(_like);

            _verticalSeparator = new UIView();
            _verticalSeparator.BackgroundColor = Constants.R244G244B246;
            ContentView.AddSubview(_verticalSeparator);

            _topSeparator = new UIView();
            _topSeparator.BackgroundColor = Constants.R244G244B246;
            ContentView.AddSubview(_topSeparator);

            _attributedLabel = new TTTAttributedLabel();
            _attributedLabel.EnabledTextCheckingTypes = NSTextCheckingType.Link;
            var prop = new NSDictionary();

            _attributedLabel.LinkAttributes       = prop;
            _attributedLabel.ActiveLinkAttributes = prop;
            _attributedLabel.Font  = Constants.Regular14;
            _attributedLabel.Lines = 0;
            _attributedLabel.UserInteractionEnabled = true;
            _attributedLabel.Enabled = true;
            //_attributedLabel.BackgroundColor = UIColor.Blue;
            //_attributedLabel.Delegate = new TTTAttributedLabelFeedDelegate(TagAction);
            ContentView.AddSubview(_attributedLabel);

            _comments      = new UILabel();
            _comments.Font = Constants.Regular14;
            //_comments.BackgroundColor = UIColor.DarkGray;
            _comments.LineBreakMode          = UILineBreakMode.TailTruncation;
            _comments.TextColor              = Constants.R151G155B158;
            _comments.UserInteractionEnabled = true;
            _comments.TextAlignment          = UITextAlignment.Center;
            ContentView.AddSubview(_comments);

            _bottomSeparator = new UIView();
            _bottomSeparator.BackgroundColor = Constants.R244G244B246;
            ContentView.AddSubview(_bottomSeparator);

            _profileTapView = new UIView(new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width / 2, likeButtonWidthConst));
            _profileTapView.UserInteractionEnabled = true;
            ContentView.AddSubview(_profileTapView);

            var tap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Preview, _currentPost);
            });

            _bodyImage.AddGestureRecognizer(tap);

            var profileTap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Profile, _currentPost);
            });
            var headerTap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Profile, _currentPost);
            });

            _profileTapView.AddGestureRecognizer(headerTap);
            _rewards.AddGestureRecognizer(profileTap);

            var commentTap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Comments, _currentPost);
            });

            _comments.AddGestureRecognizer(commentTap);

            var netVotesTap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Voters, _currentPost);
            });

            _likes.AddGestureRecognizer(netVotesTap);

            _moreButton.TouchDown += FlagButton_TouchDown;
            _like.TouchDown       += LikeTap;
        }
Ejemplo n.º 32
0
 /// <summary>
 /// Tigers while Left template binding context was changed
 /// </summary>
 /// <param name="sender">RightTemplate_BindingContextChanged sender</param>
 /// <param name="e">RightTemplate_BindingContextChanged event args e</param>
 private void LeftTemplate_BindingContextChanged(object sender, EventArgs e)
 {
     this.leftTemplateView = sender as ContentView;
 }
Ejemplo n.º 33
0
        /// <internalonly />
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _contentView = (ContentView)GetTemplateChild("ContentView");
            if (_loaded) {
                NavigateInternal(new NavigationState(Uri));
            }
        }
Ejemplo n.º 34
0
        private void BuildLayout()
        {
            var main = new RelativeLayout();

            this.Content = main;

            var imageTop = new Image();

            imageTop.Source = ImageSource.FromResource("TiroApp.Images.launch.jpg");
            imageTop.Aspect = Aspect.AspectFill;
            main.Children.Add(imageTop, Constraint.Constant(0), Constraint.Constant(0),
                              Constraint.RelativeToParent((p) => { return(p.Width); }),
                              Constraint.RelativeToParent((p) => { return(p.Width * 1.2); }));

            var bgView = new ContentView();

            bgView.BackgroundColor = Props.BlackoutColor;
            main.Children.Add(bgView, Constraint.Constant(0), Constraint.Constant(0),
                              Constraint.RelativeToParent(p => p.Width), Constraint.RelativeToParent(p => p.Height));

            var imageArrowBack = new Image();

            imageArrowBack.Source = ImageSource.FromResource("TiroApp.Images.ArrowBack.png");
            imageArrowBack.GestureRecognizers.Add(new TapGestureRecognizer(OnBack));
            main.Children.Add(imageArrowBack
                              , Constraint.Constant(10)
                              , Constraint.Constant(30)
                              , Constraint.Constant(20)
                              , Constraint.Constant(20));

            var button = UIUtils.MakeButton("MAKE A NEW APPLICATION", UIUtils.FONT_SFUIDISPLAY_MEDIUM);

            button.Clicked += OnBottomButtonClick;
            //main.Children.Add(button, Constraint.Constant(0), Constraint.RelativeToParent(p => p.Height - button.HeightRequest));

            var l21 = new CustomLabel()
            {
                TextColor  = Color.Black,
                FontSize   = 16,
                FontFamily = UIUtils.FONT_SFUIDISPLAY_MEDIUM,
                HorizontalTextAlignment = TextAlignment.Center,
                HorizontalOptions       = LayoutOptions.Center,
                Margin = new Thickness(20),
                Text   = "Thanks for applying!"
            };
            var l22 = new CustomLabel()
            {
                TextColor  = Color.Black,
                FontSize   = 16,
                FontFamily = UIUtils.FONT_SFUIDISPLAY_MEDIUM,
                HorizontalTextAlignment = TextAlignment.Center,
                HorizontalOptions       = LayoutOptions.Center,
                Margin = new Thickness(20),
                Text   = "Our Tiro Execs are reviewing your application and will get back to you shortly."
            };
            var l23 = new CustomLabel()
            {
                TextColor  = Color.Black,
                FontSize   = 16,
                FontFamily = UIUtils.FONT_SFUIDISPLAY_MEDIUM,
                HorizontalTextAlignment = TextAlignment.Center,
                HorizontalOptions       = LayoutOptions.Center,
                Margin = new Thickness(20),
                Text   = "We aim to follow-up between 24 - 48 hours after your application is submitted"
            };

            var bLayout = new StackLayout()
            {
                Orientation     = StackOrientation.Vertical,
                BackgroundColor = Color.White,
                //HeightRequest = 400,
                Children = { l21, l22, l23, button }
            };

            main.Children.Add(bLayout, Constraint.Constant(0),
                              Constraint.RelativeToParent(p => p.Height - bLayout.Height),
                              Constraint.RelativeToParent(p => p.Width));

            var label1 = new CustomLabel()
            {
                TextColor  = Color.White,
                FontSize   = 28,
                FontFamily = UIUtils.FONT_BEBAS_REGULAR,
                HorizontalTextAlignment = TextAlignment.Center,
                Margin = new Thickness(20),
                Text   = "SIT TIGHT, YOUR APPLICATION IS UNDER REVIEW"
            };

            main.Children.Add(label1, Constraint.Constant(0),
                              Constraint.RelativeToView(bLayout, (p, v) => p.Height - v.Height - label1.Height - 40),
                              Constraint.RelativeToParent(p => p.Width));
        }
Ejemplo n.º 35
0
        void ReleaseDesignerOutlets()
        {
            if (btnAtiende != null)
            {
                btnAtiende.Dispose();
                btnAtiende = null;
            }

            if (btnGuardar != null)
            {
                btnGuardar.Dispose();
                btnGuardar = null;
            }

            if (btnReporto != null)
            {
                btnReporto.Dispose();
                btnReporto = null;
            }

            if (btnTipoFalla != null)
            {
                btnTipoFalla.Dispose();
                btnTipoFalla = null;
            }

            if (ContentView != null)
            {
                ContentView.Dispose();
                ContentView = null;
            }

            if (ScrView != null)
            {
                ScrView.Dispose();
                ScrView = null;
            }

            if (txtatiende != null)
            {
                txtatiende.Dispose();
                txtatiende = null;
            }

            if (txtDescripcion != null)
            {
                txtDescripcion.Dispose();
                txtDescripcion = null;
            }

            if (txtequipo != null)
            {
                txtequipo.Dispose();
                txtequipo = null;
            }

            if (txtfechahora != null)
            {
                txtfechahora.Dispose();
                txtfechahora = null;
            }

            if (txtfipofalla != null)
            {
                txtfipofalla.Dispose();
                txtfipofalla = null;
            }

            if (txtFolio != null)
            {
                txtFolio.Dispose();
                txtFolio = null;
            }

            if (txtkmho != null)
            {
                txtkmho.Dispose();
                txtkmho = null;
            }

            if (txtmodelo != null)
            {
                txtmodelo.Dispose();
                txtmodelo = null;
            }

            if (txtnoserie != null)
            {
                txtnoserie.Dispose();
                txtnoserie = null;
            }

            if (txtreporto != null)
            {
                txtreporto.Dispose();
                txtreporto = null;
            }
        }
Ejemplo n.º 36
0
        public ProductListItemCell()
        {
            #region productThumbnailImage
            Image productThumbnailImage = new Image()
            {
                Aspect = Aspect.AspectFit
            };
            productThumbnailImage.SetBinding(Image.SourceProperty, new Binding("ImageUrl"));
            #endregion

            #region image loading indicator
            ActivityIndicator imageLoadingIndicator = new ActivityIndicator()
            {
                BindingContext = productThumbnailImage
            };
            imageLoadingIndicator.SetBinding(ActivityIndicator.IsEnabledProperty, "IsLoading");
            imageLoadingIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, "IsLoading");
            imageLoadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsLoading");
            #endregion

            #region categoryNameLabel
            Label categoryNameLabel = new Label()
            {
                TextColor = Palette._006,
                FontSize  = Device.OnPlatform(
                    iOS: Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                    Android: Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                    WinPhone: Device.GetNamedSize(NamedSize.Medium, typeof(Label))) * 1.2,
                YAlign        = TextAlignment.Center,
                LineBreakMode = LineBreakMode.TailTruncation
            };

            // The simple form of the Binding constructor.
            categoryNameLabel.SetBinding(Label.TextProperty, new Binding("Name"));
            #endregion

            #region categoryDescriptionLabel
            Label categoryDescriptionLabel = new Label()
            {
                TextColor     = Palette._007,
                FontSize      = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                YAlign        = TextAlignment.Center,
                LineBreakMode = LineBreakMode.TailTruncation
            };

            // The simple form of the Binding constructor.
            categoryDescriptionLabel.SetBinding(Label.TextProperty, new Binding("Description"));
            #endregion

            // A ContentView, which will serve as the "top-level" of the cell's view hierarchy.
            // It also allows a Padding to be set; something that can't be done with a plain View.
            var contentView = new ContentView();

            // set the padding of the contentView
            Thickness padding = new Thickness(10, 10);
            contentView.Padding = padding;

            // A container for the "top-level" of the cell's view hierarchy.
            RelativeLayout relativeLayout = new RelativeLayout()
            {
                BackgroundColor = Color.Transparent
            };

            relativeLayout.Children.Add(
                view: productThumbnailImage,
                xConstraint: Constraint.RelativeToParent(parent => 0),
                yConstraint: Constraint.RelativeToParent(parent => 0),
                widthConstraint: Constraint.RelativeToParent(parent => parent.Height),
                heightConstraint: Constraint.RelativeToParent(parent => parent.Height));

            relativeLayout.Children.Add(view: imageLoadingIndicator,
                                        xConstraint: Constraint.RelativeToParent(parent => 0),
                                        yConstraint: Constraint.RelativeToParent(parent => 0),
                                        widthConstraint: Constraint.RelativeToParent(parent => parent.Height),
                                        heightConstraint: Constraint.RelativeToParent(parent => parent.Height));

            relativeLayout.Children.Add(
                view: categoryNameLabel,
                xConstraint: Constraint.RelativeToView(productThumbnailImage, (parent, siblingView) => siblingView.X + siblingView.Width + padding.HorizontalThickness / 2),
                yConstraint: Constraint.RelativeToParent(parent => 0),
                widthConstraint: Constraint.RelativeToView(productThumbnailImage, (parent, siblingView) => parent.Width - siblingView.Width - padding.HorizontalThickness / 2),
                heightConstraint: Constraint.RelativeToParent(parent => parent.Height / 2));

            relativeLayout.Children.Add(
                view: categoryDescriptionLabel,
                xConstraint: Constraint.RelativeToView(productThumbnailImage, (parent, siblingView) => siblingView.X + siblingView.Width + padding.HorizontalThickness / 2),
                yConstraint: Constraint.RelativeToParent(parent => parent.Height / 2),
                widthConstraint: Constraint.RelativeToView(productThumbnailImage, (parent, siblingView) => parent.Width - siblingView.Width - padding.HorizontalThickness / 2),
                heightConstraint: Constraint.RelativeToParent(parent => parent.Height / 2));

            // Assign the relativeLayout to Content of contentView
            // This lets us take advantage of ContentView's padding
            contentView.Content = relativeLayout;

            // assign contentView to the View property
            View = contentView;
        }
Ejemplo n.º 37
0
        //Functions
        public void BuildPageObjects()
        {
            var btnSize = Device.GetNamedSize(NamedSize.Large, typeof(Button));
            var lblSize = Device.GetNamedSize(NamedSize.Large, typeof(Label));

            //View Objects
            innerGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(7, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                }
            };
            outerGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

#if __ANDROID__
            androidViewPlaylistLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidViewPlaylistLbl.Text     = "View Playlists";
            androidViewPlaylistLbl.Typeface = Constants.COMMONFONT;
            androidViewPlaylistLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 100);
            androidViewPlaylistLbl.SetTextColor(Android.Graphics.Color.Black);
            androidViewPlaylistLbl.Gravity = Android.Views.GravityFlags.Center;

            contentViewAndroidViewPlaylistLbl         = new ContentView();
            contentViewAndroidViewPlaylistLbl.Content = androidViewPlaylistLbl.ToView();
#endif

            viewPlaylistLbl = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize * 2,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize,
#endif
                Text = "View Playlists",
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center
            };

            playlistView = new ListView
            {
                HasUnevenRows       = true,
                SeparatorVisibility = SeparatorVisibility.None,
                BackgroundColor     = Color.FromHex("#F1ECCE")
            };

            backBtn = new Button
            {
                Style = (Style)Application.Current.Resources["common-red-btn"],
                Image = "back.png"
            };

            timeOutLbl = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
#endif
                Text                    = "Network Has Timed Out! \n Click To Try Again!",
                LineBreakMode           = LineBreakMode.WordWrap,
                FontSize                = lblSize,
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                HorizontalOptions       = LayoutOptions.CenterAndExpand,
                VerticalOptions         = LayoutOptions.CenterAndExpand,
                TextColor               = Color.White
            };
            timeOutFrame = new Frame
            {
                Content           = timeOutLbl,
                BorderColor       = Color.Black,
                BackgroundColor   = Color.Black,
                HasShadow         = false,
                Padding           = 3,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand
            };
            timeOutTap         = new TapGestureRecognizer();
            timeOutTap.Tapped += (sender, e) =>
            {
                SetContent();
            };
            timeOutLbl.GestureRecognizers.Add(timeOutTap);
            activityIndicator = new ActivityIndicator
            {
                Style = (Style)Application.Current.Resources["common-activity-indicator"]
            };

            //Events
            backBtn.Clicked += async(object sender, EventArgs e) => {
                ToggleButtons();
                await Navigation.PopModalAsync();

                ToggleButtons();
            };

            playlistView.ItemSelected += async(object sender, SelectedItemChangedEventArgs e) => {
                if (isPressed)
                {
                    return;
                }
                else
                {
                    isPressed = true;
                    ToggleButtons();
                    await LoadPlaylist(sender, e);
                }
                isPressed = false;
                ToggleButtons();
            };

            outerGrid.Children.Add(innerGrid, 0, 0);

            Content = outerGrid;
        }
Ejemplo n.º 38
0
        private void AddNameAndUrlName(List<string> fieldNames, ContentView cv, IDictionary<string, Field> fields)
        {
            if (ContentListFieldsOnly)
                return;

            // name and urlname comes first
            if (ExcludedList == null || !ExcludedList.Contains("DisplayName"))
            {
                var nameField = fieldNames.Where(f => f == "DisplayName").FirstOrDefault();
                if (nameField != null)
                {
                    Field field = null;
                    if (fields.TryGetValue(nameField, out field))
                        AddFieldControl(cv, field);
                }
            }
            if (ExcludedList == null || !ExcludedList.Contains("Name"))
            {
                var urlNameField = fieldNames.Where(f => f == "Name").FirstOrDefault();
                if (urlNameField != null)
                {
                    Field field = null;
                    if (fields.TryGetValue(urlNameField, out field))
                        AddFieldControl(cv, field);
                }
            }
        }
        public void Update(UITableView tableView, Cell cell, UITableViewCell nativeCell)
        {
            var parentListView = cell.RealParent as ListView;
            var recycling      = parentListView != null &&
                                 ((parentListView.CachingStrategy & ListViewCachingStrategy.RecycleElement) != 0);

            if (_cell != cell && recycling)
            {
                if (_cell != null)
                {
                    ((INotifyCollectionChanged)_cell.ContextActions).CollectionChanged -= OnContextItemsChanged;
                }

                ((INotifyCollectionChanged)cell.ContextActions).CollectionChanged += OnContextItemsChanged;
            }

            var height = Frame.Height + (parentListView != null && parentListView.SeparatorVisibility == SeparatorVisibility.None ? 0.5f : 0f);
            var width  = ContentView.Frame.Width;

            nativeCell.Frame = new RectangleF(0, 0, width, height);
            nativeCell.SetNeedsLayout();

            var handler = new PropertyChangedEventHandler(OnMenuItemPropertyChanged);

            _tableView = tableView;

            if (_cell != null)
            {
                if (!recycling)
                {
                    _cell.PropertyChanged -= OnCellPropertyChanged;
                }
                if (_menuItems.Count > 0)
                {
                    if (!recycling)
                    {
                        ((INotifyCollectionChanged)_cell.ContextActions).CollectionChanged -= OnContextItemsChanged;
                    }

                    foreach (var item in _menuItems)
                    {
                        item.PropertyChanged -= handler;
                    }
                }

                _menuItems.Clear();
            }

            _menuItems.AddRange(cell.ContextActions);

            _cell = cell;
            if (!recycling)
            {
                cell.PropertyChanged += OnCellPropertyChanged;
                ((INotifyCollectionChanged)_cell.ContextActions).CollectionChanged += OnContextItemsChanged;
            }

            var isOpen = false;

            if (_scroller == null)
            {
                _scroller = new UIScrollView(new RectangleF(0, 0, width, height));
                _scroller.ScrollsToTop = false;
                _scroller.ShowsHorizontalScrollIndicator = false;

                _scroller.PreservesSuperviewLayoutMargins = true;

                ContentView.AddSubview(_scroller);
            }
            else
            {
                _scroller.Frame = new RectangleF(0, 0, width, height);
                isOpen          = ScrollDelegate.IsOpen;

                for (var i = 0; i < _buttons.Count; i++)
                {
                    var b = _buttons[i];
                    b.RemoveFromSuperview();
                    b.Dispose();
                }

                _buttons.Clear();

                ScrollDelegate.Unhook(_scroller);
                ScrollDelegate.Dispose();
            }

            if (ContentCell != nativeCell)
            {
                if (ContentCell != null)
                {
                    ContentCell.RemoveFromSuperview();
                    ContentCell = null;
                }

                ContentCell = nativeCell;

                //Hack: if we have a ImageCell the insets are slightly different,
                //the inset numbers user below were taken using the Reveal app from the default cells
                if ((ContentCell as CellTableViewCell)?.Cell is ImageCell)
                {
                    nfloat imageCellInsetLeft  = 57;
                    nfloat imageCellInsetRight = 0;
                    if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
                    {
                        imageCellInsetLeft  = 89;
                        imageCellInsetRight = imageCellInsetLeft / 2;
                    }
                    SeparatorInset = new UIEdgeInsets(0, imageCellInsetLeft, 0, imageCellInsetRight);
                }

                _scroller.AddSubview(nativeCell);
            }

            SetupButtons(width, height);

            UIView container = null;

            var totalWidth = width;

            for (var i = _buttons.Count - 1; i >= 0; i--)
            {
                var b = _buttons[i];
                totalWidth += b.Frame.Width;

                if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
                {
                    _scroller.AddSubview(b);
                }
                else
                {
                    if (container == null)
                    {
                        container = new iOS7ButtonContainer(b.Frame.Width);
                        _scroller.InsertSubview(container, 0);
                    }

                    container.AddSubview(b);
                }
            }

            _scroller.Delegate    = new ContextScrollViewDelegate(container, _buttons, isOpen);
            _scroller.ContentSize = new SizeF(totalWidth, height);

            if (isOpen)
            {
                _scroller.SetContentOffset(new PointF(ScrollDelegate.ButtonsWidth, 0), false);
            }
            else
            {
                _scroller.SetContentOffset(new PointF(0, 0), false);
            }

            if (ContentCell != null)
            {
                SelectionStyle = ContentCell.SelectionStyle;
            }
        }
Ejemplo n.º 40
0
        private void AddAllFields(ContentView cv, IDictionary<string, Field> fields)
        {
            var visibleFieldNames = GetVisibleFieldNames(this.Content, this.ContentView.ViewMode);
            AddNameAndUrlName(visibleFieldNames, cv, fields);

            foreach (var fieldName in visibleFieldNames)
            {
                if (fieldName == "Name" || fieldName == "DisplayName")
                    continue;

                if (ExcludedList != null && ExcludedList.Contains(fieldName))
                    continue;

                if (ContentListFieldsOnly && !fieldName.StartsWith("#"))
                    continue;

                Field field;
                if (!fields.TryGetValue(fieldName, out field))
                    continue;

                AddFieldControl(cv, field);
            }

            if (EnablePaging) AddThankYouPage();
        }
Ejemplo n.º 41
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ContentWindow"/> class.
        /// </summary>
        /// <param name="editor">The editor.</param>
        public ContentWindow(Editor editor)
            : base(editor, true, ScrollBars.None)
        {
            Title = "Content";

            // Content database events
            editor.ContentDatabase.WorkspaceModified += () => _isWorkspaceDirty = true;
            editor.ContentDatabase.ItemRemoved       += ContentDatabaseOnItemRemoved;

            // Toolstrip
            _toolStrip = new ToolStrip(34.0f)
            {
                Parent = this,
            };
            _importButton = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.Import32, () => Editor.ContentImporting.ShowImportFileDialog(CurrentViewFolder)).LinkTooltip("Import content");
            _toolStrip.AddSeparator();
            _navigateBackwardButton = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.ArrowLeft32, NavigateBackward).LinkTooltip("Navigate backward");
            _navigateForwardButton  = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.ArrowRight32, NavigateForward).LinkTooltip("Navigate forward");
            _navigateUpButton       = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.ArrowUp32, NavigateUp).LinkTooltip("Navigate up");

            // Navigation bar
            _navigationBar = new NavigationBar
            {
                Parent = this,
            };

            // Split panel
            _split = new SplitPanel(Orientation.Horizontal, ScrollBars.Both, ScrollBars.Vertical)
            {
                AnchorPreset  = AnchorPresets.StretchAll,
                Offsets       = new Margin(0, 0, _toolStrip.Bottom, 0),
                SplitterValue = 0.2f,
                Parent        = this,
            };

            // Content structure tree searching query input box
            var headerPanel = new ContainerControl
            {
                AnchorPreset = AnchorPresets.HorizontalStretchTop,
                IsScrollable = true,
                Offsets      = new Margin(0, 0, 0, 18 + 6),
                Parent       = _split.Panel1,
            };

            _foldersSearchBox = new TextBox
            {
                AnchorPreset  = AnchorPresets.HorizontalStretchMiddle,
                WatermarkText = "Search...",
                Parent        = headerPanel,
                Bounds        = new Rectangle(4, 4, headerPanel.Width - 8, 18),
            };
            _foldersSearchBox.TextChanged += OnFoldersSearchBoxTextChanged;

            // Content structure tree
            _tree = new Tree(false)
            {
                Y      = headerPanel.Bottom,
                Parent = _split.Panel1,
            };
            _tree.SelectedChanged += OnTreeSelectionChanged;

            // Content items searching query input box and filters selector
            var contentItemsSearchPanel = new ContainerControl
            {
                AnchorPreset = AnchorPresets.HorizontalStretchTop,
                IsScrollable = true,
                Offsets      = new Margin(0, 0, 0, 18 + 8),
                Parent       = _split.Panel2,
            };
            const float viewDropdownWidth = 50.0f;

            _itemsSearchBox = new TextBox
            {
                AnchorPreset  = AnchorPresets.HorizontalStretchMiddle,
                WatermarkText = "Search...",
                Parent        = contentItemsSearchPanel,
                Bounds        = new Rectangle(viewDropdownWidth + 8, 4, contentItemsSearchPanel.Width - 12 - viewDropdownWidth, 18),
            };
            _itemsSearchBox.TextChanged += UpdateItemsSearch;
            _viewDropdown = new ViewDropdown
            {
                AnchorPreset       = AnchorPresets.MiddleLeft,
                SupportMultiSelect = true,
                TooltipText        = "Change content view and filter options",
                Parent             = contentItemsSearchPanel,
                Offsets            = new Margin(4, viewDropdownWidth, -9, 18),
            };
            _viewDropdown.SelectedIndexChanged += e => UpdateItemsSearch();
            for (int i = 0; i <= (int)ContentItemSearchFilter.Other; i++)
            {
                _viewDropdown.Items.Add(((ContentItemSearchFilter)i).ToString());
            }
            _viewDropdown.PopupCreate += OnViewDropdownPopupCreate;

            // Content View
            _view = new ContentView
            {
                AnchorPreset = AnchorPresets.HorizontalStretchTop,
                Offsets      = new Margin(0, 0, contentItemsSearchPanel.Bottom + 4, 0),
                IsScrollable = true,
                Parent       = _split.Panel2,
            };
            _view.OnOpen         += Open;
            _view.OnNavigateBack += NavigateBackward;
            _view.OnRename       += Rename;
            _view.OnDelete       += Delete;
            _view.OnDuplicate    += Duplicate;
            _view.OnPaste        += Paste;
        }
Ejemplo n.º 42
0
        private void AddFieldsOrder(ContentView cv, IDictionary<string, Field> fields)
        {
            string[] fieldList = FieldsOrder.Split(' ');
            AddNameAndUrlName(fieldList.ToList(), cv, fields);

            foreach (string fieldName in fieldList)
            {
                if (fieldName == "Name" || fieldName == "DisplayName")
                    continue;

                Field field = null;
                if (fields.TryGetValue(fieldName, out field))
                    AddFieldControl(cv, field);
            }

            if (EnablePaging) AddThankYouPage();
        }
        public void ShowLoadingOverlay(bool coverTopNavBar = true, string loadingText = null)
        {
            if (IsLoadingOverlayVisible)
            {
                return;
            }

            if (_loadingIndicatorView == null)
            {
                _loadingIndicatorView = new UIView()
                {
                    TranslatesAutoresizingMaskIntoConstraints = false,
                    BackgroundColor = UIColor.FromWhiteAlpha(1, loadingText == null ? 0.5f : 0.8f)
                };

                var topSpacer = new UIView()
                {
                    TranslatesAutoresizingMaskIntoConstraints = false
                };
                var bottomSpacer = new UIView()
                {
                    TranslatesAutoresizingMaskIntoConstraints = false
                };
                _loadingIndicatorView.Add(topSpacer);
                _loadingIndicatorView.Add(bottomSpacer);

                _loadingIndicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge)
                {
                    TranslatesAutoresizingMaskIntoConstraints = false,
                    Color = ColorResources.PowerPlannerAccentBlue
                };
                _loadingIndicatorView.Add(_loadingIndicator);
                _loadingIndicator.StretchWidth(_loadingIndicatorView);

                _loadingIndicatorLabel = new UILabel()
                {
                    TranslatesAutoresizingMaskIntoConstraints = false,
                    Hidden        = true,
                    TextColor     = ColorResources.PowerPlannerAccentBlue,
                    TextAlignment = UITextAlignment.Center
                };
                _loadingIndicatorView.Add(_loadingIndicatorLabel);
                _loadingIndicatorLabel.StretchWidth(_loadingIndicatorView);

                _loadingIndicatorView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[topSpacer][indicator][label][bottomSpacer(==topSpacer)]|", NSLayoutFormatOptions.DirectionLeadingToTrailing, null, new NSDictionary(
                                                                                             "indicator", _loadingIndicator,
                                                                                             "label", _loadingIndicatorLabel,
                                                                                             "topSpacer", topSpacer,
                                                                                             "bottomSpacer", bottomSpacer)));
            }

            if (coverTopNavBar)
            {
                View.Add(_loadingIndicatorView);
                _loadingIndicatorView.StretchWidthAndHeight(View);
            }
            else
            {
                ContentView.Add(_loadingIndicatorView);
                _loadingIndicatorView.StretchWidthAndHeight(ContentView);
            }

            if (loadingText == null)
            {
                _loadingIndicatorLabel.Hidden = true;
                _loadingIndicatorLabel.SetHeight(0);
            }
            else
            {
                _loadingIndicatorLabel.Hidden = false;
                _loadingIndicatorLabel.Text   = loadingText;
            }

            _loadingIndicator.StartAnimating();

            _isLoadingOverlayVisible = true;
        }
Ejemplo n.º 44
0
        private void AddFieldControl(ContentView cv, Field field)
        {
            if (field == null)
                return;
            if (field.FieldSetting.FieldClassName == typeof(PageBreakField).ToString())
            {
                currentPage++;
                return;
            }

            Control control = CreateDefaultFieldControl(field);

            var fieldControl = control as FieldControl;
            if (IsReadOnly(field.Name) && fieldControl != null)
                fieldControl.ReadOnly = true;

            if (fieldControl != null)
                fieldControl.FrameMode = FieldControlFrameMode.ShowFrame;

            control.ID = String.Concat("Generic", _id++);

            var visibility = GetFieldVisibility(cv.ViewMode, field);

            if (!EnablePaging)
            {
                if (visibility == FieldVisibility.Advanced && AdvancedPanel != null)
                {
                    AdvancedPanel.Controls.Add(control);
                }
                else
                {
                    Controls.Add(control);
                }
            }
            else
            {
                _wizard.WizardSteps[currentPage].Controls.Add(control);
            }
        }
Ejemplo n.º 45
0
		//Issue 1384
		public void ImageInStarCellIsProperlyConstrained ()
		{
			var platform = new UnitPlatform ();

			var content = new Image { 
				Aspect= Aspect.AspectFit,
				Platform = platform,
				MinimumHeightRequest = 10,
				MinimumWidthRequest = 50,
				IsPlatformEnabled = true 
			};
			var grid = new Grid {
				Platform = platform, 
				IsPlatformEnabled = true,
				BackgroundColor = Color.Red, 
				VerticalOptions=LayoutOptions.Start,
				Children = {
					content
				}
			};
			var view = new ContentView {
				Platform = platform, 
				IsPlatformEnabled = true,
				Content = grid,
			};
			view.Layout (new Rectangle (0, 0, 100, 100));
			Assert.AreEqual (100, grid.Width);
			Assert.AreEqual (20, grid.Height);

			view.Layout (new Rectangle (0, 0, 50, 50));
			Assert.AreEqual (50, grid.Width);
			Assert.AreEqual (10, grid.Height);
		}
Ejemplo n.º 46
0
 public ImageCell(System.Drawing.RectangleF frame) : base(frame)
 {
     imageView             = new UIImageView(new RectangleF(0, 0, 50, 50));
     imageView.ContentMode = UIViewContentMode.ScaleAspectFit;
     ContentView.AddSubview(imageView);
 }
 private void rightTemplate_BindingContextChanged(object sender, EventArgs e)
 {
     rightTemplateView = sender as ContentView;
 }
Ejemplo n.º 48
0
        protected override void Init()
        {
            var result = new Label
            {
                Text = "Original"
            };

            var grid = new Grid
            {
                IsEnabled     = true,
                WidthRequest  = 250,
                HeightRequest = 50,
                AutomationId  = "grid"
            };

            AddTapGesture(result, grid);

            var contentView = new ContentView
            {
                IsEnabled     = true,
                WidthRequest  = 250,
                HeightRequest = 50,
                AutomationId  = "contentView"
            };

            AddTapGesture(result, contentView);

            var stackLayout = new StackLayout
            {
                IsEnabled     = true,
                WidthRequest  = 250,
                HeightRequest = 50,
                AutomationId  = "stackLayout"
            };

            AddTapGesture(result, stackLayout);

            var color = new Button
            {
                Text    = "Toggle colors",
                Command = new Command(() =>
                {
                    if (!_flag)
                    {
                        grid.BackgroundColor        = Color.Red;
                        contentView.BackgroundColor = Color.Blue;
                        stackLayout.BackgroundColor = Color.Yellow;
                    }
                    else
                    {
                        grid.BackgroundColor        = Color.Default;
                        contentView.BackgroundColor = Color.Default;
                        stackLayout.BackgroundColor = Color.Default;
                    }

                    _flag = !_flag;
                }),
                AutomationId = "color"
            };

            var disabled = new Button
            {
                Text    = "Disabled",
                Command = new Command(() =>
                {
                    grid.IsEnabled        = false;
                    contentView.IsEnabled = false;
                    stackLayout.IsEnabled = false;

                    result.Text = "Original";
                }),
                AutomationId = "disabled"
            };

            var parent = new StackLayout
            {
                Spacing           = 10,
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Children          =
                {
                    color,
                    disabled,
                    result,
                    grid,
                    contentView,
                    stackLayout
                }
            };

            Content = parent;
        }
Ejemplo n.º 49
0
		public void ContentParentIsNotInsideTempalte ()
		{
			var platform = new UnitPlatform ();

			var contentView = new ContentView ();
			var child = new View ();

			contentView.ControlTemplate = new ControlTemplate (typeof (SimpleTemplate));
			contentView.Content = child;
			contentView.Platform = platform;

			Assert.AreEqual (contentView, child.Parent);
		}
Ejemplo n.º 50
0
		public void DoesNotInheritBindingContextToTemplate ()
		{
			var platform = new UnitPlatform ();

			var contentView = new ContentView ();
			var child = new View ();

			contentView.ControlTemplate = new ControlTemplate (typeof (SimpleTemplate));
			contentView.Content = child;
			contentView.Platform = platform;

			var bc = "Test";
			contentView.BindingContext = bc;

			Assert.AreNotEqual (bc, contentView.LogicalChildren[0].BindingContext);
			Assert.IsNull (contentView.LogicalChildren[0].BindingContext);
		}
Ejemplo n.º 51
0
        public void Transform(string text, ContentView view)
        {
            var xTmpl = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                                 "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:msxsl=\"urn:schemas-microsoft-com:xslt\" exclude-result-prefixes=\"msxsl\">" +
                                 "<xsl:output method=\"html\" indent=\"yes\"/>" +
                                 "<xsl:template match=\"/\"></xsl:template></xsl:stylesheet>";
            var xsltDoc = XDocument.Parse(xTmpl);
            XNamespace ns = "http://www.w3.org/1999/XSL/Transform";

            //var text = "<div class=\"d-layout-box d-h-box\" data-box=\"hbox\"><div style=\"width: 105px; height: 100px;\" class=\"d-box d-inline\"><div class=\"d-field-holder d-inline\" data-type=\"image\" data-link=\"true\" data-label=\"Cover\" data-field=\"cover\"></div></div><div style=\"width: 441px;\" class=\"d-box d-inline\"><div class=\"d-field-holder\" data-type=\"text\" data-link=\"true\" data-label=\"Title\" data-field=\"title\"></div><div class=\"d-field-holder\" data-type=\"note\" data-link=\"true\" data-label=\"Body\" data-field=\"body\"></div></div></div>";
            //Add params
            xsltDoc.Root.Add(new XElement(ns + "param", new XAttribute("name", "appPath")),
                new XElement(ns + "param", new XAttribute("name", "web")),
                new XElement(ns + "param", new XAttribute("name", "list")),
                new XElement(ns + "param", new XAttribute("name", "view")),
                new XElement(ns + "param", new XAttribute("name", "lang"))
                );

            var tmplElement = xsltDoc.Root.Element(ns + "template");
            var listElement = new XElement("ul", new XAttribute("class", "d-view-list"));
            tmplElement.Add(listElement);
            var rowTmpl = XElement.Parse(text);
            var forEachElement = new XElement(ns + "for-each",
                new XAttribute("select", @"//rows/row"), new XElement("li",new XAttribute("class","d-view-item"), rowTmpl));

            listElement.Add(forEachElement);

            rowTmpl.DescendantsAndSelf()
                .Where(f => f.Attribute("data-field") != null)
                .ToList()
                .AsParallel()
                .ForAll(e =>
                {
                    var fieldName = e.Attribute("data-field").Value;
                    var linkToItem = e.BoolAttr("data-link");
                    var inline = e.BoolAttr("data-line");
                    var fieldType = e.Attribute("data-type").Value;

                    var showLabel = !e.BoolAttr("data-label-hidden");
                    //label=e.Element("label")
                    //e.ReplaceWith(new XElement(ns + "value-of", new XAttribute("select", fieldName)));
                    var applyTemplate = new XElement(ns + "apply-templates", new XAttribute("select", fieldName));

                    var fieldTmpl = new XElement(ns + "template", new XAttribute("match", fieldName));
                    XElement linkTmpl = null;
                    if (linkToItem)
                    {
                        linkTmpl = new XElement(ns + "element", new XAttribute("name", "a"),
                            new XElement(ns + "attribute", new XAttribute("name", "href"), new XElement(ns + "value-of", new XAttribute("select", "concat($appPath,'/',$web,'/',$lang,'/lists/',$list,'/items/',../@Slug,'.html')"))));
                    }

                    XElement fieldContentTmpl = null;

                    if (fieldType == "image")
                    {
                        fieldContentTmpl = new XElement(ns + "element", new XAttribute("name", "img"),
                            new XElement(ns + "attribute", new XAttribute("name", "src"),
                            new XElement(ns + "value-of", new XAttribute("select", ".")))
                            );
                    }
                    else
                    {
                        fieldContentTmpl = new XElement(ns + "element", new XAttribute("name", inline ? "span" : "div"),
                            new XElement(ns + "value-of", new XAttribute("select", ".")));
                    }

                    if (inline)
                        fieldContentTmpl.Add(new XAttribute("class", "d-inline"));

                    if (linkTmpl != null)
                    {
                        linkTmpl.Add(fieldContentTmpl);
                        fieldTmpl.Add(linkTmpl);
                    }
                    else
                        fieldTmpl.Add(fieldContentTmpl);

                    xsltDoc.Root.Add(fieldTmpl);
                    //new template
                    //e.ReplaceWith(applyTemplate);
                    e.Add(applyTemplate);
                });

            //return xsltDoc.ToString();
            var result = new ContentTemplate()
            {
                ContentType = this.ContentType,
                Text = xsltDoc.ToString()
            };

            view.BodyTemplateXml = result.ToXml();
        }
Ejemplo n.º 52
0
        private IBlockView ViewFromProcDefBlock(ProcDefBlock b)
        {
            List<IBlockView> subContent = new List<IBlockView>();
            int i = 0;
            int n = b.Bits.Count;

            BitArray trueArgs = new BitArray(n);
            DataType[] argTypes = new DataType[n];
            // slow: Repeats instanceof test twice for all bits; once for height and once to add to subContent
            int height = b.Bits.Count==0?1: b.Bits.Max(bb => ArgBitTextHeight(bb));

            foreach (IProcDefBit bit in b.Bits)
            {
                if (bit is VarDefBlock)
                {
                    VarDefBlock vb = (VarDefBlock)bit;
                    EditableVarDefView vv = new EditableVarDefView(vb,
                        MakeTextBitBitmap(vb.Name, height),
                        varb_parts,
                        textMetrics, textFont);
                    blockViews[vb] = vv;
                    subContent.Add(vv);
                    trueArgs[i] = true;
                    argTypes[i] = vb.Type;
                    vb.TextChanged += new VarDefBlockTextChangedEvent(ProcDef_FormalParamTextChanged);
                }
                else
                {
                    ProcDefTextBit ptb = (ProcDefTextBit) bit;
                    EditableLabelView ev = new EditableLabelView(
                        MakeTextBitBitmap(ptb.Text, height),
                        ptb);
                    blockViews[ptb] = ev;
                    subContent.Add(ev);
                    argTypes[i] = DataType.Invalid;
                    trueArgs[i] = false;
                    ptb.TextChanged += new ProcDefTextBitTextChangedEvent(ProcDefTextBit_TextChanged);

                }
                ++i;
            }

            Bitmap[] defineTextView = RenderTextBits(new string[] { "define" });
            ContentView innerContent = new ContentView(subContent.ToArray(), argTypes, trueArgs, sb_parts);
            ContentView outerContent = new ContentView(new IBlockView[] {
                new LabelView(defineTextView[0]),
                innerContent
            }, new DataType[] { DataType.Invalid },
                new BitArray(new bool[] { false, true }), pdb_parts);

            ProcDefView pdb = new ProcDefView(b, outerContent, innerContent);
            b.FormalParamAdded += new ProcDefBitAddedEvent(ProcDefBlock_FormalParamAdded);
            b.FormalParamRemoved += new ProcDefBitRemovedEvent(ProcDefBlock_FormalParamRemoved);
            b.FormalParamChanged += new ProcDefBitChangedEvent(ProcDefBlock_FormalParamChanged);
            return pdb;
        }
Ejemplo n.º 53
0
        public PhotoEditPage(Photo photo)
        {
            this.photo = photo;

            ToolbarItems.Add(new ToolbarItem
            {
                Text    = AppResources.PhotoEdit_finished,
                Icon    = "ic_done_white_24dp.png",
                Order   = ToolbarItemOrder.Primary,
                Command = new Command(() => CommitChanges())
            });

            if (!string.IsNullOrWhiteSpace(photo.Url))
            {
                ToolbarItem deleteItem = new ToolbarItem
                {
                    Text    = AppResources.PhotoEdit_delete,
                    Order   = ToolbarItemOrder.Secondary,
                    Command = new Command(() => DeletePhoto())
                };

                Device.OnPlatform(
                    iOS: () => {
                    deleteItem.Icon = "ic_delete.png";
                });

                ToolbarItems.Add(deleteItem);
            }

            Title = Utils.GetDateString(photo.CreatedAt);

            StackLayout layout = new StackLayout
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            ScrollView scroller = new ScrollView
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            RelativeLayout content = new RelativeLayout
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            CachedImage theImage = new CachedImage()
            {
                Aspect               = Aspect.AspectFill,
                VerticalOptions      = LayoutOptions.FillAndExpand,
                HorizontalOptions    = LayoutOptions.CenterAndExpand,
                HeightRequest        = 500,
                TransparencyEnabled  = false,
                DownsampleToViewSize = true,
                CacheDuration        = TimeSpan.FromDays(30)
            };

            if (photo.InMemory != null)
            {
                theImage.Source = ImageSource.FromStream(() => new MemoryStream(photo.InMemory));
            }
            else
            {
                theImage.Source = photo.GetReqUrl(false);
            }

            content.Children.Add(theImage, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent((parent) => {
                return(parent.Width);
            }));

            treatment = new Editor
            {
                HorizontalOptions = LayoutOptions.Fill
            };

            if (!string.IsNullOrWhiteSpace(photo.Treatment))
            {
                treatment.Text = photo.Treatment;
            }

            notes = new Editor
            {
                HorizontalOptions = LayoutOptions.Fill
            };

            if (!string.IsNullOrWhiteSpace(photo.Notes))
            {
                notes.Text = photo.Notes;
            }

            description = new Editor
            {
                HorizontalOptions = LayoutOptions.Fill
            };
            if (!string.IsNullOrWhiteSpace(photo.PhotoDescription))
            {
                description.Text = photo.PhotoDescription;
            }

            StackLayout details = new StackLayout
            {
                Padding           = 20,
                VerticalOptions   = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.Fill,
                Spacing           = 10,
                Children          =
                {
                    new Label {
                        Text = Utils.GetDateString(photo.CreatedAt), FontAttributes = FontAttributes.Bold, FontSize = 24
                    },
                    new Label {
                        Text = AppResources.PhotoEdit_treatment, FontAttributes = FontAttributes.Bold, FontSize = 20
                    },
                    treatment,
                    new Label {
                        Text = AppResources.PhotoEdit_notes, FontAttributes = FontAttributes.Bold, FontSize = 20
                    },
                    notes,
                    new Label {
                        Text = AppResources.PhotoEdit_shotConditions, FontAttributes = FontAttributes.Bold, FontSize = 20
                    },
                    description
                }
            };

            content.Children.Add(details, Constraint.Constant(0),
                                 Constraint.RelativeToView(theImage, (parent, view) =>
            {
                return(view.Y + view.Height + 10);
            }));

            scroller.Content = content;

            // Windows phone doesn't have an action bar, so we need to add the page title as a label
            if (Device.OS == TargetPlatform.WinPhone)
            {
                ContentView titleView = new ContentView {
                    Padding = 15
                };
                titleView.Content = new Label {
                    Text = Title
                };
                layout.Children.Add(titleView);
            }

            layout.Children.Add(scroller);

            Content = layout;
        }
Ejemplo n.º 54
0
		public void TestFrameLayout ()
		{
			View child;

			var contentView = new ContentView {
				Padding = new Thickness (10),
				Content = child = new View {
					WidthRequest = 100,
					HeightRequest = 200,
					IsPlatformEnabled = true
				},
				IsPlatformEnabled = true,
				Platform = new UnitPlatform ()
			};

			Assert.AreEqual (new Size (120, 220), contentView.GetSizeRequest (double.PositiveInfinity, double.PositiveInfinity).Request);

			contentView.Layout (new Rectangle (0, 0, 300, 300));

			Assert.AreEqual (new Rectangle (10, 10, 280, 280), child.Bounds);
		}
Ejemplo n.º 55
0
        public SparkleEventLog() : base()
        {
            Title    = "Recent Changes";
            Delegate = new SparkleEventsDelegate();

            int   min_width  = 480;
            int   min_height = 640;
            float x          = (float)(NSScreen.MainScreen.Frame.Width * 0.61);
            float y          = (float)(NSScreen.MainScreen.Frame.Height * 0.5 - (min_height * 0.5));

            SetFrame(
                new RectangleF(
                    new PointF(x, y),
                    new SizeF(min_width, (int)(NSScreen.MainScreen.Frame.Height * 0.85))),
                true);

            StyleMask = (NSWindowStyle.Closable | NSWindowStyle.Miniaturizable |
                         NSWindowStyle.Titled | NSWindowStyle.Resizable);

            MinSize        = new SizeF(min_width, min_height);
            HasShadow      = true;
            BackingType    = NSBackingStore.Buffered;
            TitlebarHeight = Frame.Height - ContentView.Frame.Height;


            this.web_view = new WebView(new RectangleF(0, 0, 481, 579), "", "")
            {
                Frame = new RectangleF(new PointF(0, 0),
                                       new SizeF(ContentView.Frame.Width, ContentView.Frame.Height - 39))
            };


            this.hidden_close_button = new NSButton()
            {
                KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask,
                KeyEquivalent             = "w"
            };

            this.hidden_close_button.Activated += delegate {
                Controller.WindowClosed();
            };


            this.size_label = new NSTextField()
            {
                Alignment       = NSTextAlignment.Right,
                BackgroundColor = NSColor.WindowBackground,
                Bordered        = false,
                Editable        = false,
                Frame           = new RectangleF(
                    new PointF(0, ContentView.Frame.Height - 30),
                    new SizeF(60, 20)),
                StringValue = "Size:",
                Font        = SparkleUI.BoldFont
            };

            this.size_label_value = new NSTextField()
            {
                Alignment       = NSTextAlignment.Left,
                BackgroundColor = NSColor.WindowBackground,
                Bordered        = false,
                Editable        = false,
                Frame           = new RectangleF(
                    new PointF(60, ContentView.Frame.Height - 30),
                    new SizeF(60, 20)),
                StringValue = "…",
                Font        = SparkleUI.Font
            };


            this.history_label = new NSTextField()
            {
                Alignment       = NSTextAlignment.Right,
                BackgroundColor = NSColor.WindowBackground,
                Bordered        = false,
                Editable        = false,
                Frame           = new RectangleF(
                    new PointF(130, ContentView.Frame.Height - 30),
                    new SizeF(60, 20)),
                StringValue = "History:",
                Font        = SparkleUI.BoldFont
            };

            this.history_label_value = new NSTextField()
            {
                Alignment       = NSTextAlignment.Left,
                BackgroundColor = NSColor.WindowBackground,
                Bordered        = false,
                Editable        = false,
                Frame           = new RectangleF(
                    new PointF(190, ContentView.Frame.Height - 30),
                    new SizeF(60, 20)
                    ),
                StringValue = "…",
                Font        = SparkleUI.Font
            };

            this.popup_button = new NSPopUpButton()
            {
                Frame = new RectangleF(
                    new PointF(ContentView.Frame.Width - 156 - 12, ContentView.Frame.Height - 33),
                    new SizeF(156, 26)),
                PullsDown = false
            };

            this.background = new NSBox()
            {
                Frame = new RectangleF(
                    new PointF(-1, -1),
                    new SizeF(Frame.Width + 2, this.web_view.Frame.Height + 2)),
                FillColor   = NSColor.White,
                BorderColor = NSColor.LightGray,
                BoxType     = NSBoxType.NSBoxCustom
            };

            this.progress_indicator = new NSProgressIndicator()
            {
                Frame = new RectangleF(
                    new PointF(Frame.Width / 2 - 10, this.web_view.Frame.Height / 2 + 10),
                    new SizeF(20, 20)),
                Style = NSProgressIndicatorStyle.Spinning
            };

            this.progress_indicator.StartAnimation(this);

            ContentView.AddSubview(this.size_label);
            ContentView.AddSubview(this.size_label_value);
            ContentView.AddSubview(this.history_label);
            ContentView.AddSubview(this.history_label_value);
            ContentView.AddSubview(this.popup_button);
            ContentView.AddSubview(this.progress_indicator);
            ContentView.AddSubview(this.background);
            ContentView.AddSubview(this.hidden_close_button);

            (Delegate as SparkleEventsDelegate).WindowResized += delegate(SizeF new_window_size) {
                Program.Controller.Invoke(() => Relayout(new_window_size));
            };


            // Hook up the controller events
            Controller.HideWindowEvent += delegate {
                Program.Controller.Invoke(() => {
                    this.progress_indicator.Hidden = true;
                    PerformClose(this);
                });
            };

            Controller.ShowWindowEvent += delegate {
                Program.Controller.Invoke(() => OrderFrontRegardless());
            };

            Controller.UpdateChooserEvent += delegate(string [] folders) {
                Program.Controller.Invoke(() => UpdateChooser(folders));
            };

            Controller.UpdateChooserEnablementEvent += delegate(bool enabled) {
                Program.Controller.Invoke(() => { this.popup_button.Enabled = enabled; });
            };

            Controller.UpdateContentEvent += delegate(string html) {
                Program.Controller.Invoke(() => {
                    this.progress_indicator.Hidden = true;
                    UpdateContent(html);
                });
            };

            Controller.ContentLoadingEvent += delegate {
                Program.Controller.Invoke(() => {
                    this.web_view.RemoveFromSuperview();
                    this.progress_indicator.Hidden = false;
                    this.progress_indicator.StartAnimation(this);
                });
            };

            Controller.UpdateSizeInfoEvent += delegate(string size, string history_size) {
                Program.Controller.Invoke(() => {
                    this.size_label_value.StringValue    = size;
                    this.history_label_value.StringValue = history_size;
                });
            };

            Controller.ShowSaveDialogEvent += delegate(string file_name, string target_folder_path) {
                Program.Controller.Invoke(() => {
                    NSSavePanel panel = new NSSavePanel()
                    {
                        DirectoryUrl         = new NSUrl(target_folder_path, true),
                        NameFieldStringValue = file_name,
                        ParentWindow         = this,
                        Title = "Restore from History",
                        PreventsApplicationTerminationWhenModal = false
                    };

                    if ((NSPanelButtonType)panel.RunModal() == NSPanelButtonType.Ok)
                    {
                        string target_file_path = Path.Combine(panel.DirectoryUrl.RelativePath, panel.NameFieldStringValue);
                        Controller.SaveDialogCompleted(target_file_path);
                    }
                    else
                    {
                        Controller.SaveDialogCancelled();
                    }
                });
            };
        }
Ejemplo n.º 56
0
 private void __InitComponentRuntime()
 {
     Xamarin.Forms.Xaml.Extensions.LoadFromXaml <EmptyView>((M0)this, typeof(EmptyView));
     this.View = (ContentView)NameScopeExtensions.FindByName <ContentView>((Element)this, "View");
 }
Ejemplo n.º 57
0
        public IBlockView ViewFromInvokationBlock(InvokationBlock b, BlockAttributes attribute)
        {
            string[] textParts = b.Text.SplitFuncArgs();
            Bitmap[] textBitmaps = RenderTextBits(textParts);

            if (b.ArgTypes.All(t => t != DataType.Script))
            {
                // it ain't a C block
                List<IBlockView> subContent = new List<IBlockView>();
                int i = 0;
                int currentArg = 0;
                BitArray trueArgs = new BitArray(textParts.Length);
                foreach (string s in textParts)
                {
                    if (s == "%")
                    {
                        subContent.Add(ViewFromBlock(b.Args[currentArg++]));
                        trueArgs[i] = true;
                    }
                    else
                    {
                        subContent.Add(new LabelView(textBitmaps[i]));
                        trueArgs[i] = false;
                    }
                    ++i;
                }

                NineContent imageParts = sb_parts; // dummy initial val
                switch (attribute)
                {
                    case BlockAttributes.Stack:
                        imageParts = sb_parts;
                        break;
                    case BlockAttributes.Report:
                        if (b.ReturnType == DataType.Boolean)
                            imageParts = bool_parts;
                        else
                            imageParts = fib_parts;
                        break;
                    case BlockAttributes.Cap:
                        imageParts = capb_parts;
                        break;
                    case BlockAttributes.Hat:
                        imageParts = hatb_parts;
                        break;
                }

                ContentView content = new ContentView(subContent.ToArray(), b.ArgTypes.ToArray(), trueArgs, imageParts);
                InvokationBlockView ib = new InvokationBlockView(b, attribute, content);
                b.OnArgChanged += new InvokationBlockArgChangeEvent(InvokationBlock_ArgChanged);

                return ib;

            }
            else
            {
                // it's a C block, yappari
                List<ContentView> contents = new List<ContentView>();
                List<IBlockView> subContent = new List<IBlockView>();
                List<DataType> subArgTypes = new List<DataType>();
                List<BlockStackView> scripts = new List<BlockStackView>();
                List<ArgumentPartition> argPartitions = new List<ArgumentPartition>();
                List<bool> trueArgs = new List<bool>();
                int currentArg = 0;
                int currentPartitionCount = 0;
                int i = 0;
                bool head = true;
                foreach (string s in textParts)
                {
                    if (s != "%")
                    {
                        LabelView lv = new LabelView(textBitmaps[i]);
                        subContent.Add(lv);
                        trueArgs.Add(false);
                    }
                    else
                    {
                        // It's an arg. Script or normal?
                        DataType type = b.ArgTypes[currentArg];
                        IBlock arg = b.Args[currentArg];
                        if (type != DataType.Script)
                        {
                            // Oh it's just a normal argument
                            IBlockView bv = ViewFromBlock(arg);
                            subContent.Add(bv);
                            subArgTypes.Add(type);
                            trueArgs.Add(true);
                            currentPartitionCount++;
                        }
                        else
                        {
                            // We need to split a new head or waist in the C block
                            NineContent nc;
                            if (head)
                            {
                                nc = cb_parts.Head;
                                head = false;
                            }
                            else
                            {
                                nc = cb_parts.Waist;
                            }
                            ContentView cv = new ContentView(subContent.ToArray(), subArgTypes.ToArray(), new BitArray(trueArgs.ToArray()), nc);
                            contents.Add(cv);
                            ArgumentPartition ap = new ArgumentPartition(currentPartitionCount, ArgViewType.Content);
                            argPartitions.Add(ap);
                            currentPartitionCount = 0;

                            BlockStackView side = (BlockStackView)ViewFromBlock((BlockStack)arg);
                            scripts.Add(side);
                            ap = new ArgumentPartition(1, ArgViewType.Script);
                            argPartitions.Add(ap);
                            subContent = new List<IBlockView>();
                            subArgTypes = new List<DataType>();
                            trueArgs = new List<bool>();

                        }
                        currentArg++;
                    }
                    i++;
                }
                b.OnArgChanged +=new InvokationBlockArgChangeEvent(InvokationBlock_ArgChanged);
                CBlockView cb = new CBlockView(b, attribute, contents, scripts, cb_parts, argPartitions);

                return cb;
            }
        }
Ejemplo n.º 58
0
 public UITableViewCellAdapter(UIView cellView, string reuseId) : base(UITableViewCellStyle.Default, reuseId)
 {
     CellView = cellView;
     ContentView.AddSubview(CellView);
     BackgroundColor = CellView.BackgroundColor;
 }
Ejemplo n.º 59
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            BackgroundView = new UIImageView();

            accept.SetTitleColor(UIColor.White, UIControlState.Normal);
            decline.SetTitleColor(UIColor.White, UIControlState.Normal);

            numberAndDate.TextColor       =
                title.TextColor           =
                    startAndEnd.TextColor =
                        numberAndDate.HighlightedTextColor       =
                            title.HighlightedTextColor           =
                                startAndEnd.HighlightedTextColor = Theme.LabelColor;

            contact.IconImage = Theme.IconPhone;
            address.IconImage = Theme.Map;

            status.StatusChanged += (sender, e) => SaveAssignment();
            status.Completed     += (sender, e) => {
                var menuViewModel = ServiceContainer.Resolve <MenuViewModel>();
                menuViewModel.MenuIndex = SectionIndex.Confirmations;
                assignmentViewModel.SelectedAssignment = status.Assignment;
                controller.PerformSegue("AssignmentDetails", controller);
            };

            if (Theme.IsiOS7)
            {
                priorityBackground.Image = Theme.NumberBoxHollow;
                accept.SetTitleColor(Theme.GreenColor, UIControlState.Normal);
                decline.SetTitleColor(Theme.RedColor, UIControlState.Normal);
                accept.Font           =
                    decline.Font      = Theme.FontOfSize(16);
                startAndEnd.Font      = Theme.BoldFontOfSize(10);
                startAndEnd.TextColor = UIColor.White;

                priority.TextColor =
                    priority.HighlightedTextColor = Theme.LightGrayColor;

                //Status frame
                var frame = status.Frame;
                frame.Width /= 2;
                frame.X     += frame.Width;
                status.Frame = frame;

                //Priority frame
                frame       = priorityBackground.Frame;
                frame.Width = frame.Height;
                priorityBackground.Frame =
                    priority.Frame       = frame;

                //Start/end date
                frame             = startAndEnd.Frame;
                frame.X          += 4;
                startAndEnd.Frame = frame;

                //Additional green rectangle on the right
                statusView = new UIView(new CGRect(Frame.Width - 8, 0, 8, Frame.Height))
                {
                    BackgroundColor  = Theme.YellowColor,
                    AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleLeftMargin,
                };
                AddSubview(statusView);

                //Additional box for the start/end date
                frame        = startAndEnd.Frame;
                frame.X     -= 4;
                frame.Y     += 4;
                frame.Width  = 102;
                frame.Height = 16;
                var timeBox = new UIImageView(frame)
                {
                    Image       = Theme.TimeBox,
                    ContentMode = UIViewContentMode.Left,
                };
                ContentView.AddSubview(timeBox);
                ContentView.BringSubviewToFront(startAndEnd);
            }
            else
            {
                priorityBackground.Image = Theme.NumberBox;
                accept.SetBackgroundImage(Theme.Accept, UIControlState.Normal);
                decline.SetBackgroundImage(Theme.Decline, UIControlState.Normal);

                priority.TextColor =
                    priority.HighlightedTextColor = UIColor.White;
            }
        }
Ejemplo n.º 60
0
 public override CGSize SizeThatFits(CGSize size)
 {
     return(CellView?.SizeThatFits(size) ?? ContentView.SizeThatFits(size));
 }