コード例 #1
0
        /// <summary>
        /// Sets the text alignment.
        /// </summary>
        /// <param name="view">The view.</param>
        private void SetTextAlignment(ExtendedEntry view)
        {
            if (view.IsPassword && _thisPasswordBox != null)
            {
                switch (view.XAlign)
                {
                    //NotCurrentlySupported: Text alaignement not available on Windows Phone for Password Entry
                }
            }
            else if (!view.IsPassword && _thisPhoneTextBox != null)
            {
                switch (view.XAlign)
                {
                case TextAlignment.Center:
                    _thisPhoneTextBox.TextAlignment = System.Windows.TextAlignment.Center;
                    break;

                case TextAlignment.End:
                    _thisPhoneTextBox.TextAlignment = System.Windows.TextAlignment.Right;
                    break;

                case TextAlignment.Start:
                    _thisPhoneTextBox.TextAlignment = System.Windows.TextAlignment.Left;
                    break;
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Sets the font.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetFont(ExtendedEntry view)
 {
     if (view.Font != Font.Default)
     {
         Control.TextSize = view.Font.ToScaledPixel();
     }
 }
コード例 #3
0
 /// <summary>
 /// Sets the color of the placeholder text.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetPlaceholderTextColor(ExtendedEntry view)
 {
     if (view.PlaceholderTextColor != Color.Default)
     {
         Control.SetHintTextColor(view.PlaceholderTextColor.ToAndroid());
     }
 }
コード例 #4
0
 /// <summary>
 /// Sets the MaxLength Characters.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetMaxLength(ExtendedEntry view)
 {
     if (_thisPhoneTextBox != null)
     {
         _thisPhoneTextBox.MaxLength = view.MaxLength;
     }
 }
コード例 #5
0
 /// <summary>
 /// Sets the maxLength.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetMaxLength(ExtendedEntry view)
 {
     Control.ShouldChangeCharacters = (textField, range, replacementString) =>
     {
         var newLength = textField.Text.Length + replacementString.Length - range.Length;
         return newLength <= view.MaxLength;
     };
 }
コード例 #6
0
 /// <summary>
 /// Sets the font.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetFont(ExtendedEntry view)
 {
     UIFont uiFont;
     if (view.Font != Font.Default && (uiFont = view.Font.ToUIFont()) != null)
         Control.Font = uiFont;
     else if (view.Font == Font.Default)
         Control.Font = UIFont.SystemFontOfSize(17f);
 }
コード例 #7
0
ファイル: MainPage.xaml.cs プロジェクト: sliderif/Coffetab
        public MainPage()
        {
            NavigationPage.SetHasNavigationBar (this, false);

            var openingLabel = new Label {
                Text = "Открытие смены:",
                VerticalOptions = LayoutOptions.End
            };

            var PasswordText = new ExtendedEntry {
                Placeholder = "Пароль",
                VerticalOptions = LayoutOptions.End,
                PlaceholderTextColor = Color.FromHex("#666666"),
                TextColor = Color.FromHex("#666666"),
                BackgroundColor = Color.FromHex("#FFFFFF")
            };

            var LoginText = new ExtendedEntry {
                Placeholder = "Имя пользователя",
                VerticalOptions = LayoutOptions.End,
                PlaceholderTextColor = Color.FromHex("#666666"),
                TextColor = Color.FromHex("#666666"),
                BackgroundColor = Color.FromHex("#FFFFFF")
            };

            var LogoImage = new Image{
                Source = "logo.png",
                VerticalOptions = LayoutOptions.Center
            };

            var LoginButton = new Button{
                Text = "Войти",

                VerticalOptions = LayoutOptions.End,
                BackgroundColor = Color.FromHex("#EA764F"),
                TextColor = Color.FromHex("#FFFFFF"),
                BorderRadius = 4
            };
            LoginButton.Clicked += (sender, ea) => {
                OnLogin(LoginText.Text, PasswordText.Text);
            };
            var layout = new StackLayout{
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation = StackOrientation.Vertical,
                Spacing=15,
                Children = {
                    LogoImage,
                    openingLabel,
                    LoginText,
                    PasswordText,
                    LoginButton
                }
            };
            this.Content = layout;
            this.BackgroundImage = "bg.png";
            InitializeComponent ();
        }
コード例 #8
0
ファイル: MainMenuHeader.cs プロジェクト: jiletx/Bluemart
        public MainMenuHeader()
        {
            InitializeComponent ();
            mSearchEntry = SearchEntry;
            SearchEntry.FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label));
            SearchEntry.TextColor = MyDevice.BlueColor;
            SetGridDefinitions ();
            SetImageSize ();

            AddTapRecognizers ();
        }
コード例 #9
0
        /// <summary>
        /// Sets the color of the placeholder text.
        /// </summary>
        /// <param name="view">The view.</param>
        void SetPlaceholderTextColor(ExtendedEntry view)
        {
            /*
UIColor *color = [UIColor lightTextColor];
YOURTEXTFIELD.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"PlaceHolder Text" attributes:@{NSForegroundColorAttributeName: color}];
            */
            if(string.IsNullOrEmpty(view.Placeholder) == false && view.PlaceholderTextColor != Color.Default) {
                NSAttributedString placeholderString = new NSAttributedString(view.Placeholder, new UIStringAttributes(){ ForegroundColor = view.PlaceholderTextColor.ToUIColor() });
                Control.AttributedPlaceholder = placeholderString;
            }
        }
コード例 #10
0
 /// <summary>
 /// Sets the border.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetBorder(ExtendedEntry view)
 {
     if (view.IsPassword && _thisPasswordBox != null)
     {
         _thisPasswordBox.BorderThickness = view.HasBorder ? new System.Windows.Thickness(2) :  new System.Windows.Thickness(0);
     }
     else if (!view.IsPassword && _thisPhoneTextBox != null)
     {
         _thisPhoneTextBox.BorderThickness = view.HasBorder ? new System.Windows.Thickness(2) : new System.Windows.Thickness(0);
     }
 }
コード例 #11
0
ファイル: TopNavigationBar.cs プロジェクト: jiletx/Bluemart
 public TopNavigationBar()
 {
     InitializeComponent ();
     NavigationText = NavigationTitle;
     mSearchEntry = SearchEntry;
     SearchEntry.FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label));
     SearchEntry.TextColor = MyDevice.BlueColor;
     //mPriceLabel = PriceLabel;
     NavigationTitle.TextColor = MyDevice.RedColor;
     SetGridDefinitions ();
     SetImageSize ();
     AddTapRecognizers ();
 }
コード例 #12
0
 ///// <summary>
 ///// Sets the border.
 ///// </summary>
 ///// <param name="view">The view.</param>
 private void SetBorder(ExtendedEntry view)
 {
     if (view.HasBorder == false)
     {
         var shape = new ShapeDrawable(new RectShape());
         shape.Paint.Alpha = 0;
         shape.Paint.SetStyle(Paint.Style.Stroke);
         Control.SetBackgroundDrawable(shape);
     }
     else
     {
         Control.SetBackground(originalBackground);
     }
 }
コード例 #13
0
 /// <summary>
 /// Sets the text alignment.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetTextAlignment(ExtendedEntry view)
 {
     switch (view.XAlign)
     {
         case TextAlignment.Center:
             Control.TextAlignment = UITextAlignment.Center;
             break;
         case TextAlignment.End:
             Control.TextAlignment = UITextAlignment.Right;
             break;
         case TextAlignment.Start:
             Control.TextAlignment = UITextAlignment.Left;
             break;
     }
 }
コード例 #14
0
        /// <summary>
        /// Sets the text alignment.
        /// </summary>
        /// <param name="view">The view.</param>
        private void SetVerticalTextAlignment(ExtendedEntry view)
        {
            switch (view.YAlign)
            {
            case TextAlignment.Center:
                Control.VerticalAlignment = UIControlContentVerticalAlignment.Center;
                break;

            case TextAlignment.End:
                Control.VerticalAlignment = UIControlContentVerticalAlignment.Bottom;
                break;

            case TextAlignment.Start:
                Control.VerticalAlignment = UIControlContentVerticalAlignment.Top;
                break;
            }
        }
コード例 #15
0
        /// <summary>
        /// Sets the text alignment.
        /// </summary>
        /// <param name="view">The view.</param>
        private void SetTextAlignment(ExtendedEntry view)
        {
            switch (view.XAlign)
            {
            case Xamarin.Forms.TextAlignment.Center:
                Control.Gravity = GravityFlags.CenterHorizontal;
                break;

            case Xamarin.Forms.TextAlignment.End:
                Control.Gravity = GravityFlags.End;
                break;

            case Xamarin.Forms.TextAlignment.Start:
                Control.Gravity = GravityFlags.Start;
                break;
            }
        }
コード例 #16
0
 /// <summary>
 /// Sets the font.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetFont(ExtendedEntry view)
 {
     if (view.Font != Font.Default)
     {
         if (view.IsPassword)
         {
             if (_thisPasswordBox != null)
             {
                 _thisPasswordBox.FontSize = view.Font.GetHeight();
             }
         }
         else
         {
             if (_thisPhoneTextBox != null)
             {
                 _thisPhoneTextBox.FontSize = view.Font.GetHeight();
             }
         }
     }
 }
