Пример #1
0
        protected override void InitializeCell()
        {
            var layout = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal,
                Padding     = new Thickness(20, 10)
            };

            _exhibitorImage = new DownloadedImage(AppResources.DefaultExhibitorImage)
            {
                WidthRequest  = 40,
                HeightRequest = 40
            };
            layout.Children.Add(_exhibitorImage);

            var dataLayout = new StackLayout()
            {
                Orientation = StackOrientation.Vertical,
                Padding     = new Thickness(5, 0, 0, 0)
            };

            _nameLabel = new Label()
            {
                FontAttributes = FontAttributes.Bold,
                FontSize       = 15,
                TextColor      = AppResources.ExhibitorNameTextColor,
                XAlign         = TextAlignment.Start,
                HeightRequest  = 20,
                LineBreakMode  = LineBreakMode.TailTruncation,
                WidthRequest   = AppProvider.Screen.ConvertPixelsToDp(AppProvider.Screen.Width) - 140
            };
            dataLayout.Children.Add(_nameLabel);

            _descLabel = new Label()
            {
                FontSize      = 13,
                TextColor     = AppResources.ExhibitorDescTextColor,
                XAlign        = TextAlignment.Start,
                HeightRequest = 20,
                WidthRequest  = AppProvider.Screen.ConvertPixelsToDp(AppProvider.Screen.Width) - 100
            };
            dataLayout.Children.Add(_descLabel);

            layout.Children.Add(dataLayout);

            TapGestureRecognizer cellTapRecongizer = new TapGestureRecognizer();

            cellTapRecongizer.Tapped += OnExhibitorClick;
            layout.GestureRecognizers.Add(cellTapRecongizer);

            View = layout;
        }
Пример #2
0
        public RatingUserCell()
        {
            _userIndexLabel = new Label {
                TextColor    = AppResources.ProfileContactListBtnColor,
                FontSize     = 16,
                XAlign       = TextAlignment.Start,
                WidthRequest = 30,
                YAlign       = TextAlignment.Center
            };

            _userImage = new DownloadedImage(AppResources.DefaultUserImage)
            {
                WidthRequest = ImageWidth
            };

            int textWidthRequest = AppProvider.Screen.ConvertPixelsToDp(AppProvider.Screen.Width) -
                                   ImageWidth - 40 - ImageStartXPos - ButtonWidth;

            _userNameLabel = new Label {
                TextColor    = AppResources.AgendaCongressoColor,
                FontSize     = 12,
                XAlign       = TextAlignment.Start,
                WidthRequest = textWidthRequest,
                YAlign       = TextAlignment.Center
            };

            _pointsBox = new Button {
                WidthRequest    = ButtonWidth,
                TextColor       = Color.Black,
                BackgroundColor = AppResources.ProfileRankingPointsColor,
                BorderRadius    = 0,
                FontSize        = 12,
                HeightRequest   = 15
            };

            TapGestureRecognizer gesture = new TapGestureRecognizer();

            gesture.Tapped += TapOnUser;

            View = new StackLayout {
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    _userIndexLabel,
                    _userImage,
                    _userNameLabel,
                    _pointsBox
                },
                Padding            = new Thickness(0, 2),
                GestureRecognizers = { gesture }
            };
        }
Пример #3
0
        public UserCell()
        {
            var layout = new StackLayout  {
                Orientation     = StackOrientation.Horizontal,
                BackgroundColor = AppResources.WallPostBackgroundColor
            };

            _userImage = new DownloadedImage(AppResources.DefaultUserImage)
            {
                HeightRequest = 50,
                WidthRequest  = 50,
                Aspect        = Aspect.AspectFill
            };

            layout.Children.Add(_userImage);

            var topLabelsLayout = new StackLayout {
                Orientation = StackOrientation.Vertical
            };

            _userNameLabel = new Label {
                TextColor = AppResources.AgendaCongressoColor,
                FontSize  = 15,
                XAlign    = TextAlignment.Start
            };
            topLabelsLayout.Children.Add(_userNameLabel);

            _userJobLabel = new Label {
                TextColor = AppResources.AgendaCongressoColor,
                FontSize  = 13,
                XAlign    = TextAlignment.Start
            };
            topLabelsLayout.Children.Add(_userJobLabel);

            layout.Children.Add(topLabelsLayout);

            TapGestureRecognizer gesture = new TapGestureRecognizer();

            gesture.Tapped += TapOnUser;

            View = new ContentView {
                Content            = layout,
                Padding            = new Thickness(0, 0, 0, 10),
                GestureRecognizers = { gesture }
            };
        }
Пример #4
0
        public BadgeCell(UserModel userModel)
        {
            UserModel = userModel;

            _badgeImage = new DownloadedImage(AppResources.DefaultBadgeImage)
            {
                RequiredSize    = 200,
                Aspect          = Aspect.AspectFill,
                BackgroundColor = AppResources.ProfileBadgeBackgroundColor
            };

            Content = new ContentView {
                Content = _badgeImage
            };

            UserModel.BadgeActions.CollectionChanged += OnBadgesChanged;;
        }
