示例#1
0
		public ProfilPage(Data userData, User user)
        {
			_userData = userData;
            _user = user;

            MultibleButtonView button = new MultibleButtonView(_userData);

			button.ProfilIsDisable ();
            button.FollowButton.Clicked += FollowButtonClicked;
            button.DocumentButton.Clicked += Document_Clicked;   

			Label title = new Label {
				Text = "Profil",
				FontSize = 40,
				HorizontalOptions = LayoutOptions.Center
			};

			Label name = new Label {
				Text = _user.FirstName + "  " + _user.LastName,
				FontSize = 30,
				HorizontalOptions = LayoutOptions.Center	
			};

			Label phonenumber = new Label
			{
				Text = "Numero : " + _user.PhoneNumber ,
				FontSize = 30,
				HorizontalOptions = LayoutOptions.Center

            };

			Label adresse = new Label
			{
				Text = "Adresse : "+ _user.Adress,
                FontSize = 30,
                HorizontalOptions = LayoutOptions.Center
			};

			Label postCode = new Label
			{
				Text = _user.Postcode.ToString(),
				FontSize = 30,
				HorizontalOptions = LayoutOptions.Center
			};

			Label city = new Label
			{
				Text = _user.City,
				FontSize = 30,
				HorizontalOptions = LayoutOptions.Center
			};
            Stream s = new MemoryStream(DependencyService.Get<IBytesSaveAndLoad>().LoadByteArray(_user.Photo));
			Image logo = new Image
			{
				Source = ImageSource.FromStream(() => s),
                HorizontalOptions = LayoutOptions.FillAndExpand,
			};

            Button Suivis = new Button
            {
                Text = "Voir mes Suivis",
                FontSize = 40,
                BackgroundColor = Color.FromHex("439DFE"),
                VerticalOptions = LayoutOptions.EndAndExpand
            };

            Suivis.Clicked += FollowButtonClicked;

            if (!UserAccount())
                Suivis.Text = "Retour à mon suivi";
            else if(PageForPatient())
                Suivis.Text = "Voir mon Suivi";
            

            Button document = new Button
			{
				Text = "Voir mes documents",
				FontSize = 40,
				BackgroundColor = Color.FromHex("439DFE"),
				VerticalOptions = LayoutOptions.EndAndExpand
			};
            document.Clicked += Document_Clicked;

            if (!UserAccount())
                document.IsVisible = false;

            Button modify = new Button
            {
                Text = "Modifier mes infos",
                FontSize = 40,
                BackgroundColor = Color.FromHex("439DFE"),
				VerticalOptions = LayoutOptions.EndAndExpand
            };
            modify.Clicked += async (sender, e) =>
            {
                await Navigation.PushAsync(new ModifyProfil(_userData));
            };
            if (!UserAccount()) modify.IsVisible = false;
            Button deconnection = new Button
            {
                Text = "Se déconnecter",
                FontSize = 40,
                BackgroundColor = Color.FromHex("439DFE"),
                VerticalOptions = LayoutOptions.EndAndExpand
            };
            deconnection.Clicked += Deconnection_Clicked;

            Content = new StackLayout
            {

                Children = {
					button.Content,
					title,
					name,
					phonenumber,
					adresse,
					postCode,
					city,
					logo,
                    Suivis,
					document,
                    modify,
                    deconnection
                },
            };
            this.BackgroundColor = Color.White;
        }
示例#2
0
		public ModifyProfil (Data userData)
		{
			_userData = userData;
            _cameraview = new CameraViewModel();
            var tappedGesture = new TapGestureRecognizer();
            tappedGesture.Tapped += TappedGesture_Tapped;

            MultibleButtonView button = new MultibleButtonView(_userData);

            button.ProfilIsDisable();
            button.FollowButton.Clicked += FollowButtonClicked;
            button.DocumentButton.Clicked += DocumentButton_Clicked;

            Entry firstName = new Entry
			{
				Text = _userData.User.FirstName,
				FontSize = 40,
				HorizontalTextAlignment = TextAlignment.Center,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.CenterAndExpand,
				TextColor = Color.Gray
			};
			firstName.TextChanged += EntryTextChanged;
			Entry lastName = new Entry
			{
				Text = _userData.User.LastName,
				FontSize = 40,
				HorizontalTextAlignment = TextAlignment.Center,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.CenterAndExpand,
				TextColor = Color.Gray
			};
			Entry adress = new Entry
			{
				Text = _userData.User.Adress,
				FontSize = 40,
				HorizontalTextAlignment = TextAlignment.Center,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.CenterAndExpand,
				TextColor = Color.Gray
			};
			Entry postCode = new Entry
			{
				Text = _userData.User.Postcode.ToString(),
				FontSize = 40,
				Keyboard = Keyboard.Numeric,
				HorizontalTextAlignment = TextAlignment.Center,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.CenterAndExpand,
				TextColor = Color.Gray
			};

			Entry city = new Entry
			{
				Text = _userData.User.City,
				FontSize = 40,
				HorizontalTextAlignment = TextAlignment.Center,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.CenterAndExpand,
				TextColor = Color.Gray
			};
			Entry phoneNumber = new Entry
			{
				Text = _userData.User.PhoneNumber.ToString(),
				FontSize = 40,
				Keyboard = Keyboard.Telephone,
				HorizontalTextAlignment = TextAlignment.Center,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.CenterAndExpand,
				TextColor = Color.Gray
			};
            Stream s = new MemoryStream(DependencyService.Get<IBytesSaveAndLoad>().LoadByteArray(_userData.User.Photo));
            _profilPhoto = new Image {
                Source = ImageSource.FromStream(() => s),
            };
			_profilPhoto.GestureRecognizers.Add (tappedGesture);

			Button modify = new Button
			{
				Text = "Sauvegarder",
				FontSize = 40,
				BackgroundColor = Color.FromHex("439DFE"),
				VerticalOptions = LayoutOptions.EndAndExpand,
                
			};
            Button photo = new Button
            {
                Text = "Prendre une photo",
                FontSize = 40,
                BackgroundColor = Color.FromHex("439DFE"),
                VerticalOptions = LayoutOptions.EndAndExpand,
        	};
			photo.Clicked += Photo_Clicked;
            modify.Clicked += async (sender, e) => 
			{
				_userData.User.Adress = adress.Text;
				_userData.User.City = city.Text;
				_userData.User.FirstName = firstName.Text;
				_userData.User.LastName = lastName.Text;
				_userData.User.PhoneNumber = Int32.Parse(phoneNumber.Text);
				_userData.User.Postcode = Int32.Parse(postCode.Text);
				_userData.NeedUpdate = true;
                DataXML json = _xml.DataToDataJsonForSave(_userData);
                DependencyService.Get<ISaveLoadAndDelete>().SaveData("user.txt", json);
                UpdateAll();
				await Navigation.PushAsync(new ProfilPage(_userData, _userData.User));
			};
			Content = new StackLayout
			{

				Children = {
					button,
					firstName,
					lastName,
					adress,
					postCode,
					city,
					phoneNumber,
					_profilPhoto,
                    photo,
					modify
				},
			};
			this.BackgroundColor = Color.White;
		}