コード例 #17
0
        /// <summary>
        /// Creates a new instance of the <see cref="ExtendedEntryPage"/> class
        /// </summary>
        public ExtendedEntryPage()
        {
            InitializeComponent();
            var entryFromCode = new ExtendedEntry() {
                Placeholder = "Aded from code, custom font",
                Font = Font.OfSize("Open 24 Display St", NamedSize.Medium)
            };

            StackLayout.Children.Add(entryFromCode);

            var swipeEntry = new ExtendedEntry()
            {
                    Placeholder = "Swipe me..."
            };

            swipeEntry.LeftSwipe += (s, e) => swipeEntry.Text = "Swiped left";

            swipeEntry.RightSwipe += (s, e) => swipeEntry.Text = "Swiped right";

            StackLayout.Children.Add(swipeEntry);
        }
コード例 #18
0
        /// <summary>
        /// Sets the color of the placeholder text.
        /// </summary>
        /// <param name="view">The view.</param>
        private void SetPlaceholderTextColor(ExtendedEntry view)
        {
            //the EntryRenderer renders two child controls. A PhoneTextBox or PasswordBox
            // depending on the IsPassword property of the Xamarin form control

            if (view.IsPassword)
            {
                //NotCurrentlySupported: Placeholder text color is not supported on Windows Phone Password control
            }
            else
            {
                if (view.PlaceholderTextColor != Color.Default && _thisPhoneTextBox != null)
                {
                    var hintStyle = new System.Windows.Style(typeof(System.Windows.Controls.ContentControl));
                    hintStyle.Setters.Add(
                        new System.Windows.Setter(
                            System.Windows.Controls.Control.ForegroundProperty,
                            view.PlaceholderTextColor.ToBrush())
                        );
                    _thisPhoneTextBox.HintStyle = hintStyle;
                }
            }
        }
コード例 #19
0
 /// <summary>
 /// Sets the text alignment.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetTextAlignment(ExtendedEntry view)
 {
     if (view.IsPassword && _thisPasswordBox != null)
     {
         #pragma warning disable CS1522 // Empty switch block
         switch (view.XAlign)
         {
             //NotCurrentlySupported: Text alaignement not available on Windows Phone for Password Entry
         }   
         #pragma warning restore CS1522 // Empty switch block
     }
     else if (!view.IsPassword && _thisPhoneTextBox != null)
     {
         switch (view.XAlign)
         {
             case TextAlignment.Center:
                 _thisPhoneTextBox.TextAlignment = System.Windows.TextAlignment.Center;
                 break;
             case TextAlignment.End:
                 _thisPhoneTextBox.TextAlignment = System.Windows.TextAlignment.Right;
                 break;
             case TextAlignment.Start:
                 _thisPhoneTextBox.TextAlignment = System.Windows.TextAlignment.Left;
                 break;
         }              
     }
 }
コード例 #20
0
 /// <summary>
 /// Sets the MaxLength characteres.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetMaxLength(ExtendedEntry view)
 {
     Control.SetFilters(new IInputFilter[] { new global::Android.Text.InputFilterLengthFilter(view.MaxLength) });
 }
コード例 #21
0
		public ChatDetailsPage ( ObservableCollection<ChatDetails> chats,string tosusrID, string userImageUrl, string toUserName )
		{


			App.CurrentChatUserID = tosusrID;
			NavigationPage.SetHasNavigationBar(this, false);

			chatList = chats;
			touserID = tosusrID;
			currentuser = App.Settings.GetUser ();

		    timer = DependencyService.Get<IAdvancedTimer>();
			timer.initTimer (30000, SyncChatHistoryFromServer, true);
			timer.startTimer ();
			//Xamarin.Forms.Device.StartTimer ( TimeSpan.FromSeconds( 1 ), SyncChatHistoryFromServer );


			string chatTouser = toUserName;

			if (chatTouser.Length > 30)
			{
				chatTouser = chatTouser.Substring(0, 30);
				chatTouser += "...";
			}


			progressBar = DependencyService.Get< IProgressBar > ();
			mainTitleBar = new PurposeColorTitleBar(Color.FromRgb(8, 135, 224), chatTouser, Color.Black, userImageUrl, true);
			mainTitleBar.imageAreaTapGestureRecognizer.Tapped += (object sender, EventArgs e) => 
			{
				App.masterPage.IsPresented = true;
			};
			subTitleBar = new CommunityGemChatTitleBar(Constants.SUB_TITLE_BG_COLOR, chatTouser, userImageUrl, false);
			subTitleBar.BackButtonTapRecognizer.Tapped += async (object sender, EventArgs e) => 
			{
				timer.stopTimer ();
				App.CurrentChatUserID = null;
				await Navigation.PopAsync();
			};

			masterLayout = new CustomLayout ();
			masterLayout.WidthRequest = App.screenWidth;
			masterLayout.HeightRequest = App.screenHeight - 50;
			masterLayout.BackgroundColor = Color.FromRgb(45, 62, 80);

			chatHistoryListView = new ListView();
			chatHistoryListView.ItemTemplate = new DataTemplate(typeof(ChatHistoryListCell));
			chatHistoryListView.SeparatorVisibility = SeparatorVisibility.None;
			chatHistoryListView.HeightRequest = App.screenHeight * 70 / 100;
			chatHistoryListView.HasUnevenRows = true;
			chatHistoryListView.BackgroundColor =  Color.FromRgb(54, 79, 120);
			chatHistoryListView.ItemsSource = chatList;
			if( chatList != null && chatList.Count > 1 )
				chatHistoryListView.ScrollTo( chatList[ chatList.Count -1 ], ScrollToPosition.End, true );
			
			chatHistoryListView.ItemTapped += (object sender, ItemTappedEventArgs e) => 
			{
				chatHistoryListView.SelectedItem = null;
			};
			chatHistoryListView.ItemSelected += (object sender, SelectedItemChangedEventArgs e) => 
			{
				chatHistoryListView.SelectedItem = null;
			};


		

			ExtendedEntry chatEntry = new ExtendedEntry
			{
				Placeholder = "Enter your chat...",
				BackgroundColor = Color.White,//Color.White,
				WidthRequest = App.screenWidth * .80,
				HorizontalOptions = LayoutOptions.Start,
				TextColor = Color.Black
			};
			chatEntry.TextChanged += ChatEntry_TextChanged;

			Image postChatButton = new Image();
			postChatButton.Source = Device.OnPlatform("icon_send.png", "icon_send.png", "//Assets//icon_send.png");

			postChatButton.VerticalOptions = LayoutOptions.Center;
			postChatButton.HorizontalOptions = LayoutOptions.Center;
			TapGestureRecognizer postChatButtonTap = new TapGestureRecognizer();

			postChatButton.GestureRecognizers.Add(postChatButtonTap);

			StackLayout inputCountainer = new StackLayout
			{
				Spacing = Device.OnPlatform(5, 5, 1),
				Padding = Device.OnPlatform(5, 5, 5),
				Orientation = StackOrientation.Horizontal,
				BackgroundColor = Color.FromRgb( 45, 62, 80 ),
				Children = { chatEntry, postChatButton },
				WidthRequest = App.screenWidth
			};


			masterLayout.AddChildToLayout(mainTitleBar, 0, 0);
			masterLayout.AddChildToLayout(subTitleBar, 0, Device.OnPlatform(9, 10, 10));
			masterLayout.AddChildToLayout ( chatHistoryListView, 0, 17 );
			masterLayout.AddChildToLayout ( inputCountainer, 0, 85 );

			ScrollView masterScroll = new ScrollView ();
			masterScroll.Orientation = ScrollOrientation.Vertical;
			masterScroll.Content = masterLayout;
			masterScroll.IsClippedToBounds = true;

			postChatButtonTap.Tapped += async (object sender, EventArgs e) => 
			{
				ChatDetails detail = new ChatDetails();
				detail.AuthorName = "prvn";
				detail.Message = chatEntry.Text;
				detail.FromUserID = currentuser.UserId.ToString();
				detail.CurrentUserid = currentuser.UserId.ToString();
				chatList.Add( detail );
				chatEntry.Text = "";
				chatHistoryListView.ScrollTo( chatList[ chatList.Count -1 ], ScrollToPosition.End, true );

				if(!string.IsNullOrEmpty( detail.Message ))
					await ServiceHelper.SendChatMessage( currentuser.UserId.ToString(), touserID, detail.Message );
			};



			/*	this.Appearing += async (object sender, EventArgs e) => 
			{

				progressBar.ShowProgressbar( "Preparing chat window..." );
				masterScroll.IsVisible = true;

				chatUsersList = await ServiceHelper.GetAllChatUsers ();



				progressBar.HideProgressbar();

			};*/


			MessagingCenter.Subscribe<CrossPushNotificationListener, string>(this, "boom", (page, message) =>
				{
					string pushResult = message;
					string[] delimiters = { "&&" };
					string[] clasIDArray = pushResult.Split(delimiters, StringSplitOptions.None);
					string chatMessage = clasIDArray [0];
					string fromUser = clasIDArray [1];


					if( touserID == fromUser )
					{
						ChatDetails detail = new ChatDetails();
						detail.AuthorName = fromUser;
						detail.Message = chatMessage;
						detail.FromUserID = fromUser;
						detail.CurrentUserid = currentuser.UserId.ToString();
						chatList.Add( detail );

						if( chatList != null && chatList.Count > 1 )
						chatHistoryListView.ScrollTo( chatList[ chatList.Count -1 ], ScrollToPosition.End, true );
					}


				});


			Content = masterScroll;

		}