Пример #5
0
        public async Task <RestUserMessage> SendImage(ISocketMessageChannel channel, DownloadedImage image, string additionalText)
        {
            string filename = Directory + image.Filename;

            if (image.ImageData != null && !File.Exists(filename))
            {
                using (FileStream fs = new FileStream(filename, FileMode.Create, FileAccess.Write)) {
                    await image.ImageData.CopyToAsync(fs);
                }
            }
            if (File.Exists(filename))
            {
                return(await channel.SendMessageAsync(BaseUrl + image.Filename + (!string.IsNullOrEmpty(additionalText) ? $" [{additionalText}]" : string.Empty)));
            }
            else
            {
                return(await new Task <RestUserMessage>(() => null));
            }
        }
Пример #6
0
 public async Task <RestUserMessage> SendImage(ISocketMessageChannel channel, DownloadedImage image, string additionalText)
 {
     return(await channel.SendFileAsync(image.ImageData, image.Filename, string.IsNullOrEmpty(additionalText)?null : additionalText.Trim()));
 }
Пример #7
0
 private void CreateClientBindings()
 {
     foreach (WebControl webControl in this.GetVisibleClientBoundControls(this))
     {
         string key   = webControl.Attributes["DataBoundProperty"];
         string text  = webControl.Attributes["ClientPropertyName"];
         string text2 = webControl.Attributes["MandatoryParam"];
         if (text2 != null && text2 != "false" && text2 != "true")
         {
             throw new NotSupportedException("MandatoryParam attribute value can either be 'true' or 'false'.");
         }
         bool    flag = text2 != null && Convert.ToBoolean(text2);
         Binding binding;
         if (webControl is Label && (text == null || text == "innerHTML"))
         {
             string text3 = webControl.Attributes["EncodeHtml"];
             if (text3 != null && text3 != "false" && text3 != "true")
             {
                 throw new NotSupportedException("EncodeHtml attribute value can either be 'true' or 'false'.");
             }
             bool flag2 = text3 == null || Convert.ToBoolean(text3);
             if (flag2)
             {
                 binding = new LabelBinding(webControl);
             }
             else
             {
                 binding = new NonEncodedLabelBinding(webControl);
             }
         }
         else
         {
             if (text == null)
             {
                 if (webControl is CheckBox && !(webControl is RadioButton))
                 {
                     text = "checked";
                 }
                 else
                 {
                     text = "value";
                 }
             }
             if (webControl is IScriptControl)
             {
                 if (webControl is AjaxUploader)
                 {
                     binding = new AjaxUploaderBinding(webControl, text);
                 }
                 else
                 {
                     binding = new ComponentBinding(webControl, text);
                 }
             }
             else if (webControl is DownloadedImage)
             {
                 DownloadedImage downloadedImage = (DownloadedImage)webControl;
                 binding = new ImageUrlBinding(downloadedImage, downloadedImage.ReadOnly);
             }
             else if (webControl is DropDownList)
             {
                 string text4 = webControl.Attributes["SortedDirection"];
                 if (text4 != null && text4 != SortDirection.Ascending.ToString() && text4 != SortDirection.Descending.ToString())
                 {
                     throw new NotSupportedException("SortedDirection attribute value can either be 'Ascending' or 'Descending'.");
                 }
                 if (text4 == null)
                 {
                     binding = new ComboBoxBinding(webControl, text);
                 }
                 else
                 {
                     binding = new SortedComboBoxBinding(webControl, text, (SortDirection)Enum.Parse(typeof(SortDirection), text4));
                 }
             }
             else if (webControl is RadioButton || webControl is RadioButtonList)
             {
                 binding = new RadioButtonBinding(webControl, text);
             }
             else if (text == "value")
             {
                 binding = new ValueBinding(webControl);
             }
             else
             {
                 binding = new ClientControlBinding(webControl, text);
             }
             if (flag || webControl is Label)
             {
                 binding = new MandatoryBinding(binding);
             }
             else if (webControl is RadioButtonList && this.HasAssociatedChildControls((RadioButtonList)webControl))
             {
                 binding = new MandatoryBinding(binding);
             }
             else if (Properties.IsReadOnly(webControl))
             {
                 binding = new NeverDirtyBinding(binding);
             }
         }
         if (this.UseSetObject || !(binding is NeverDirtyBinding))
         {
             this.Bindings.Bindings.Add(key, binding);
             if (this.allControlsDisabled && !(webControl is Label) && !(webControl is EllipsisLabel) && !(webControl is CollectionViewer) && !Properties.IsReadOnly(webControl))
             {
                 this.allControlsDisabled = false;
             }
         }
     }
 }
