Ejemplo n.º 1
0
        public CreatePrescription(Data userData, Patient patient, List<Professional> recievers, string title, string docPath)
        {
            _userData = userData;
            _patient = patient;
			if (recievers != null)
				_recievers = recievers;
			else
				_recievers = new List<Professional>();
            _docpath = docPath;
            _cameraview = new CameraViewModel();
            MultibleButtonView button = new MultibleButtonView(_userData);

            button.DocumentsIsDisable();
            button.FollowButton.Clicked += FollowButtonClicked;
            button.ProfilButton.Clicked += ProfilButtonClicked;

            Label prescription = new Label
            {
                Text = "Creation de Prescription",
                FontSize = 50,
                VerticalOptions = LayoutOptions.Start,
                TextColor = Color.Gray
            };
            Label recivers = new Label
            {
                Text = "À : " + _recievers.Count.ToString() + " personnes",
                FontSize = 40,
                VerticalOptions = LayoutOptions.Start,
                TextColor = Color.Gray
            };
            Button add = new Button
            {
                Text = "+",
                FontSize = 40,
                BackgroundColor = Color.FromHex("439DFE"),
            };
            add.Clicked += Add_Clicked;
            StackLayout addRecieverStack = new StackLayout
            {

                Children = {
                    recivers,
                    add,
                },
                Orientation = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.Start

            };
            _title = new Entry
            {
                Placeholder = "Titre de la prescription",
                FontSize = 40,
                HorizontalTextAlignment = TextAlignment.Center,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.Center,
            };
            _title.TextChanged += EntryTextChanged;

            _takePhoto = new Button
            {
                Text = "Prendre une photo",
				BackgroundColor = Color.FromHex("439DFE"),
                FontSize = 25,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
            };
            _takePhoto.Clicked += Content_Clicked;
            _choosePhoto = new Button
            {
                Text = "Choisir une image éxistante",
				BackgroundColor = Color.FromHex("439DFE"),
                FontSize = 25,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
            };
            _choosePhoto.Clicked += _choosePhoto_Clicked;
            StackLayout takePhotoStack = new StackLayout
            {

                Children = {
                    _takePhoto,
                    _choosePhoto,
                },
                Orientation = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.Start

            };

            Button create = new Button
            {
                Text = "Envoyer",
                FontSize = 40,
                BackgroundColor = Color.FromHex("439DFE"),
                VerticalOptions = LayoutOptions.End
            };
            create.Clicked += Create_Clicked;

            Button back = new Button
            {
                Text = "Retour aux prescriptions",
                FontSize = 40,
                BackgroundColor = Color.FromHex("439DFE"),
                VerticalOptions = LayoutOptions.End
            };
            back.Clicked += Back_Clicked;
			Initiliaze(title, docPath);

            Content = new StackLayout
            {

                Children = {
                    button.Content,
                    prescription,
                    _title,
                    addRecieverStack,
                    takePhotoStack,
                    _photo,
                    create,
                    back
                },
            };
            this.BackgroundColor = Color.White;
        }
Ejemplo n.º 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;
		}