コード例 #22
0
 /// <summary>
 /// Sets the text alignment.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetVerticalTextAlignment(ExtendedEntry view)
 {
 }
コード例 #23
0
        public Comentarios()
        {
            BackgroundColor = Color.FromRgb (96, 178, 54);

            var guardaritem = new ToolbarItem {
                Text = "Guardar",
                //Order = ToolbarItemOrder.Secondary
            };

            ToolbarItems.Add (guardaritem);

            RelativeLayout layoutsup = new RelativeLayout ();

            Label lblpara = new Label () {
                Text="Para:"
            };

            layoutsup.Children.Add (lblpara,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((Parent) => {
                    return 50;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 40;
                }));

            SearchBar searchBar = new SearchBar
            {
                Placeholder = "Buscar",
                BackgroundColor= Color.FromRgb (96, 178, 54)
            };

            layoutsup.Children.Add (searchBar,
                Constraint.Constant (40),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-50;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 40;
                }));

            RelativeLayout layout = new RelativeLayout ();

            var imgBackground = new Image () {
                Source = ImageSource.FromResource ("RedSocial.Resources.foto.png")
            };

            layout.Children.Add (imgBackground,
                Constraint.Constant (20),
                Constraint.Constant (20),
                Constraint.RelativeToParent ((Parent) => {
                    return 50;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 50;
            }));

            Entry comentario = new Entry ();
            comentario.AnchorY = 200;

            layout.Children.Add (comentario,
                Constraint.Constant (70),
                Constraint.Constant (20),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-100;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 200;
                }));

            BoxView barra = new BoxView ();
            barra.BackgroundColor = Color.White;
            barra.AnchorY = 40;

            BoxView blanco = new BoxView ();
            blanco.BackgroundColor = Color.Green;
            blanco.AnchorY = 400;

            RelativeLayout layoutcomentario = new RelativeLayout ();

            BoxView fondo = new BoxView (){
                BackgroundColor=Color.White,
                HeightRequest=30
            };

            layoutcomentario.Children.Add (fondo,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 30;
                }));

            ExtendedEntry ecomentario = new ExtendedEntry (){
                Placeholder="Escriba un comentario",
                Font = Font.OfSize("arial",10)
            };
            comentario.AnchorY = 25;

            layoutcomentario.Children.Add (ecomentario,
                Constraint.Constant (2),
                Constraint.Constant (2),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-95;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 25;
                }));

            Button publicar = new Button (){
                Text="Publicar",
                FontSize=14,
                TextColor = Color.Gray

            };
            publicar.AnchorY = 25;

            layoutcomentario.Children.Add (publicar,
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-100;
                }),
                Constraint.Constant (2),
                Constraint.RelativeToParent ((Parent) => {
                    return 100;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 25;
                }));

            this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);

            StackLayout slayout = new StackLayout
            {
                Children =
                {
                    searchBar,
                    new LayoutNoticiaconcomentarios(),

                    layoutcomentario

                }
                };

            ScrollView scrollview = new ScrollView {

                Content = slayout

            };

            this.Content = scrollview;

            ecomentario.Focus ();
        }
コード例 #24
0
        /// <summary>
        /// Sets the color of the placeholder text.
        /// </summary>
        /// <param name="view">The view.</param>
        void SetPlaceholderTextColor(ExtendedEntry view)
        {
            /*
UIColor *color = [UIColor lightTextColor];
YOURTEXTFIELD.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"PlaceHolder Text" attributes:@{NSForegroundColorAttributeName: color}];
            */
            if(string.IsNullOrEmpty(view.Placeholder) == false && view.PlaceholderTextColor != Color.Default) {
                NSAttributedString placeholderString = new NSAttributedString(view.Placeholder, new UIStringAttributes(){ ForegroundColor = view.PlaceholderTextColor.ToUIColor() });
                Control.AttributedPlaceholder = placeholderString;
            }
        }
コード例 #25
0
 /// <summary>
 /// Sets the border.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetBorder(ExtendedEntry view)
 {
     Control.BorderStyle = view.HasBorder ? UITextBorderStyle.RoundedRect : UITextBorderStyle.None;
 }
コード例 #26
0
ファイル: Registro.xaml.cs プロジェクト: jupabequi/COLPLATP12
		public Registro (ILoginManager ilm)
		{

			this.Title = "Registro";

			RelativeLayout layout = new RelativeLayout ();

			//Colocar background
			var imgBackground = new Image () {
				Source = ImageSource.FromResource ("PaZos.Resources.FondoLogin.png"),
				Aspect = Aspect.AspectFill
			};

			layout.Children.Add (imgBackground,
				Constraint.Constant (0),
				Constraint.Constant (0),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Height;
				}));


			BoxView bv = new BoxView () {
				BackgroundColor = Color.FromRgb(232,78,27)
			};
			layout.Children.Add (bv,
				Constraint.Constant (0),
				Constraint.Constant (0),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return 60;
				}));

			Label titulo = new Label () {
				Text="Registro",
				FontSize = 24,
				FontFamily = "TwCenMT-Condensed",
				TextColor = Color.White,
				HorizontalOptions=LayoutOptions.Center,
				XAlign= TextAlignment.Center
			};
			layout.Children.Add (titulo,
				Constraint.Constant (0),
				Constraint.Constant (25),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return 60;
				}));

			var logo = new Image () {
				Source = ImageSource.FromResource ("PaZos.Resources.pazosicon.png"),
				Aspect = Aspect.AspectFill
			};

			layout.Children.Add (logo,
				Constraint.Constant (15),
				Constraint.Constant (15),
				Constraint.RelativeToParent ((Parent) => {
					return 40;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return 40;
				}));
			

			int alto = 35;
			int ytemp = 70;


			var txtNombre = new ExtendedEntry () {
				Placeholder="Nombre",
				BackgroundColor = Color.White,
				Font = Font.OfSize("TwCenMT-Condensed",18),
				HasBorder=true
			};

			txtNombre.Behaviors.Add (new MaxLengthValidator { MaxLength = 40 });

			layout.Children.Add (txtNombre,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));
			ytemp = ytemp + alto;
			var txtApellido = new ExtendedEntry () {
				Placeholder="Apellido",
				BackgroundColor = Color.White,
				Font = Font.OfSize("TwCenMT-Condensed",18),
				HasBorder=true
			};
			layout.Children.Add (txtApellido,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));

			txtApellido.Behaviors.Add (new MaxLengthValidator { MaxLength = 40 });


			ytemp = ytemp + alto+10;
			var txtCorreo = new ExtendedEntry () {
				Placeholder="Correo electrónico",
				BackgroundColor = Color.White,
				Font = Font.OfSize("TwCenMT-Condensed",18),
				HasBorder=true
			};
			layout.Children.Add (txtCorreo,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));
			txtCorreo.Behaviors.Add (new EmailValidatorBehavior());


			ytemp = ytemp + alto;
			var txtUsuario = new ExtendedEntry () {
				Placeholder="Usuario (Nombre para mostrar)",
				BackgroundColor = Color.White,
				Font = Font.OfSize("TwCenMT-Condensed",18),
				HasBorder=true
			};
			layout.Children.Add (txtUsuario,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));
			txtUsuario.Behaviors.Add (new MaxLengthValidator { MaxLength = 12 });

			ytemp = ytemp + alto+10;
			var txtclave = new ExtendedEntry () {
				Placeholder="Contraseña",
				BackgroundColor = Color.White,
				Font = Font.OfSize("TwCenMT-Condensed",18),
				HasBorder=true,
				IsPassword=true
			};
			layout.Children.Add (txtclave,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));
			txtclave.Behaviors.Add (new MaxLengthValidator { MaxLength = 12 });

			ytemp = ytemp + alto;
			var txtclave2 = new ExtendedEntry () {
				Placeholder="Repetir contraseña",
				BackgroundColor = Color.White,
				Font = Font.OfSize("TwCenMT-Condensed",18),
				HasBorder=true,
				IsPassword=true
			};
			layout.Children.Add (txtclave2,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));

			txtclave2.Behaviors.Add (new MaxLengthValidator { MaxLength = 12 });

			ytemp = ytemp + alto+10;
			var txtedad = new AsisprinPicker () {
				Title="Edad",
				BackgroundColor = Color.White
			};



			int i = 12;
			while (i<60)
			{
				txtedad.Items.Add(i.ToString());
				i++;
			}
			layout.Children.Add (txtedad,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return (Parent.Width-100)/2-5;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));




			var pksexo = new AsisprinPicker () {
				Title="Sexo",
				BackgroundColor = Color.White
			};
			Dictionary<string, int> tiposexo = new Dictionary<string, int>
			{
				{ "Masculino", 1 }, 
				{ "Femenino", 2 },
				{ "LGBTI", 3 }
			};
			foreach (string tSexo in tiposexo.Keys)
			{
				pksexo.Items.Add(tSexo);
			}
			layout.Children.Add (pksexo,
				Constraint.RelativeToParent ((Parent) => {
					return (Parent.Width/2)+5;
				}),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return (Parent.Width-100)/2-5;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));

			ytemp = ytemp + alto+10;
			pkPais = new AsisprinPicker () {
				Title="Pais",
				BackgroundColor = Color.White
			};


			pkPais.SelectedIndex = 1;
			layout.Children.Add (pkPais,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));
			pkPais.SelectedIndexChanged += (object sender, EventArgs e) => {
				ListarDepartamentos ();
			};
				

			ytemp = ytemp + alto;
			pkDepartamento = new AsisprinPicker () {
				Title="Departamento",
				BackgroundColor = Color.White
			};


			layout.Children.Add (pkDepartamento,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));

			pkDepartamento.SelectedIndexChanged += (object sender, EventArgs e) => {
				ListarCiudades ();
			};

			ytemp = ytemp + alto;
			pkCiudad = new AsisprinPicker () {
				Title="Ciudad o municipio",
				BackgroundColor = Color.White
			};


			layout.Children.Add (pkCiudad,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));

			ytemp = ytemp + alto+10;
			var button = new Button { Text = "Registrar usuario",
				BackgroundColor = Color.Gray,
				TextColor = Color.White,
				Font = Font.OfSize("TwCenMT-Condensed",22)
			};
			button.Clicked += (sender, e) => {



				/*if (txtNombre.Text=="" || txtNombre.Text == null){

					DisplayActionSheet("Resgistro sin completar","Cancelar","ok",null);
					return;
				}*/
				Usuario Ruser = new Usuario();

				Ruser.nombre = txtNombre.Text;
				Ruser.apellidos = txtApellido.Text;
				Ruser.correo = txtCorreo.Text;
				Ruser.ciudad = pkCiudad.SelectedIndex;
				Ruser.contrasena=txtclave.Text;
				Ruser.departamento=pkDepartamento.SelectedIndex;
				Ruser.genero=pksexo.SelectedIndex;
				Ruser.edad=txtedad.SelectedIndex;
				Ruser.ocupacion="";
				Ruser.pais=pkPais.SelectedIndex;
				Ruser.usuario=txtUsuario.Text;



				registrausuario(Ruser);

				//DisplayAlert("Cuenta creada", "Add processing login here", "OK");
				ilm.ShowLogin(txtUsuario.Text);
			};
			layout.Children.Add (button,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));
			/*
			ytemp = ytemp + alto+10;
			var lbmen1 = new Label () {
				Text = "Si continúas, aceptas las",
				VerticalOptions = LayoutOptions.Center
			};
			layout.Children.Add (lbmen1,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return 50;
				}));
			ytemp = ytemp + 20;
			var lbmen2 = new Label () {
				Text = "condiciones de uso de la aplicación",
				VerticalOptions = LayoutOptions.Center,
				Font = Font.OfSize("TwCenMT-Condensed",22)
			};
			layout.Children.Add (lbmen2,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return 50;
				}));
			ytemp = ytemp + 20;
			var lbmen3 = new Label () {
				Text = "y la política de privacidad.",
				VerticalOptions = LayoutOptions.Center,
				Font = Font.OfSize("TwCenMT-Condensed",22)
			};
			layout.Children.Add (lbmen3,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return 50;
				}));


			var cancel = new Button { Text = "Cancel" };
			cancel.Clicked += (sender, e) => {



				MessagingCenter.Send<ContentPage> (this, "Login");
			};
*/

			ScrollView scrollview = new ScrollView {

				Content = layout

			};



			Content = scrollview;



				/*new StackLayout {
				Padding = new Thickness (10, 40, 10, 10),
				Children = {
					imgBackground,
					new Label { Text = "Create Account", Font = Font.SystemFontOfSize(NamedSize.Large) }, 
					new Label { Text = "Choose a Username" },
					new Entry { Text = "" },
					new Label { Text = "Password" },
					new Entry { Text = "" },
					new Label { Text = "Re-enter Password" },
					new Entry { Text = "" },
					button, cancel
				}
			};*/
		}