Пример #8
0
        public EventDetailView(EventData data)
        {
            Data = data;

            Title = AppResources.EventDetailsHeader.ToUpper();
            //BackgroundColor = AppResources.AgendaPageBackgroundColor;
            BackgroundColor = Color.Transparent;

            StackLayout layout = new StackLayout()
            {
                VerticalOptions = LayoutOptions.StartAndExpand
            };

            EventView eventView = new EventView();

            eventView.BindingContext = Data;
            layout.Children.Add(eventView);

            if (!Data.FreeAttending && (!string.IsNullOrEmpty(Data.PointsImagePath) || !string.IsNullOrEmpty(Data.SponsorImagePath)))
            {
                var whiteBoxLayout = new AbsoluteLayout {
                    Padding = new Thickness(0, -10, 0, 0)
                };
                whiteBoxLayout.Children.Add(new BoxView
                {
                    WidthRequest    = AppProvider.Screen.ConvertPixelsToDp(AppProvider.Screen.Width),
                    HeightRequest   = 10,
                    BackgroundColor = Color.Transparent
                });

                var imagesStackLayout = new StackLayout
                {
                    Orientation  = StackOrientation.Horizontal,
                    WidthRequest = AppProvider.Screen.ConvertPixelsToDp(AppProvider.Screen.Width),
                    Spacing      = AppProvider.Screen.ConvertPixelsToDp(AppProvider.Screen.Width) - 60 * 2,
                    Padding      = new Thickness(5)
                };

                /*
                 * if (!string.IsNullOrEmpty(Data.PointsImagePath))
                 * {
                 *
                 *  var pointsImage = new DownloadedImage(AppResources.DefaultPointsImage) { HeightRequest = 50 };
                 *  pointsImage.UpdateAtTime = Data.UpdatedAtTime;
                 *  pointsImage.ServerImagePath = Data.PointsImagePath;
                 *  imagesStackLayout.Children.Add(pointsImage);
                 *
                 * }
                 */
                if (!string.IsNullOrEmpty(Data.SponsorImagePath.Trim()))
                {
                    var sponsorImage = new DownloadedImage(AppResources.DefaultSponsorImage)
                    {
                        HeightRequest = 50
                    };
                    sponsorImage.UpdateAtTime    = Data.UpdatedAtTime;
                    sponsorImage.ServerImagePath = Data.SponsorImagePath;
                    imagesStackLayout.Children.Add(sponsorImage);
                }

                whiteBoxLayout.Children.Add(imagesStackLayout);
                layout.Children.Add(whiteBoxLayout);
            }

            var descriptionContent = new ContentView()
            {
                Content = new Label
                {
                    FontSize  = 11,
                    TextColor = Color.Black,
                    Text      = Data.Description
                },
                Padding = new Thickness(10, 10, 0, 0)
            };

            layout.Children.Add(descriptionContent);

            foreach (Speaker speecherData in Data.Speechers)
            {
                layout.Children.Add(GetSpeecherItem(speecherData));
            }

            if (!Data.FreeAttending)
            {
                var absoluteBtnLayout = new AbsoluteLayout
                {
                    HorizontalOptions = LayoutOptions.Center,
                    Padding           = new Thickness(0, 0, 0, 20)
                };

                var eventsActionBtn = new Button
                {
                    //BorderRadius = 25,
                    BorderColor     = AppResources.SpeecherTextColor,
                    BorderWidth     = 1,
                    HeightRequest   = 40,
                    WidthRequest    = AppProvider.Screen.ConvertPixelsToDp((AppProvider.Screen.Width * 3) / 4),
                    BackgroundColor = AppResources.SpeecherBgColor
                };
                absoluteBtnLayout.Children.Add(eventsActionBtn);

                var btnLabel = new Label
                {
                    WidthRequest = AppProvider.Screen.ConvertPixelsToDp((AppProvider.Screen.Width * 3) / 4) - 20,
                    Text         = AppResources.EventsActionBtnHeader,
                    TextColor    = AppResources.MenuColor,
                    FontSize     = 15,

                    IsEnabled = true,
                };
                absoluteBtnLayout.Children.Add(btnLabel, new Point(50, 6));

                if (Device.OS == TargetPlatform.iOS)
                {
                    TapGestureRecognizer gesture = new TapGestureRecognizer();
                    gesture.Tapped += OnEventsActionsClicked;
                    absoluteBtnLayout.GestureRecognizers.Add(gesture);
                }
                else
                {
                    eventsActionBtn.Clicked += OnEventsActionsClicked;
                }

                layout.Children.Add(absoluteBtnLayout);
            }

            ScrollView sView = new ScrollView();

            sView.Content = layout;
            BGLayoutView bgLayout = new BGLayoutView(AppResources.DefaultBgImage, sView, true, true);

            //Content = new ScrollView {Content = bgLayout };
            Content = new ContentView {
                Content = bgLayout
            };
            //Content = new ScrollView { Content = layout };
        }