コード例 #27
0
 /// <summary>
 /// Sets the MaxLength characteres.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetMaxLength(ExtendedEntry view)
 {
     Control.SetFilters(new IInputFilter[] { new global::Android.Text.InputFilterLengthFilter(view.MaxLength) });
 }
コード例 #28
0
		/// <summary>
		/// Sets the color of the placeholder text.
		/// </summary>
		/// <param name="view">The view.</param>
		private void SetPlaceholderTextColor(ExtendedEntry view){
			if(view.PlaceholderTextColor != Color.Default) 
				Control.SetHintTextColor(view.PlaceholderTextColor.ToAndroid());			
		}
コード例 #29
0
		/// <summary>
		/// Sets the font.
		/// </summary>
		/// <param name="view">The view.</param>
		private void SetFont(ExtendedEntry view)
		{
			if(view.Font != Font.Default) {
				Control.TextSize = view.Font.ToScaledPixel();
				Control.Typeface = view.Font.ToExtendedTypeface(Context);
			}
		}
コード例 #30
0
		/// <summary>
		/// Sets the text alignment.
		/// </summary>
		/// <param name="view">The view.</param>
		private void SetTextAlignment(ExtendedEntry view)
		{
			switch (view.XAlign)
			{
				case Xamarin.Forms.TextAlignment.Center:
					Control.Gravity = GravityFlags.CenterHorizontal;
					break;
				case Xamarin.Forms.TextAlignment.End:
					Control.Gravity = GravityFlags.End;
					break;
				case Xamarin.Forms.TextAlignment.Start:
					Control.Gravity = GravityFlags.Start;
					break;
			}
		}
コード例 #31
0
		/// <summary>
		/// Sets the border.
		/// </summary>
		/// <param name="view">The view.</param>
		private void SetBorder(ExtendedEntry view)
		{
			//NotCurrentlySupported: HasBorder peroperty not suported on Android
		}
コード例 #32
0
        /// <summary>
        /// Sets the color of the placeholder text.
        /// </summary>
        /// <param name="view">The view.</param>
        private void SetPlaceholderTextColor(ExtendedEntry view)
        {
            //the EntryRenderer renders two child controls. A PhoneTextBox or PasswordBox
            // depending on the IsPassword property of the Xamarin form control

            if (view.IsPassword)
            {
                //NotCurrentlySupported: Placeholder text color is not supported on Windows Phone Password control
            }
            else
            {
                if (view.PlaceholderTextColor != Color.Default && _thisPhoneTextBox != null)
                {
                    var hintStyle = new System.Windows.Style(typeof(System.Windows.Controls.ContentControl));
                    hintStyle.Setters.Add(
                        new System.Windows.Setter(
                            System.Windows.Controls.Control.ForegroundProperty,
                            view.PlaceholderTextColor.ToBrush())
                        );
                    _thisPhoneTextBox.HintStyle = hintStyle;
                }
            }        
        }
コード例 #33
0
 /// <summary>
 /// Sets the MaxLength characteres.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetMaxLength(ExtendedEntry view)
 {
     Control.SetFilters(new IInputFilter[] { new InputFilterLengthFilter(view.MaxLength) });
 }