Пример #9
0
        public SpeecherView(Speaker data, Color eventColor)
        {
            Data = data;
            var absoluteLayout = new AbsoluteLayout {
                Padding = new Thickness(10, 5, 0, 5)
            };

            absoluteLayout.Children.Add(new BoxView {
                WidthRequest    = AppProvider.Screen.Width,
                HeightRequest   = ItemHeight,
                BackgroundColor = AppResources.SpeecherBgColor
            });

            absoluteLayout.Children.Add(new BoxView {
                WidthRequest    = 10,
                HeightRequest   = ItemHeight,
                BackgroundColor = eventColor
            });

            String speecherImagePath = String.IsNullOrEmpty(Data.ProfileImagePath.Trim()) ?
                                       AppResources.DefaultUserImage :
                                       Data.ProfileImagePath.Trim();

            var speecherImage = new DownloadedImage(speecherImagePath)
            {
                HeightRequest = ItemHeight,
                WidthRequest  = ItemHeight,
                Aspect        = Aspect.AspectFill
            };

            speecherImage.UpdateAtTime    = Data.UpdatedAtTime;
            speecherImage.ServerImagePath = Data.ProfileImagePath;
            absoluteLayout.Children.Add(speecherImage, new Point(10, 0));

            TapGestureRecognizer imgRecognizer = new TapGestureRecognizer();

            imgRecognizer.Tapped += OnViewTapped;
            speecherImage.GestureRecognizers.Add(imgRecognizer);


            absoluteLayout.Children.Add(new Label {
                FontSize = 12,
                HorizontalTextAlignment = TextAlignment.Start,
                Text      = AppResources.Speakers.ToUpper(),
                TextColor = AppResources.SpeecherTextColor
            }, new Point(85, 10));

            absoluteLayout.Children.Add(new Label()
            {
                FontAttributes          = FontAttributes.Bold,
                FontSize                = 14,
                HorizontalTextAlignment = TextAlignment.Start,
                Text      = Data.Name,
                TextColor = AppResources.SpeecherTextColor
            }, new Point(85, 30));


            Content = absoluteLayout;

            TapGestureRecognizer tapRecognizer = new TapGestureRecognizer();

            tapRecognizer.Tapped += OnViewTapped;
            Content.GestureRecognizers.Add(tapRecognizer);
        }
Пример #10
0
        public WallPostCell()
        {
            int imageSize = AppProvider.Screen.ConvertPixelsToDp(AppProvider.Screen.Width) - ItemLeftBorder * 2 - LeftBorder * 2;

            _creatorUserImage = new DownloadedImage(AppResources.DefaultUserImage)
            {
                HeightRequest = 40,
                WidthRequest  = 40
            };

            _creatorNameLabel = new Label {
                TextColor     = AppResources.AgendaExpoColor,
                FontSize      = 15,
                XAlign        = TextAlignment.Start,
                HeightRequest = 20,
                WidthRequest  = AppProvider.Screen.ConvertPixelsToDp(AppProvider.Screen.Width) - 60
            };

            _postDateLabel = new Label {
                TextColor     = AppResources.WallPostCreatedDateColor,
                FontSize      = 13,
                XAlign        = TextAlignment.Start,
                HeightRequest = 20,
                WidthRequest  = AppProvider.Screen.ConvertPixelsToDp(AppProvider.Screen.Width) - 60
            };

            _postInfoLabel = new Label {
                TextColor            = AppResources.AgendaCongressoColor,
                FontSize             = 14,
                XAlign               = TextAlignment.Start,
                WidthRequest         = AppProvider.Screen.ConvertPixelsToDp(AppProvider.Screen.Width) - 40,
                MinimumHeightRequest = 30
            };

            _postDataImage = new DownloadedImage(AppResources.DefaultPostImage, true)
            {
                WidthRequest  = imageSize,
                HeightRequest = imageSize,
                RequiredSize  = 300
            };

            var emptyBox = new BoxView {
                WidthRequest  = AppProvider.Screen.ConvertPixelsToDp(AppProvider.Screen.Width),
                Color         = Color.Transparent,
                HeightRequest = 1
            };

            /* TODO reativar like no wall post
             *          var likeImage = new Image
             *          {
             *                  WidthRequest = 30,
             *                  HeightRequest = 30,
             *                  Source = ImageLoader.Instance.GetImage(AppResources.WallPostLikeImage, true)
             *          };
             *          TapGestureRecognizer tapOnLikeImage = new TapGestureRecognizer ();
             *          tapOnLikeImage.Tapped += OnLikeImageTapped;
             *          likeImage.GestureRecognizers.Add (tapOnLikeImage);
             *
             *          _likeLabel = new Label {
             *                  TextColor = AppResources.WallPostCreatedDateColor,
             *                  FontSize = 15,
             *                  XAlign = TextAlignment.Start,
             *                  YAlign = TextAlignment.Center,
             *                  HeightRequest = 30,
             *                  WidthRequest = 60
             *          };
             *
             *          TapGestureRecognizer tapOnLikeLabel = new TapGestureRecognizer ();
             *          tapOnLikeLabel.Tapped += OnLikeLabelTapped;
             *          _likeLabel.GestureRecognizers.Add (tapOnLikeLabel);
             */
            View = new ContentView {
                Padding = new Thickness(0, 0, 0, 20),
                Content = new StackLayout {
                    Orientation     = StackOrientation.Vertical,
                    BackgroundColor = AppResources.WallPostBackgroundColor,
                    VerticalOptions = LayoutOptions.StartAndExpand,
                    Children        =
                    {
                        new StackLayout {                         //top layout
                            Orientation   = StackOrientation.Horizontal,
                            HeightRequest =                           40,
                            Spacing       =                            0,
                            Children      =
                            {
                                new BoxView {
                                    HeightRequest   =                           40,
                                    WidthRequest    =                           10,
                                    BackgroundColor = AppResources.AgendaCongressoColor
                                },
                                _creatorUserImage,
                                new StackLayout{                                  //data
                                    Padding     = new Thickness(10,                          0,          0, 0),
                                    Spacing     =                            2,
                                    Orientation = StackOrientation.Vertical,
                                    Children    = { _creatorNameLabel, _postDateLabel         }
                                }
                            }
                        },
                        new StackLayout {                         //post
                            Orientation       = StackOrientation.Vertical,
                            VerticalOptions   = LayoutOptions.FillAndExpand,
                            HorizontalOptions = LayoutOptions.StartAndExpand,
                            Padding           = new Thickness(LeftBorder,                  5, LeftBorder, 0),
                            Children          = { _postInfoLabel,            _postDataImage,  emptyBox }
                        },

                        /* TODO Reativar like
                         *                      new StackLayout { //like
                         *                              Orientation = StackOrientation.Horizontal,
                         *                              HorizontalOptions = LayoutOptions.EndAndExpand,
                         *                              Padding = new Thickness (0, 5, 0, 5),
                         *                              Children = { likeImage, _likeLabel }
                         *
                         *                      }
                         */
                    }
                }
            };
        }