コード例 #34
0
		public async void cargarAcciones(){


			RelativeLayout layout = new RelativeLayout ();

			//Colocar background
			var imgBackground = new Image () {
				Source = ImageSource.FromResource ("PaZos.Resources.FondoAcciones.png"),
				Aspect = Aspect.AspectFill
			};

			layout.Children.Add (imgBackground,
				Constraint.Constant (0),
				Constraint.Constant (0),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Height;
				}));
			//Fin Colocar background 

			//Dias
			var imgDias = new Image ();


			switch (dia){

			case 1:
				imgDias.Source = ImageSource.FromResource ("PaZos.Resources.Dias.lunes.png");
				break;
			case 2:
				imgDias.Source = ImageSource.FromResource ("PaZos.Resources.Dias.martes.png");
				break;
			case 3:
				imgDias.Source = ImageSource.FromResource ("PaZos.Resources.Dias.miercoles.png");
				break;
			case 4:
				imgDias.Source = ImageSource.FromResource ("PaZos.Resources.Dias.Jueves.png");
				break;
			case 5:
				imgDias.Source = ImageSource.FromResource ("PaZos.Resources.Dias.Viernes.png");
				break;
			case 6:
				imgDias.Source = ImageSource.FromResource ("PaZos.Resources.Dias.Sabado.png");
				break;
			case 7:
				imgDias.Source = ImageSource.FromResource ("PaZos.Resources.Dias.Domingo.png");
				break;

			};



			layout.Children.Add (imgDias,
				Constraint.Constant (15),
				Constraint.Constant (15),
				Constraint.RelativeToParent ((Parent) => {
					return 250;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return 52;
				}));

			int y = 15;
			var lbdia = new Button () {
				Text = "",
				TextColor = Color.White,
				//BackgroundColor = Color.Blue
			};
			/*lbdia.Clicked += (sender, args) => {
				Selected();
			};*/

			layout.Children.Add (lbdia,
				Constraint.Constant (15),
				Constraint.Constant (y),
				Constraint.RelativeToParent ((Parent) => {
					return 250;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return 52;
				}));



			var Lista = await new RestAccionesAhorradoras ().get (usuario);

			if (Lista != null) {
				int j = Lista.Count + 1;
				y = 15;
				Label lbvalor;
				Double total = 0;

				txtaccion = new List<ExtendedEntry> ();
				txtvalor = new List<ExtendedEntry> ();
				idaccion = new List<int> ();

				int i, a = 1;
				y = 52 + y + 10;

				for (i = 1; i < j; i++) {
				
					total = total + Lista [i - 1].valor;
					idaccion.Add (Lista [i - 1].Id);

					if (Lista [i - 1].dia == dia) {
					
						txtaccion.Add (new ExtendedEntry () {
							Placeholder = "Acción " + a.ToString (),
							Text = Lista [i - 1].accion,
							Font = Font.OfSize ("TwCenMT-Condensed", 18)
						});
						layout.Children.Add (txtaccion [a - 1],
							Constraint.Constant (20),
							Constraint.Constant (y + 90 * (a - 1)),
							Constraint.RelativeToParent ((Parent) => {
								return Parent.Width - 40;
							}),
							Constraint.RelativeToParent ((Parent) => {
								return 40;
							}));	


						lbvalor = new Label () {
							Text = "Valor",
							FontSize = 18,
							FontFamily = "TwCenMT-Condensed"
						};
						layout.Children.Add (lbvalor,
							Constraint.RelativeToParent ((Parent) => {
								return Parent.Width - 20 - 150 - 45;
							}),
							Constraint.Constant (y + 55 + 90 * (a - 1)),
							Constraint.RelativeToParent ((Parent) => {
								return 100;
							}),
							Constraint.RelativeToParent ((Parent) => {
								return 40;
							}));	

						txtvalor.Add (new ExtendedEntry () {
							Text = Lista [i - 1].valor.ToString ("N0"),
							Font = Font.OfSize ("TwCenMT-Condensed", 18),
							XAlign = TextAlignment.End
						
						});
						txtvalor [a - 1].Behaviors.Add (new NumberValidatorBehavior ());
						layout.Children.Add (txtvalor [a - 1],
							Constraint.RelativeToParent ((Parent) => {
								return Parent.Width - 20 - 150;
							}),
							Constraint.Constant (y + 45 + 90 * (a - 1)),
							Constraint.RelativeToParent ((Parent) => {
								return 150;
							}),
							Constraint.RelativeToParent ((Parent) => {
								return 40;
							}));	

						a++;
					}
				}

				txtaccion.Add (new ExtendedEntry () {
					Placeholder = "Acción " + a.ToString (),
					Font = Font.OfSize ("TwCenMT-Condensed", 18)
				});
				layout.Children.Add (txtaccion [a - 1],
					Constraint.Constant (20),
					Constraint.Constant (y + 90 * (a - 1)),
					Constraint.RelativeToParent ((Parent) => {
						return Parent.Width - 40;
					}),
					Constraint.RelativeToParent ((Parent) => {
						return 40;
					}));	


				lbvalor = new Label () {
					Text = "Valor",
					FontSize = 18,
					FontFamily = "TwCenMT-Condensed"
				};
				layout.Children.Add (lbvalor,
					Constraint.RelativeToParent ((Parent) => {
						return Parent.Width - 20 - 150 - 45;
					}),
					Constraint.Constant (y + 55 + 90 * (a - 1)),
					Constraint.RelativeToParent ((Parent) => {
						return 100;
					}),
					Constraint.RelativeToParent ((Parent) => {
						return 40;
					}));	

				txtvalor.Add (new ExtendedEntry () {
					Font = Font.OfSize ("TwCenMT-Condensed", 18),
					XAlign = TextAlignment.End
				});
				txtvalor [a - 1].Behaviors.Add (new NumberValidatorBehavior ());
				layout.Children.Add (txtvalor [a - 1],
					Constraint.RelativeToParent ((Parent) => {
						return Parent.Width - 20 - 150;
					}),
					Constraint.Constant (y + 45 + 90 * (a - 1)),
					Constraint.RelativeToParent ((Parent) => {
						return 150;
					}),
					Constraint.RelativeToParent ((Parent) => {
						return 40;
					}));	
			
				y = y + 90 * (a);

				lbvalor = new Label () {
					Text = "Valor total",
					FontSize = 18,
					FontFamily = "TwCenMT-Condensed"
				};
				layout.Children.Add (lbvalor,
					Constraint.RelativeToParent ((Parent) => {
						return Parent.Width - 20 - 200 - 60;
					}),
					Constraint.Constant (y + 5),
					Constraint.RelativeToParent ((Parent) => {
						return 60;
					}),
					Constraint.RelativeToParent ((Parent) => {
						return 40;
					}));

				ExtendedEntry txttotal = new ExtendedEntry () {
					Font = Font.OfSize ("TwCenMT-Condensed", 18),
					XAlign = TextAlignment.End,
					IsEnabled = false,
					Text = "$ " + total.ToString ("N0")
				};
				layout.Children.Add (txttotal,
					Constraint.RelativeToParent ((Parent) => {
						return Parent.Width - 20 - 200;
					}),
					Constraint.Constant (y),
					Constraint.RelativeToParent ((Parent) => {
						return 200;
					}),
					Constraint.RelativeToParent ((Parent) => {
						return 40;
					}));	


				ScrollView scrollview = new ScrollView {

					Content = layout

				};


				Content = scrollview;

			} else {
				DisplayAlert ("Acceso a datos", "Problemas en la comunicación.", "Aceptar");
			}



			var Label = new Label ();

		}
コード例 #35
0
 /// <summary>
 /// Sets the maxLength.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetMaxLength(ExtendedEntry view)
 {
     Control.ShouldChangeCharacters = (textField, range, replacementString) =>
     {
         var newLength = textField.Text.Length + replacementString.Length - range.Length;
         return newLength <= view.MaxLength;
     };
 }
コード例 #36
0
 /// <summary>
 /// Sets the border.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetBorder(ExtendedEntry view)
 {
     Control.BorderStyle = view.HasBorder ? UITextBorderStyle.RoundedRect : UITextBorderStyle.None;
 }