Пример #11
0
        protected override void InitializeCell()
        {
            _userImage = new DownloadedImage(AppResources.DefaultUserImage)
            {
                WidthRequest = ImageWidth
            };

            int textWidthRequest = AppProvider.Screen.ConvertPixelsToDp(AppProvider.Screen.Width)
                                   - ButtonWidth - 20 - ImageWidth - 10;

            TapGestureRecognizer gesture = new TapGestureRecognizer();

            gesture.Tapped += TapOnUser;

            _userNameLabel = new Label {
                TextColor          = AppResources.AgendaCongressoColor,
                FontSize           = 14,
                XAlign             = TextAlignment.Start,
                WidthRequest       = textWidthRequest,
                HeightRequest      = 20,
                GestureRecognizers = { gesture }
            };

            _userEmailLabel = new Label {
                TextColor     = AppResources.AgendaCongressoColor,
                FontSize      = 11,
                XAlign        = TextAlignment.Start,
                WidthRequest  = textWidthRequest,
                HeightRequest = 20
            };

            _connectBtn = new Button()
            {
                WidthRequest    = ButtonWidth,
                TextColor       = AppResources.AgendaCongressoColor,
                BackgroundColor = AppResources.ConnectRequestNotSentColor,
                BorderRadius    = 0,
                FontSize        = 13,
                Text            = AppResources.ConnectRequestNotSent,
                FontAttributes  = FontAttributes.Bold,
                HeightRequest   = 30
            };
            _connectBtn.Clicked += OnConnectBtnClicked;



            View = new StackLayout {
                Orientation     = StackOrientation.Horizontal,
                VerticalOptions = LayoutOptions.Center,
                Children        =
                {
                    _userImage,
                    new StackLayout {
                        Orientation        = StackOrientation.Vertical,
                        Children           = { _userNameLabel, _userEmailLabel },
                        GestureRecognizers = { gesture }
                    },
                    _connectBtn
                }
            };
        }