コード例 #37
0
		public void dibuja(int dia){

			RelativeLayout layout = new RelativeLayout ();

			//Colocar background
			var imgBackground = new Image () {
				Source = ImageSource.FromResource ("PaZos.Resources.FondoAcciones.png"),
				Aspect = Aspect.AspectFill
			};

			layout.Children.Add (imgBackground,
				Constraint.Constant (0),
				Constraint.Constant (0),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Height;
				}));




			double y = 20, yinicial;

			yinicial = y;
			int gap;
			int hoy = dia;
			int alto = 40;
			gap = alto + 10;
			int espacio = alto*2+20+15;

			var imglunes = new Image () {
				Source = ImageSource.FromResource ("PaZos.Resources.Dias.lunes.png"),
			};

			layout.Children.Add (imglunes,
				Constraint.RelativeToParent ((Parent) => {

					if(hoy==1){
						return 10;
					}else{
						return Parent.Width/2 - 125;
					}
				}),
				Constraint.Constant (y),
				Constraint.RelativeToParent ((Parent) => {
					return 250;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));

			var lblunes = new Button () {
				Text = "",
				TextColor = Color.White,
				//BackgroundColor = Color.Blue
			};
			lblunes.Clicked += (sender, args) => {
				Selected(1);
			};

			layout.Children.Add (lblunes,
				Constraint.RelativeToParent ((Parent) => {
					if(hoy==1){
						return 10;
					}else{
						return Parent.Width/2 - 125;
					}
				}),
				Constraint.Constant (y),
				Constraint.RelativeToParent ((Parent) => {
					return 250;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));



			if (hoy == 1) {

				y = y + espacio;
			}

			//martes

			var imgmartes = new Image () {
				Source = ImageSource.FromResource ("PaZos.Resources.Dias.martes.png"),
			};

			layout.Children.Add (imgmartes,
				Constraint.RelativeToParent ((Parent) => {
					if(hoy==2){
						return 10;
					}else{
						return Parent.Width/2 - 125;
					}
				}),
				Constraint.Constant (y+gap),
				Constraint.RelativeToParent ((Parent) => {
					return 250;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));

			var lbmartes = new Button () {
				Text = "",
				TextColor = Color.White,
				//BackgroundColor = Color.Blue
			};
			lbmartes.Clicked += (sender, args) => {
				Selected(2);
			};

			layout.Children.Add (lbmartes,
				Constraint.RelativeToParent ((Parent) => {
					if(hoy==2){
						return 10;
					}else{
						return Parent.Width/2 - 125;
					}
				}),
				Constraint.Constant (y+gap),
				Constraint.RelativeToParent ((Parent) => {
					return 250;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));

			//miercoles
			if (hoy == 2) {

				y = y + espacio;
			}
			var imgmiercoles = new Image () {
				Source = ImageSource.FromResource ("PaZos.Resources.Dias.miercoles.png"),
			};


			layout.Children.Add (imgmiercoles,
				Constraint.RelativeToParent ((Parent) => {
					if(hoy==3){
						return 10;
					}else{
						return Parent.Width/2 - 125;
					}
				}),
				Constraint.Constant (y+gap*2),
				Constraint.RelativeToParent ((Parent) => {
					return 250;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));


			var lbmiercoles = new Button () {
				Text = "",
				TextColor = Color.White,
				//BackgroundColor = Color.Blue
			};
			lbmiercoles.Clicked += (sender, args) => {
				Selected(3);
			};

			layout.Children.Add (lbmiercoles,
				Constraint.RelativeToParent ((Parent) => {
					if(hoy==3){
						return 10;
					}else{
						return Parent.Width/2 - 125;
					}
				}),
				Constraint.Constant (y+gap*2),
				Constraint.RelativeToParent ((Parent) => {
					return 250;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));

			//jueves
			if (hoy == 3) {

				y = y + espacio;
			}
			var imgjueves = new Image () {
				Source = ImageSource.FromResource ("PaZos.Resources.Dias.Jueves.png"),
			};

			layout.Children.Add (imgjueves,
				Constraint.RelativeToParent ((Parent) => {
					if(hoy==4){
						return 10;
					}else{
						return Parent.Width/2 - 125;
					}
				}),
				Constraint.Constant (y+gap*3),
				Constraint.RelativeToParent ((Parent) => {
					return 250;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));

			var lbjueves = new Button () {
				Text = "",
				TextColor = Color.White,
				//BackgroundColor = Color.Blue
			};
			lbjueves.Clicked += (sender, args) => {
				Selected(4);
			};

			layout.Children.Add (lbjueves,
				Constraint.RelativeToParent ((Parent) => {
					if(hoy==4){
						return 10;
					}else{
						return Parent.Width/2 - 125;
					}
				}),
				Constraint.Constant (y+gap*3),
				Constraint.RelativeToParent ((Parent) => {
					return 250;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));

			//viernes
			if (hoy == 4) {

				y = y + espacio;
			}
			var imgviernes = new Image () {
				Source = ImageSource.FromResource ("PaZos.Resources.Dias.Viernes.png")
			};


			layout.Children.Add (imgviernes,
				Constraint.RelativeToParent ((Parent) => {
					if(hoy==5){
						return 10;
					}else{
						return Parent.Width/2 - 125;
					}
				}),
				Constraint.Constant (y+gap*4),
				Constraint.RelativeToParent ((Parent) => {
					return 250;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));

			var lbviernes = new Button () {
				Text = "",
				TextColor = Color.White,
				//BackgroundColor = Color.Blue
			};
			lbviernes.Clicked += (sender, args) => {
				Selected(5);
			};

			layout.Children.Add (lbviernes,
				Constraint.RelativeToParent ((Parent) => {
					if(hoy==5){
						return 10;
					}else{
						return Parent.Width/2 - 125;
					}
				}),
				Constraint.Constant (y+gap*4),
				Constraint.RelativeToParent ((Parent) => {
					return 250;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));

			//sabado
			if (hoy == 5) {

				y = y + espacio;
			}
			var imgsabado = new Image () {
				Source = ImageSource.FromResource ("PaZos.Resources.Dias.Sabado.png")
			};


			layout.Children.Add (imgsabado,
				Constraint.RelativeToParent ((Parent) => {
					if(hoy==6){
						return 10;
					}else{
						return Parent.Width/2 - 125;
					}
				}),
				Constraint.Constant (y+gap*5),
				Constraint.RelativeToParent ((Parent) => {
					return 250;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));

			var lbsabado = new Button () {
				Text = "",
				TextColor = Color.White,
				//BackgroundColor = Color.Blue
			};
			lbsabado.Clicked += (sender, args) => {
				Selected(6);
			};

			layout.Children.Add (lbsabado,
				Constraint.RelativeToParent ((Parent) => {
					if(hoy==6){
						return 10;
					}else{
						return Parent.Width/2 - 125;
					}
				}),
				Constraint.Constant (y+gap*5),
				Constraint.RelativeToParent ((Parent) => {
					return 250;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));


			//domingo
			if (hoy == 6) {

				y = y + espacio;
			}
			var imgdomingo = new Image () {
				Source = ImageSource.FromResource ("PaZos.Resources.Dias.Domingo.png")
			};


			layout.Children.Add (imgdomingo,
				Constraint.RelativeToParent ((Parent) => {
					if(hoy==7){
						return 10;
					}else{
						return Parent.Width/2 - 125;
					}
				}),
				Constraint.Constant (y+gap*6),
				Constraint.RelativeToParent ((Parent) => {
					return 250;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));

			var lbdomingo = new Button () {
				Text = "",
				TextColor = Color.White,
				//BackgroundColor = Color.Blue
			};
			lbdomingo.Clicked += (sender, args) => {
				Selected(7);
			};

			layout.Children.Add (lbdomingo,
				Constraint.RelativeToParent ((Parent) => {
					if(hoy==7){
						return 10;
					}else{
						return Parent.Width/2 - 125;
					}
				}),
				Constraint.Constant (y+gap*6),
				Constraint.RelativeToParent ((Parent) => {
					return 250;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));

			Label lblhoyahorre = new Label () {
				Text = "Hoy ahorré en:",
				FontSize = 20,
				FontFamily = "MyriadPro-Bold",
				XAlign= TextAlignment.Center
			};
			layout.Children.Add (lblhoyahorre,
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width/2 - 125;
				}),
				Constraint.Constant (yinicial+gap*(hoy)),
				Constraint.RelativeToParent ((Parent) => {
					return 250;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return 20;
				}));


			accion = new ExtendedEntry(){
				Placeholder="Acción 1",
				Font = Font.OfSize("TwCenMT-Condensed",22)
			};
			layout.Children.Add (accion,
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width/2 - 125;
				}),
				Constraint.Constant (yinicial+25+gap*(hoy)),
				Constraint.RelativeToParent ((Parent) => {
					return 250;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));

			accionvalor = new ExtendedEntry(){
				Placeholder="$",
				Font = Font.OfSize("TwCenMT-Condensed",22),
				XAlign = TextAlignment.End
			};
			accionvalor.Behaviors.Add (new NumberValidatorBehavior ());
			layout.Children.Add (accionvalor,
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width/2;
				}),
				Constraint.Constant (yinicial+30+alto+gap*(hoy)),
				Constraint.RelativeToParent ((Parent) => {
					return 125;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));



			ScrollView scrollview = new ScrollView {

				Content = layout

			};




			Content = scrollview;


		}
コード例 #38
0
ファイル: Registro.xaml.cs プロジェクト: jupabequi/COLPLATP20
		public Registro (ILoginManager ilm)
		{

			RelativeLayout layout = new RelativeLayout ();

			BackgroundColor = Color.FromRgb (96, 178, 54);
			//Colocar background
			var imgBackground = new Image () {
				Source = ImageSource.FromResource ("RedSocial.Resources.logo-con-inicio-nombre.png"),
				Aspect = Aspect.AspectFit
			};

			layout.Children.Add (imgBackground,
				Constraint.Constant (0),
				Constraint.Constant (20),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return 50;
				}));

			int alto = 40;
			int ytemp = 100;


			var txtNombre = new ExtendedEntry () {
				Placeholder="Nombre",
				BackgroundColor = Color.White,
				Font = Font.OfSize("TwCenMT-Condensed",22),
				HasBorder=true
			};

			//txtNombre.Behaviors.Add (new MaxLengthValidator { MaxLength = 40 });

			layout.Children.Add (txtNombre,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));
			ytemp = ytemp + alto;
			var txtApellido = new ExtendedEntry () {
				Placeholder="Apellido",
				BackgroundColor = Color.White,
				Font = Font.OfSize("TwCenMT-Condensed",22),
				HasBorder=true
			};
			layout.Children.Add (txtApellido,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));

			//txtApellido.Behaviors.Add (new MaxLengthValidator { MaxLength = 40 });


			ytemp = ytemp + alto+10;
			var txtCorreo = new ExtendedEntry () {
				Placeholder="Correo electrónico",
				BackgroundColor = Color.White,
				Font = Font.OfSize("TwCenMT-Condensed",22),
				HasBorder=true
			};
			layout.Children.Add (txtCorreo,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));
			//txtCorreo.Behaviors.Add (new EmailValidatorBehavior());


			ytemp = ytemp + alto;
			var txtUsuario = new ExtendedEntry () {
				Placeholder="Usuario",
				BackgroundColor = Color.White,
				Font = Font.OfSize("TwCenMT-Condensed",22),
				HasBorder=true
			};
			layout.Children.Add (txtUsuario,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));
			//txtUsuario.Behaviors.Add (new MaxLengthValidator { MaxLength = 10 });

			ytemp = ytemp + alto+10;
			var txtclave = new ExtendedEntry () {
				Placeholder="Contraseña",
				BackgroundColor = Color.White,
				Font = Font.OfSize("TwCenMT-Condensed",22),
				HasBorder=true,
				IsPassword=true
			};
			layout.Children.Add (txtclave,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));
			//txtclave.Behaviors.Add (new MaxLengthValidator { MaxLength = 12 });

			ytemp = ytemp + alto;
			var txtclave2 = new ExtendedEntry () {
				Placeholder="Repetir contraseña",
				BackgroundColor = Color.White,
				Font = Font.OfSize("TwCenMT-Condensed",22),
				HasBorder=true,
				IsPassword=true
			};
			layout.Children.Add (txtclave2,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));

			//txtclave2.Behaviors.Add (new MaxLengthValidator { MaxLength = 12 });

			ytemp = ytemp + alto+10;
			var txtedad = new Picker () {
				Title="Edad",
				BackgroundColor = Color.White
			};



			int i = 12;
			while (i<60)
			{
				txtedad.Items.Add(i.ToString());
				i++;
			}
			layout.Children.Add (txtedad,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return (Parent.Width-100)/2-5;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));




			var pksexo = new Picker () {
				Title="Sexo",
				BackgroundColor = Color.White
			};
			Dictionary<string, int> tiposexo = new Dictionary<string, int>
			{
				{ "Masculino", 1 }, 
				{ "Femenino", 2 }
			};
			foreach (string tSexo in tiposexo.Keys)
			{
				pksexo.Items.Add(tSexo);
			}
			layout.Children.Add (pksexo,
				Constraint.RelativeToParent ((Parent) => {
					return (Parent.Width/2)+5;
				}),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return (Parent.Width-100)/2-5;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));

			ytemp = ytemp + alto+10;





			ytemp = ytemp + alto+10;
			var button = new Button { Text = "Registrate",
				BackgroundColor = Color.Gray,
				TextColor = Color.White,
				Font = Font.OfSize("TwCenMT-Condensed",22)
			};
			button.Clicked += (sender, e) => {



				/*if (txtNombre.Text=="" || txtNombre.Text == null){

					DisplayActionSheet("Resgistro sin completar","Cancelar","ok",null);
					return;
				}*/
				Usuario Ruser = new Usuario();

				Ruser.nombre = txtNombre.Text;
				Ruser.apellidos = txtApellido.Text;
				Ruser.correo = txtCorreo.Text;
				Ruser.ciudad = pkCiudad.SelectedIndex;
				Ruser.contrasena=txtclave.Text;
				Ruser.departamento=pkDepartamento.SelectedIndex;
				Ruser.genero=pksexo.SelectedIndex;
				Ruser.edad=txtedad.SelectedIndex;
				Ruser.ocupacion="";
				Ruser.pais=pkPais.SelectedIndex;
				Ruser.usuario=txtUsuario.Text;



				registrausuario(Ruser);

				//DisplayAlert("Cuenta creada", "Add processing login here", "OK");
				ilm.ShowLogin();
			};
			layout.Children.Add (button,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return alto;
				}));

			ytemp = ytemp + alto+10;
			var lbmen1 = new Label () {
				Text = "Al hacer clic en Registrate, aceptas",
				VerticalOptions = LayoutOptions.Center,
				XAlign=TextAlignment.Center
			};
			layout.Children.Add (lbmen1,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return 50;
				}));
			ytemp = ytemp + 20;
			var lbmen2 = new Label () {
				Text = " las Condiciones de servicio y ",
				VerticalOptions = LayoutOptions.Center,
				XAlign=TextAlignment.Center

			};
			layout.Children.Add (lbmen2,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return 50;
				}));
			ytemp = ytemp + 20;
			var lbmen3 = new Label () {
				Text = "la Politica de Privacidad",
				VerticalOptions = LayoutOptions.Center,
				XAlign = TextAlignment.Center
			};
			layout.Children.Add (lbmen3,
				Constraint.Constant (50),
				Constraint.Constant (ytemp),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-100;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return 50;
				}));


			var cancel = new Button { Text = "Cancel" };
			cancel.Clicked += (sender, e) => {



				MessagingCenter.Send<ContentPage> (this, "Login");
			};





			Content = layout;



			/*new StackLayout {
				Padding = new Thickness (10, 40, 10, 10),
				Children = {
					imgBackground,
					new Label { Text = "Create Account", Font = Font.SystemFontOfSize(NamedSize.Large) }, 
					new Label { Text = "Choose a Username" },
					new Entry { Text = "" },
					new Label { Text = "Password" },
					new Entry { Text = "" },
					new Label { Text = "Re-enter Password" },
					new Entry { Text = "" },
					button, cancel
				}
			};*/
		}