Пример #12
0
        public ConnectionCell()
        {
            var userChooseLayout = new AbsoluteLayout {
            };

            _userImage = new DownloadedImage(AppResources.DefaultUserImage)
            {
                WidthRequest = ImageWidth
            };
            userChooseLayout.Children.Add(_userImage);

            var namesLayout = new StackLayout  {
                Orientation = StackOrientation.Vertical
            };

            int textWidthRequest = AppProvider.Screen.Width - ButtonWidth - 20 - ImageWidth - 10;

            _userNameLabel = new Label {
                TextColor = AppResources.MenuColor, FontSize = 14, XAlign = TextAlignment.Start, WidthRequest = textWidthRequest
            };
            namesLayout.Children.Add(_userNameLabel);

            _userEmailLabel = new Label {
                TextColor = AppResources.MenuColor, FontSize = 11, XAlign = TextAlignment.Start, WidthRequest = textWidthRequest
            };
            namesLayout.Children.Add(_userEmailLabel);

            userChooseLayout.Children.Add(namesLayout, new Point(ImageWidth * 1.2f, 0));

            /* TODO validar se precisa do TapOnUser Connection cell
             *          TapGestureRecognizer tapOnUser = new TapGestureRecognizer ();
             *          tapOnUser.Tapped += TapOnUser;
             *          userChooseLayout.GestureRecognizers.Add (tapOnUser);
             */

            _connectBtn = new Button()
            {
                WidthRequest    = ButtonWidth,
                TextColor       = Color.White,
                BackgroundColor = AppResources.AgendaExpoColor,
                BorderRadius    = 0,
                FontSize        = 12,
                Text            = AppResources.ConnectRequestNotSent,
                FontAttributes  = FontAttributes.Bold
            };
            _connectBtn.Clicked += OnConnectBtnClicked;

            Grid grid = new Grid
            {
                HorizontalOptions = LayoutOptions.EndAndExpand,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(ButtonWidth, GridUnitType.Absolute)
                    }
                },
                Padding         = new Thickness(10, 0, 10, 10),
                BackgroundColor = Color.Transparent
            };

            grid.Children.Add(userChooseLayout, 0, 0);
            grid.Children.Add(_connectBtn, 1, 0);


            OnModelChanged();

            this.View = grid;
        }