コード例 #39
0
ファイル: Mensajes.xaml.cs プロジェクト: jupabequi/COLPLATP20
        public Mensajes()
        {
            BackgroundColor = Color.FromRgb (96, 178, 54);

            var guardaritem = new ToolbarItem {
                Text = "Guardar",
                //Order = ToolbarItemOrder.Secondary
            };

            ToolbarItems.Add (guardaritem);

            RelativeLayout layoutsup = new RelativeLayout ();

            Label lblpara = new Label () {
                Text="Para:"
            };

            layoutsup.Children.Add (lblpara,
                Constraint.Constant (0),
                Constraint.Constant (6),
                Constraint.RelativeToParent ((Parent) => {
                    return 50;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 40;
                }));

            SearchBar searchBar = new SearchBar
            {
                Placeholder = "Amigos",
                BackgroundColor= Color.FromRgb (96, 178, 54)
            };

            layoutsup.Children.Add (searchBar,
                Constraint.Constant (40),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-50;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 40;
                }));

            RelativeLayout aquien = new RelativeLayout ();

            string foto = new Fotos ().fotoaleatoria();

            var imgfoto = new Image () {
                Source = ImageSource.FromResource (foto),
                Aspect = Aspect.AspectFill
            };

            aquien.Children.Add (imgfoto,
                Constraint.Constant (0),
                Constraint.Constant (2),
                Constraint.RelativeToParent ((Parent) => {
                    return 50;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 50;
                }));

            StackLayout labeltit = new StackLayout ();

            ExtendedEntry label = new ExtendedEntry () {
                Placeholder = "Comparte esto..."
            };

            labeltit.Children.Add (label);

            aquien.Children.Add (labeltit,
                Constraint.Constant (55),
                Constraint.Constant (2),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width - 55;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 50;
                }));
            layoutminicomentario mini = new layoutminicomentario ();

            this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);

            RelativeLayout rl = new RelativeLayout ();

            rl.Children.Add (layoutsup,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 40;
                }));
            rl.Children.Add (aquien,
                Constraint.Constant (0),
                Constraint.Constant (50),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 50;
                }));
            rl.Children.Add (new LayoutBorde(mini),
                Constraint.Constant (50),
                Constraint.Constant (120),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-100;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 50;
                }));

            this.Content = rl;
        }
コード例 #40
0
        public ShoppingListsTest()
        {
            BackgroundColor = Color.White;

            Label topLabel = new Label {
                Text = "YOUR LISTS",
                FontSize = 20,
                VerticalOptions = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.Start,
                TextColor = Color.Black
            };

            Entry addListEntry = new ExtendedEntry {
                Placeholder = "Add a New List...",
                PlaceholderTextColor = Color.Black,
                VerticalOptions = LayoutOptions.Start,
                TextColor = Color.Black
            };

            addListEntry.Completed += (sender, e) => {
                var i = addListEntry.Text;
                TapandGo.Database.Database.GetDatabase().AddNewList(i);
                addListEntry.Text = null;
                addListEntry.Placeholder = "Add a New List...";
                listView.ItemsSource = TapandGo.Database.Database.GetDatabase().GetLists();
            };

            SearchBar searchEntry = new SearchBar {
                Text = "Search for items",
                VerticalOptions = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.FromHex("#044A0C")

            };
            searchEntry.Focused += OnsearchBarChanged;

            listView = new ListView ();
            listView.IsPullToRefreshEnabled = true;
            listView.ItemTemplate = new DataTemplate
                    (typeof(ShoppingListsItemCell));
            listView.ItemSelected += (sender, e) => {
                var todoItem = (TapandGo.Data.ShoppingListsData)e.SelectedItem;

                var todoPage = new TapandGo.Views.IndividualListTest();
                SelectedListId = todoItem.ListId;
                todoPage.BindingContext = todoItem;

                //((App)App.Current).ResumeAtTodoId = todoItem.ListId;
                Debug.WriteLine("setting ResumeAtTodoId = " + todoItem.ListId);

                Navigation.PushAsync(todoPage);
                //if (e.SelectedItem == null) return;
                //((ListView)sender).SelectedItem = null;
            };

            var layout = new StackLayout();
            layout.Children.Add(searchEntry);
            layout.Children.Add(topLabel);
            layout.Children.Add(addListEntry);
            layout.Children.Add(listView);
            layout.VerticalOptions = LayoutOptions.FillAndExpand;
            Content = layout;
        }
コード例 #41
0
 /// <summary>
 /// Sets the border.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetBorder(ExtendedEntry view)
 {
     //NotCurrentlySupported: HasBorder peroperty not suported on Android
 }
コード例 #42
0
 /// <summary>
 /// Sets AutoCorrection
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetAutoCorrection(ExtendedEntry view)
 {
     Control.AutocorrectionType = view.AutoCorrection ? UITextAutocorrectionType.Yes :
                                  UITextAutocorrectionType.No;
 }