Пример #13
0
        public UserHeaderView(UserModel userModel, bool showContacts = false, bool showButtonEdit = true, bool showPointsLayout = true)
        {
            Model = userModel;

            var stackLayout = new StackLayout
            {
                BackgroundColor = AppResources.UserBackgroundColor,
                Orientation     = StackOrientation.Vertical
            };

            /**
             * Tirei o click do header inteiro e passei para o btEdit
             * var tappableHeaderLayout = new StackLayout { Orientation = StackOrientation.Vertical };
             */

            var headerLayout = new StackLayout {
                Orientation = StackOrientation.Vertical
            };

            var topLayout = new StackLayout {
                Orientation = StackOrientation.Horizontal, Padding = new Thickness(20, 5, 5, 0)
            };

            var photoLayout = new AbsoluteLayout {
            };

            photoLayout.Children.Add(new BoxView
            {
                WidthRequest  = 10,
                HeightRequest = ImageHeight,
                Color         = AppResources.MenuColor
            });

            var userImage = new DownloadedImage(AppResources.DefaultUserImage)
            {
                HeightRequest = ImageHeight,
                WidthRequest  = ImageHeight,
                Aspect        = Aspect.AspectFill
            };

            userImage.SetBinding(DownloadedImage.UpdateAtTimeProperty, UpdatedUniqueItem.UpdatedAtTimePropertyName);
            userImage.SetBinding(DownloadedImage.ServerImagePathProperty, User.ProfileImagePathPropertyName);
            photoLayout.Children.Add(userImage, new Point(10, 0));

            topLayout.Children.Add(photoLayout);

            var namesLayout = new StackLayout {
                Orientation = StackOrientation.Vertical, Padding = new Thickness(10, 10)
            };
            var nameLabel = new Label {
                TextColor = AppResources.UserHeaderNameTextColor, FontSize = 17
            };

            nameLabel.SetBinding(Label.TextProperty, User.NamePropertyName);

            var jobLabel = new Label {
                TextColor = AppResources.UserHeaderJobTextColor, FontSize = 14
            };

            jobLabel.SetBinding(Label.TextProperty, User.JobPropertyName);

            namesLayout.Children.Add(nameLabel);
            namesLayout.Children.Add(jobLabel);

            topLayout.Children.Add(namesLayout);

            if (showButtonEdit)
            {
                Image btEdit = new Image()
                {
                    Source        = ImageLoader.Instance.GetImage(AppResources.DefaultBtEdit, false),
                    HeightRequest = ImageHeight / 2,
                    WidthRequest  = ImageHeight / 2,
                };

                TapGestureRecognizer tapRecognizer = new TapGestureRecognizer();
                tapRecognizer.Tapped += OnEditUserTapped;

                btEdit.GestureRecognizers.Add(tapRecognizer);
                topLayout.Children.Add(btEdit);
            }

            headerLayout.Children.Add(topLayout);

            if (showContacts)
            {
                var middleLayout = new StackLayout {
                    Orientation = StackOrientation.Vertical, Padding = new Thickness(10, 10)
                };
                var contactsHeaderLabel = new Label
                {
                    //TextColor = AppResources.ProfileContactsHeaderColor,
                    TextColor = Color.Purple,
                    Text      = AppResources.ProfileContactsHeader,
                    FontSize  = 14
                };
                middleLayout.Children.Add(contactsHeaderLabel);

                var userEmailLabel = new Label {
                    TextColor = AppResources.UserHeaderNameTextColor, FontSize = 14
                };
                userEmailLabel.SetBinding(Label.TextProperty, User.EmailPropertyName);
                middleLayout.Children.Add(userEmailLabel);

                var userCellphoneLabel = new Label {
                    TextColor = AppResources.UserHeaderNameTextColor, FontSize = 14
                };
                userCellphoneLabel.SetBinding(Label.TextProperty, User.PhonePropertyName);
                middleLayout.Children.Add(userCellphoneLabel);

                headerLayout.Children.Add(middleLayout);
            }

            stackLayout.Children.Add(headerLayout);

            /* Implementação com Progressbar */
            if (showPointsLayout)
            {
                var pointsLayout = new AbsoluteLayout
                {
                    Padding = new Thickness(5, 5),
                };
                int pgImagelabelHeigth   = 69;
                int pointsCountBoxHeigth = 51;
                int boxYpos = pgImagelabelHeigth - (pointsCountBoxHeigth / 3);

                var pointsCountLabel = new Label
                {
                    HorizontalOptions = LayoutOptions.CenterAndExpand,
                    TextColor         = AppResources.ProfilePointsColor,
                    FontSize          = 18,
                    //FontAttributes = FontAttributes.Bold,
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Start,
                    HeightRequest           = pointsCountBoxHeigth - 12,
                    WidthRequest            = pointsCountBoxHeigth - 2,
                };

                pointsCountLabel.SetBinding(Label.TextProperty, User.ScorePointsProperty);

                var pointsCountText = new Label
                {
                    Text      = AppResources.ProfilePointsLabelText,
                    TextColor = AppResources.ProfilePointsColor,
                    FontSize  = 9,
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Start,
                    //HeightRequest = 10,
                    WidthRequest = pointsCountBoxHeigth - 2,
                };

                var pointsCountBox = new Button
                {
                    BackgroundColor = AppResources.UserHeaderNameTextColor,
                    IsEnabled       = false,
                    BorderRadius    = 25,
                    HeightRequest   = pointsCountBoxHeigth,
                    WidthRequest    = pointsCountBoxHeigth
                };
                pointsLayout.Children.Add(pointsCountBox, new Point(0, boxYpos));
                pointsLayout.Children.Add(pointsCountLabel, new Point(2, boxYpos + 8));
                pointsLayout.Children.Add(pointsCountText, new Point(2, boxYpos + 30));
                progbar = new ProgressBar()
                {
                    HeightRequest = 17,
                    //BackgroundColor = AppResources.ProfilePointsColor,

                    //  Progress = 0.3
                };
                //IntDivByKDoubleConverter iDkC = new IntDivByKDoubleConverter();
                //progbar.BindingContextChanged
                progbar.SetBinding(ProgressBar.ProgressProperty, User.ScorePointsProperty, BindingMode.OneWay, new IntDivByKDoubleConverter(), null);

                Image progbarImageLabel = new Image()
                {
                    Source        = ImageLoader.Instance.GetImage(AppResources.ProfileLevelProgressBarImageLabel, false),
                    HeightRequest = pgImagelabelHeigth,
                };



                if (Device.OS == TargetPlatform.iOS)
                {
                    progbar.WidthRequest           = (pointsCountBoxHeigth - 2) * 5;
                    progbarImageLabel.WidthRequest = (pointsCountBoxHeigth - 2) * 5;
                }
                else
                {
                    progbar.WidthRequest           = 300;
                    progbarImageLabel.WidthRequest = 300;
                }


                pointsLayout.Children.Add(progbar, new Point(pointsCountBoxHeigth, pgImagelabelHeigth));
                pointsLayout.Children.Add(progbarImageLabel, new Point(pointsCountBoxHeigth, 0));
                // progbar.SetBinding(ProgressBar.ProgressProperty, User.ScorePointsProgressionProperty);

                stackLayout.Children.Add(pointsLayout);
            }

            Content          = stackLayout;
            BindingContext   = Model.User;
            Model.IsChanged += OnUserModelChanged;
        }