コード例 #43
0
ファイル: Login.xaml.cs プロジェクト: jupabequi/COLPLATP20
		public Login (ILoginManager ilm)
		{


			BackgroundColor = Color.FromRgb (96, 178, 54);




			var button = new Button { 
				Text = "Iniciar sesión",
				FontSize = 22,
				TextColor = Color.Black,
				FontAttributes = FontAttributes.Bold,
				BackgroundColor = Color.FromRgb(237,236,241),
				BorderRadius=5
			};
			button.Clicked += (sender, e) => {
				if (String.IsNullOrEmpty(username.Text) || String.IsNullOrEmpty(password.Text))
				{
					DisplayAlert("Error de validación", "Usuario y contraseña son requeridos", "Intente nuevamente");
				} else {
					// REMEMBER LOGIN STATUS!
					CompruebaUser(ilm);

				}
			};
			var create = new Button { Text = "Crear cuenta" };
			create.Clicked += (sender, e) => {
				MessagingCenter.Send<ContentPage> (this, "Create");
			};








			username = new ExtendedEntry {
				Placeholder="Correo electronico",
				BackgroundColor = Color.White
			};

			//username.WidthRequest = 280;

			password = new ExtendedEntry { 
				Placeholder="Contraseña",
				BackgroundColor = Color.White,
				IsPassword=true

			};
			//password.WidthRequest = 280;

			var btnolvido = new Button {
				Text = "Recuperar contraseña",
				TextColor = Color.Black,
				VerticalOptions = LayoutOptions.Center
			};


			var abslayout = new RelativeLayout  ();


			var imgBackground = new Image () {
				Source = ImageSource.FromResource ("RedSocial.Resources.login-banner.png")
				//Aspect = Aspect.AspectFill
			};

			abslayout.Children.Add (imgBackground,
				Constraint.Constant (0),
				Constraint.Constant (0),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width*2;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return 500;
				}));



			int y = 50 + 350;
			//abslayout.Children.Add (new Label { Text = "Iniciar sesión", FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)) }, new Point (30, 30));
			//abslayout.Children.Add (new Label { Text = "Username" }, new Point (40, 40));
			abslayout.Children.Add (username, 
				Constraint.Constant (30),
				Constraint.RelativeToParent ((Parent) => {
					if(Parent.Width-50>375){
						return y;
					}else{
						return y-(350-((Parent.Width-50)*350/375));

					}

				}),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width - 60;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return 50;
				}));
			//abslayout.Children.Add (new Label { Text = "Password" }, new Point (50, 50));
			abslayout.Children.Add (password, 
				Constraint.Constant (30),
				Constraint.RelativeToParent ((Parent) => {
					if(Parent.Width-50>375){
						return y+50;
					}else{
						return (y+50)-(350-((Parent.Width-50)*350/375));

					}

				}),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width-60;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return 50;
				}));
			abslayout.Children.Add (button,  
				Constraint.Constant (30),
				Constraint.RelativeToParent ((Parent) => {
					if(Parent.Width-50>375){
						return y+50*2+10;
					}else{
						return (y+50*2+10)-(350-((Parent.Width-50)*350/375));

					}

				}),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width - 60;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return 49;
				}));

			abslayout.Children.Add (btnolvido,  
				Constraint.Constant (30),
				Constraint.RelativeToParent ((Parent) => {
					if(Parent.Width-50>375){
						return y+50*2+10+70;
					}else{
						return (y+50*2+10+70)-(350-((Parent.Width-50)*350/375));

					}

				}),
				Constraint.RelativeToParent ((Parent) => {
					return Parent.Width - 60;
				}),
				Constraint.RelativeToParent ((Parent) => {
					return 30;
				}));

			//abslayout.Children.Add (create, new Point (80, 80));



			ScrollView scrollview = new ScrollView {

				Content = abslayout

			};

			//Content = abslayout;
			Content = scrollview;
			/*Content = new StackLayout {
				Padding = new Thickness (10, 40, 10, 10),
				Children = {
					new Label { Text = "Login", FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)) }, 
					new Label { Text = "Username" },
					username,
					new Label { Text = "Password" },
					password,
					button, create,

				}
			};*/



		}
コード例 #44
0
 /// <summary>
 /// Sets the MaxLength characteres.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetMaxLength(ExtendedEntry view)
 {
     Control.SetFilters(new IInputFilter[] { new InputFilterLengthFilter(view.MaxLength) });
 }
コード例 #45
0
 /// <summary>
 /// Sets the border.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetBorder(ExtendedEntry view)
 {
     if (view.IsPassword && _thisPasswordBox != null)
     {
         _thisPasswordBox.BorderThickness = view.HasBorder ? new System.Windows.Thickness(2) :  new System.Windows.Thickness(0);
     }
     else if (!view.IsPassword && _thisPhoneTextBox != null)
     {
         _thisPhoneTextBox.BorderThickness = view.HasBorder ? new System.Windows.Thickness(2) : new System.Windows.Thickness(0);
     }
 }
コード例 #46
0
 /// <summary>
 /// Sets the text alignment.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetTextAlignment(ExtendedEntry view)
 {
     switch (view.XAlign)
     {
         case TextAlignment.Center:
             Control.TextAlignment = UITextAlignment.Center;
             break;
         case TextAlignment.End:
             Control.TextAlignment = UITextAlignment.Right;
             break;
         case TextAlignment.Start:
             Control.TextAlignment = UITextAlignment.Left;
             break;
     }
 }
コード例 #47
0
 /// <summary>
 /// Sets the font.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetFont(ExtendedEntry view)
 {
     if (view.Font != Font.Default)
         if (view.IsPassword)
         {
             if (_thisPasswordBox != null)
             {
                 _thisPasswordBox.FontSize = view.Font.GetHeight();
             }
         }
         else
         {
             if (_thisPhoneTextBox != null)
             {
                 _thisPhoneTextBox.FontSize = view.Font.GetHeight();
             }
         }
 }
コード例 #48
0
 /// <summary>
 /// Sets the font.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetFont(ExtendedEntry view)
 {
     UIFont uiFont;
     if (view.Font != Font.Default && (uiFont = view.Font.ToUIFont()) != null)
         Control.Font = uiFont;
     else if (view.Font == Font.Default)
         Control.Font = UIFont.SystemFontOfSize(17f);
 }
コード例 #49
0
 /// <summary>
 /// Sets the MaxLength Characters.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SetMaxLength(ExtendedEntry view)
 {
     if (_thisPhoneTextBox != null) _thisPhoneTextBox.MaxLength = view.MaxLength;
 }
コード例 #50
0
        public evaluacionDia(MasterDetailPage masterDetail, int dia)
        {
            master = masterDetail;

            RelativeLayout layout = new RelativeLayout ();

            //Colocar background
            var imgBackground = new Image () {
                Source = ImageSource.FromResource ("PaZos.Resources.FondoAcciones.png"),
                Aspect = Aspect.AspectFill
            };

            layout.Children.Add (imgBackground,
                Constraint.Constant (0),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Height;
                }));
            //Fin Colocar background

            //Dias
            var imgDias = new Image ();

            switch (dia){

            case 1:
                imgDias.Source = ImageSource.FromResource ("PaZos.Resources.Dias.lunes.png");
                break;
            case 2:
                imgDias.Source = ImageSource.FromResource ("PaZos.Resources.Dias.martes.png");
                break;
            case 3:
                imgDias.Source = ImageSource.FromResource ("PaZos.Resources.Dias.miercoles.png");
                break;
            case 4:
                imgDias.Source = ImageSource.FromResource ("PaZos.Resources.Dias.Jueves.png");
                break;
            case 5:
                imgDias.Source = ImageSource.FromResource ("PaZos.Resources.Dias.Viernes.png");
                break;
            case 6:
                imgDias.Source = ImageSource.FromResource ("PaZos.Resources.Dias.Sabado.png");
                break;
            case 7:
                imgDias.Source = ImageSource.FromResource ("PaZos.Resources.Dias.Domingo.png");
                break;

            };

            int y = 15;

            layout.Children.Add (imgDias,
                Constraint.Constant (15),
                Constraint.Constant (y),
                Constraint.RelativeToParent ((Parent) => {
                    return 250;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 52;
                }));

            var lbdia = new Button () {
                Text = "",
                TextColor = Color.White,
                //BackgroundColor = Color.Blue
            };
            lbdia.Clicked += (sender, args) => {
                Selected();
            };

            layout.Children.Add (lbdia,
                Constraint.Constant (15),
                Constraint.Constant (y),
                Constraint.RelativeToParent ((Parent) => {
                    return 250;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 52;
                }));

            //End Dias

            ExtendedEntry txtaccion, txtvalor;
            Label lbvalor;

            int i, j = 3;
            y = 52 + y + 10;

            for (i = 1; i < j; i++) {
                txtaccion = new ExtendedEntry () {
                    Placeholder = "Acción " + i.ToString()
                };
                layout.Children.Add (txtaccion,
                    Constraint.Constant (20),
                    Constraint.Constant (y+90*(i-1)),
                    Constraint.RelativeToParent ((Parent) => {
                        return Parent.Width - 40;
                    }),
                    Constraint.RelativeToParent ((Parent) => {
                        return 40;
                    }));

                lbvalor = new Label (){
                    Text = "Valor",
                    FontSize=22,
                    FontFamily =  "MyriadPro-Regular"
                };
                layout.Children.Add (lbvalor,
                    Constraint.RelativeToParent ((Parent) => {
                        return Parent.Width - 20 - 150 - 60;
                    }),
                    Constraint.Constant (y+55+90*(i-1)),
                    Constraint.RelativeToParent ((Parent) => {
                        return 100;
                    }),
                    Constraint.RelativeToParent ((Parent) => {
                        return 40;
                    }));

                txtvalor = new ExtendedEntry () {

                };
                layout.Children.Add (txtvalor,
                    Constraint.RelativeToParent ((Parent) => {
                        return Parent.Width - 20 - 150;
                    }),
                    Constraint.Constant (y+45+90*(i-1)),
                    Constraint.RelativeToParent ((Parent) => {
                        return 150;
                    }),
                    Constraint.RelativeToParent ((Parent) => {
                        return 40;
                    }));

            }

            y = y + 90 * (i-1);

            lbvalor = new Label (){
                Text = "Valor total",
                FontSize=22,
                FontFamily =  "MyriadPro-Regular"
            };
            layout.Children.Add (lbvalor,
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width - 20 - 200 - 110;
                }),
                Constraint.Constant (y+5),
                Constraint.RelativeToParent ((Parent) => {
                    return 110;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 40;
                }));

            ExtendedEntry txttotal = new ExtendedEntry () {

            };
            layout.Children.Add (txttotal,
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width - 20 - 200;
                }),
                Constraint.Constant (y),
                Constraint.RelativeToParent ((Parent) => {
                    return 200;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 40;
                }));

            Content = layout;
        }