Пример #14
0
        public SpeecherDetailView(Speaker data, Color eventColor)
        {
            Data  = data;
            Title = Data.Name;

            var absoluteLayout = new AbsoluteLayout {
            };

            absoluteLayout.Children.Add(new BoxView {
                WidthRequest    = AppProvider.Screen.Width,
                HeightRequest   = FirstItemHeight,
                BackgroundColor = AppResources.AgendaPageBackgroundColor
            });

            absoluteLayout.Children.Add(new BoxView {
                WidthRequest    = 10,
                HeightRequest   = FirstItemHeight,
                BackgroundColor = eventColor
            });

            absoluteLayout.Children.Add(new BoxView {
                WidthRequest    = AppProvider.Screen.Width,
                HeightRequest   = SecondItemHeight,
                BackgroundColor = AppResources.SpeecherBgColor
            }, new Point(0, FirstItemHeight));

            absoluteLayout.Children.Add(new Label {
                FontSize  = 80,
                Text      = AppResources.BioHeader,
                TextColor = AppResources.SpeecherTextColor
            }, new Point(150, 23));

            _speecherImage = new DownloadedImage(AppResources.DefaultUserImage)
            {
                HeightRequest = FirstItemHeight,
                WidthRequest  = FirstItemHeight,
                Aspect        = Aspect.AspectFill
            };

            absoluteLayout.Children.Add(_speecherImage, new Point(10, 0));

            var stackTextLayout = new StackLayout {
                Padding = new Thickness(PaddingLeftFisrtLabel, 10, 0, 0)
            };

            stackTextLayout.Children.Add(new Label {
                FontSize  = 12,
                XAlign    = TextAlignment.Start,
                Text      = AppResources.Speakers.ToUpper(),
                TextColor = eventColor
            });

            stackTextLayout.Children.Add(new Label {
                FontAttributes = FontAttributes.Bold,
                FontSize       = 15,
                XAlign         = TextAlignment.Start,
                Text           = Data.Name,
                TextColor      = eventColor
            });

            absoluteLayout.Children.Add(stackTextLayout, new Point(0, FirstItemHeight));

            var descriptionContent = new ContentView {
                Content = new ContentView {
                    Content = new Label {
                        FontSize  = 11,
                        XAlign    = TextAlignment.Start,
                        Text      = Data.Bio,
                        TextColor = Color.Black
                    },
                    Padding = new Thickness(PaddingLeftFisrtLabel, PaddingLeftFisrtLabel / 2, PaddingLeftFisrtLabel, PaddingLeftFisrtLabel / 2)
                },
                BackgroundColor = AppResources.AgendaPageBackgroundColor
            };

            var stackLayout = new StackLayout {
                BackgroundColor = AppResources.AgendaPageBackgroundColor
            };

            stackLayout.Children.Add(absoluteLayout);
            stackLayout.Children.Add(descriptionContent);
            ScrollView scrollView = new ScrollView()
            {
                Content = stackLayout
            };

            BGLayoutView bgLayout = new BGLayoutView(AppResources.DefaultBgImage, scrollView, true, true);

            //Content =  {Content = stackLayout};
            Content = new ContentView {
                Content = bgLayout
            };
        }
Пример #15
0
        public WallCreatePostPage()
        {
            _fakeImagePath = Path.Combine(AppProvider.IOManager.DocumentPath, "wallfakeImage.jpeg");

            Title = AppResources.WallCreatePost;

            BackgroundColor = Color.Transparent;

            var layout = new StackLayout  {
                Orientation     = StackOrientation.Vertical,
                BackgroundColor = AppResources.AgendaExpoColor,
                //BackgroundColor = Color.Transparent,
                Padding = new Thickness(Border),
                Spacing = 5
            };

            var topLayout = new StackLayout  {
                Orientation = StackOrientation.Horizontal
            };
            var userImage = new DownloadedImage(AppResources.DefaultUserImage)
            {
                WidthRequest  = 40,
                HeightRequest = 40
            };

            userImage.UpdateAtTime    = AppModel.Instance.CurrentUser.User.UpdatedAtTime;
            userImage.ServerImagePath = AppModel.Instance.CurrentUser.User.ProfileImagePath;

            topLayout.Children.Add(userImage);

            var userNameLabel = new Label {
                TextColor = Color.White, FontSize = 15, XAlign = TextAlignment.Start
            };

            userNameLabel.Text = AppModel.Instance.CurrentUser.User.Name;

            topLayout.Children.Add(userNameLabel);

            layout.Children.Add(topLayout);

            _postImage = new Image {
                WidthRequest = PostImageWidth, IsVisible = false, Aspect = Aspect.AspectFit
            };
            layout.Children.Add(_postImage);

            float btnWidth = (AppProvider.Screen.Width - Border) / 2;

            Button btnUpload = new Button {
                BackgroundColor = AppResources.MenuColor,
                WidthRequest    = btnWidth,
                HeightRequest   = 40,
                Text            = AppResources.WallPostButtonUpload,
                TextColor       = Color.White,
                BorderRadius    = 0
            };

            btnUpload.Clicked += OnUploadClicked;
            layout.Children.Add(btnUpload);

            _postTextField = new EditorControl(string.Empty)
            {
                HeightRequest   = EditorHeight,
                WidthRequest    = AppProvider.Screen.Width - Border * 2,
                BackgroundColor = Color.White
            };

            layout.Children.Add(_postTextField);

            btnPost = new Button {
                BackgroundColor = AppResources.MenuColor,
                WidthRequest    = btnWidth,
                Text            = AppResources.WallPostButtonPost,
                TextColor       = Color.White,
                BorderRadius    = 0
            };
            btnPost.Clicked += OnPostClicked;;
            layout.Children.Add(btnPost);

            ScrollView scrollView = new ScrollView()
            {
                Content = layout
            };


            BGLayoutView bgLayout = new BGLayoutView(AppResources.DefaultBgImage, scrollView, true, true);

            Content = new ContentView {
                Content = bgLayout
            };


//            Content = new ScrollView() {Content = layout};
        }