コード例 #1
0
        protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
        {
            base.OnElementChanged(e);
            nativeTextView = Control;
            if (nativeTextView == null)
            {
                return;
            }

			if (this.Element != null)
				formsEntry = this.Element as CustomEntry;

			if (formsEntry != null && !string.IsNullOrEmpty (formsEntry.BackGroundImageName)) {
				Android.Graphics.Drawables.Drawable drawable = Resources.GetDrawable (Resource.Drawable.comnt_box);
				nativeTextView.Background = drawable;
			} 
			else 
			{
				nativeTextView.SetBackgroundColor(Android.Graphics.Color.White);
				nativeTextView.SetHintTextColor(Android.Graphics.Color.Gray);
			}

            nativeTextView.SetTextColor(Android.Graphics.Color.Gray);
            if (nativeTextView != null)
            {
                if (nativeTextView.Text != null)
                {
                   // nativeTextView.SetTextColor(Android.Graphics.Color.Black);
                }
                
            }
            if (App.screenDensity > 1.5)
            {
                nativeTextView.SetTextSize(Android.Util.ComplexUnitType.Pt, 8);
            }
            else
            {
                nativeTextView.SetTextSize(Android.Util.ComplexUnitType.Pt, 9);
            }
        }
コード例 #2
0
        public LoginGooglePage()
        {
            CustomLayout masterLayout = new CustomLayout();
            masterLayout.BackgroundColor = Color.Gray;

            CustomEntry paswordEntry = new CustomEntry
            {
                Placeholder = "Password"
            };

            CustomEntry confirmPaswordEntry = new CustomEntry
            {
                Placeholder = "Confirm Password"
            };


            Button submitButton = new Button
            {
                Text = "Submit",
                TextColor = Color.Black,
                BorderColor = Color.Black,
                BorderWidth = 2
            };


            paswordEntry.WidthRequest = App.screenWidth * 80 / 100;
            confirmPaswordEntry.WidthRequest = App.screenWidth * 80 / 100;
            submitButton.WidthRequest = App.screenWidth * 40 / 100;


            masterLayout.AddChildToLayout(paswordEntry, 10, 30);
            masterLayout.AddChildToLayout(confirmPaswordEntry, 10, 45);
            masterLayout.AddChildToLayout(submitButton, 30, 60);

            submitButton.Clicked += OnSubmitButtonClicked;

            Content = masterLayout;
        }
コード例 #3
0
        public void Dispose()
        {
            this.forgotPasswordLabel = null;
            this.userNameEntry = null;
            this.passwordEntry = null;
            this.indicator = null;
            this.googleSignInButton = null;
            this.subTitleBar = null;
            this.faceBookSignInButton = null;
            this.signInButton = null;
            this.subTitleBar = null;
            this.masterLayout = null;

            GC.Collect();
        }
コード例 #4
0
        public LogInPage()
        {
			App.IsLoggedIn = false;
            NavigationPage.SetHasNavigationBar(this, false);
            masterLayout = new CustomLayout();
            masterLayout.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY;
            screenHeight = App.screenHeight;
            screenWidth = App.screenWidth;
            PurposeColorTitleBar mainTitleBar = new PurposeColorTitleBar(Color.FromRgb(8, 135, 224), "Purpose Color", Color.Black, "back", true);
            mainTitleBar.imageAreaTapGestureRecognizer.Tapped += imageAreaTapGestureRecognizer_Tapped;
            subTitleBar = new PurposeColorBlueSubTitleBar(Constants.SUB_TITLE_BG_COLOR, "               Sign In", true, true);
            subTitleBar.NextButtonTapRecognizer.Tapped += (s, e) =>
            {
                OnSignInButtonClicked(signInButton, null);
            };
            subTitleBar.BackButtonTapRecognizer.Tapped += (s, e) =>
            {
                App.masterPage.IsPresented = !App.masterPage.IsPresented;
            };

            userNameEntry = new CustomEntry
            {
                Placeholder = "Username",
                Keyboard = Keyboard.Email,
                HeightRequest = Device.OnPlatform(50, 50,75)
               // Text = "apptester" // for testing only // remove after testing
            };

            passwordEntry = new CustomEntry
            {
                Placeholder = "Password",
                IsPassword = true,
                HeightRequest = Device.OnPlatform(50, 50, 75)
            };

            signInButton = new Button
            {
                Text = "Sign in",
                TextColor = Color.White,
                BorderColor = Color.Transparent,
                BorderWidth = 0,
                BackgroundColor = Constants.BLUE_BG_COLOR
                //HeightRequest = 50
            };

            TapGestureRecognizer forgotPasswordTap = new TapGestureRecognizer();
            forgotPasswordLabel = new Label
            {
                Text = "Forgot password",
                TextColor = Constants.BLUE_BG_COLOR,
                BackgroundColor = Color.Transparent,
                FontSize = Device.OnPlatform(12,12,15),
                HeightRequest = Device.OnPlatform(15, 25, 25),
            };

            forgotPasswordLabel.GestureRecognizers.Add(forgotPasswordTap);
            forgotPasswordTap.Tapped += (s, e) =>
            {
                try
                {
                    Navigation.PushAsync(new ForgotPassword());
                }
                catch (Exception)
                {
                }
            };

            TapGestureRecognizer registerTap = new TapGestureRecognizer();
            registerLabel = new Label
            {
                Text = "Sign up with us",
                TextColor = Constants.BLUE_BG_COLOR,
                BackgroundColor = Color.Transparent,
                FontSize = Device.OnPlatform(12, 12, 15),
                HeightRequest = Device.OnPlatform(15, 25, 25),
            };
            registerLabel.GestureRecognizers.Add(registerTap);
            registerTap.Tapped += (s, e) =>
            {
                try
                {
                    Navigation.PushModalAsync(new RegistrationPageOne());
                }
                catch (Exception)
                {
                }
            };

            googleSignInButton = new Button
            {
                Text = "Sign in with Google",
                TextColor = Color.White,
                BorderColor = Color.Transparent,
                BorderWidth = 0,
                BackgroundColor = Constants.BLUE_BG_COLOR
            };

            faceBookSignInButton = new Button
            {
                Text = "Sign in with Facebook",
                TextColor = Color.White,
                BorderColor = Color.Transparent,
                BorderWidth = 0,
                BackgroundColor = Constants.BLUE_BG_COLOR
            };

            indicator = new ActivityIndicator();
            indicator.IsRunning = true;
            indicator.IsEnabled = true;
            indicator.IsVisible = false;

            userNameEntry.WidthRequest = screenWidth * 80 / 100;
            passwordEntry.WidthRequest = screenWidth * 80 / 100;
            signInButton.WidthRequest = screenWidth * 80 / 100;
            googleSignInButton.WidthRequest = screenWidth * 80 / 100;
            faceBookSignInButton.WidthRequest = screenWidth * 80 / 100;

            //imgsignInButton.WidthRequest = deviceSpec.ScreenWidth * 10 / 100;
            //imgsignInButton.HeightRequest = deviceSpec.ScreenHeight * 5 / 100;

            masterLayout.AddChildToLayout(mainTitleBar, 0, 0);
            masterLayout.AddChildToLayout(subTitleBar, 0, Device.OnPlatform(9, 10, 10));
            masterLayout.AddChildToLayout(userNameEntry, 10, Device.OnPlatform(30, 30, 30));
            masterLayout.AddChildToLayout(passwordEntry, 10, Device.OnPlatform(40, 40, 38));
            masterLayout.AddChildToLayout(signInButton, 10, Device.OnPlatform(50, 50, 47));
            masterLayout.AddChildToLayout(forgotPasswordLabel, Device.OnPlatform(11, 11, 13), Device.OnPlatform(60,59,47));
            masterLayout.AddChildToLayout(registerLabel, Device.OnPlatform(62, 66, 65), Device.OnPlatform(60,59,47));
            
           // masterLayout.AddChildToLayout(googleSignInButton, 10, Device.OnPlatform(65,65,62));
           // masterLayout.AddChildToLayout(faceBookSignInButton, 10, Device.OnPlatform(75, 75, 70));

            googleSignInButton.Clicked += OnGoogleSignInButtonClicked;
            faceBookSignInButton.Clicked += faceBookSignInButton_Clicked;
            signInButton.Clicked += OnSignInButtonClicked;

            Content = masterLayout;
        }
コード例 #5
0
		async void  ProfileSettingsPage_Appearing (object sender, EventArgs e)
		{
			progressBar.ShowProgressbar ("Retriving user details..");

			if(userIdForProfileInfo > 0)
			{
				await GetProfileInfo ();
			}

			galleryInput = new Image()
			{
				Source = Device.OnPlatform("icn_gallery.png", "icn_gallery.png", "//Assets//icn_gallery.png"),
				Aspect = Aspect.AspectFit
			};

			if (Device.OS == TargetPlatform.WinPhone)
			{
				galleryInput.WidthRequest = App.screenWidth * ICON_SIZE / 100;
				galleryInput.HeightRequest = App.screenWidth * ICON_SIZE / 100;
			}
			galleryInputStack = new StackLayout
			{
				Padding = new Thickness(5, 10, 5, 10),
				Spacing = 0,
				Children = { galleryInput
				}
			};
			galleryInputStack.ClassId = "gallery";

			galleryInputStackTapRecognizer = new TapGestureRecognizer();
			galleryInputStack.GestureRecognizers.Add(galleryInputStackTapRecognizer);
			galleryInputStackTapRecognizer.Tapped += async (se, ee) =>
			{
				try {
					StackLayout send = se as StackLayout;
					SourceChooser chooser = new SourceChooser(masterLayout, send.ClassId, this);
					chooser.ClassId = "mediachooser";
					masterLayout.AddChildToLayout(chooser, 0, 0);

				} catch (Exception ex) {
					var test = ex.Message;
				}

			};

			mainTitleBar.imageAreaTapGestureRecognizer.Tapped += imageAreaTapGestureRecognizer_Tapped;
			masterLayout.AddChildToLayout(mainTitleBar, 0, 0);
			masterLayout.AddChildToLayout(subTitleBar, 0, 10);

			statusEntry = new CustomEntry
			{
				Placeholder = "Status note",
				HeightRequest = Device.OnPlatform(50, 50, 75),
				BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY,
				TextColor = Color.Black,
				WidthRequest = App.screenWidth * 80 / 100,
			};

			statusLabel = new Label {
				TextColor = Color.Black,
				HeightRequest = Device.OnPlatform (50, 50, 75),
				//WidthRequest = App.screenWidth * 80 / 100,
				HorizontalOptions = LayoutOptions.Center,
				FontSize = App.screenDensity >= 2 ? 18 : 15,
				XAlign = TextAlignment.Center
			};

			if(!string.IsNullOrEmpty(userInfo.StatusNote))
			{
				statusLabel.Text = userInfo.StatusNote.Trim ();
			}
			
			profilePic = new Image {
				Source = Constants.SERVICE_BASE_URL + (!string.IsNullOrEmpty(userInfo.ProfileImageUrl)? userInfo.ProfileImageUrl : "admin/uploads/default/noprofile.png"),
				HeightRequest = 110,
				WidthRequest = 100,
				Aspect = Aspect.AspectFill,
				HorizontalOptions = LayoutOptions.End
			};

			if (userIdForProfileInfo <= 0 || userIdForProfileInfo.ToString () == currentUser.UserId)  // display info of current logged in user.
			{
				#region Profile image tap
				TapGestureRecognizer profileImageTapRecognizer = new TapGestureRecognizer ();
				profileImageTapRecognizer.Tapped += ProfileImage_Tapped;
				profilePic.GestureRecognizers.Add (profileImageTapRecognizer);
				#endregion

				#region Ststus entry
				if (userInfo.StatusNote != null) {
					statusEntry.Text = userInfo.StatusNote.Trim ();
				} else {
					statusEntry.Text = "Please provide your status message..";
				}
				statusEntry.Completed += StatusEntry_Completed;
				#endregion

				#region Community Sharing
				CommunitySharingLabel = new Label {
					Text = "Share to community",
					FontSize = App.screenDensity >= 2 ? 15 : 12,
					TextColor = Color.Gray,
				};

				communityShareIcon = new Image ();

				communityStatusBtn = new StackLayout ();
				communityStatusBtn.WidthRequest = 50;
				communityStatusBtn.HeightRequest = 50;
				communityStatusBtn.BackgroundColor = Color.Transparent;
				communityStatusBtn.VerticalOptions = LayoutOptions.Center;

				//communityShareIcon.IsEnabled = false;
				if (currentUser.AllowCommunitySharing) {
					communityShareIcon.Source = Device.OnPlatform ("tic_active.png", "tic_active.png", "//Assets//tic_active.png");
				} else {
					communityShareIcon.Source = Device.OnPlatform ("tick_box.png", "tick_box.png", "//Assets//tick_box.png");
				}
				communityShareIcon.Aspect = Aspect.AspectFill;
				communityShareIcon.WidthRequest = 20;
				communityShareIcon.HeightRequest = 20;
				communityShareIcon.ClassId = "Cshare";
				communityShareIcon.HorizontalOptions = LayoutOptions.Center;
				communityShareIcon.VerticalOptions = LayoutOptions.End;
				//communityShareIcon.TranslationY = 15;
				communityStatusBtn.Children.Add (communityShareIcon);

				communityShareTap = new TapGestureRecognizer ();
				communityShareTap.Tapped += UpdateShareToCommunityStatus;
				communityStatusBtn.GestureRecognizers.Add (communityShareTap);

				masterLayout.AddChildToLayout (CommunitySharingLabel, 10, 65);
				masterLayout.AddChildToLayout (communityStatusBtn, Device.OnPlatform(55,50,50), 65);
				#endregion

				#region Allow Follow

				Label followLabel = new Label {
					Text = "Allow others to follow",
					FontSize = App.screenDensity >= 2 ? 15 : 12,
					TextColor = Color.Gray,
				};

				allowFollowIcon = new Image ();
				if (currentUser.AllowFollowers) {
					allowFollowIcon.Source = Device.OnPlatform ("tic_active.png", "tic_active.png", "//Assets//tic_active.png");
				} else {
					allowFollowIcon.Source = Device.OnPlatform ("tick_box.png", "tick_box.png", "//Assets//tick_box.png");
				}
				allowFollowIcon.Aspect = Aspect.AspectFill;
				allowFollowIcon.WidthRequest = 20;
				allowFollowIcon.HeightRequest = 20;
				allowFollowIcon.HorizontalOptions = LayoutOptions.Center;
				allowFollowIcon.VerticalOptions = LayoutOptions.End;

				followStatusBtn = new StackLayout ();
				followStatusBtn.WidthRequest = 50;
				followStatusBtn.HeightRequest = 50;
				followStatusBtn.BackgroundColor = Color.Transparent;
				followStatusBtn.VerticalOptions = LayoutOptions.Center;
				followStatusBtn.Children.Add (allowFollowIcon);
				followIconTap = new TapGestureRecognizer ();
				followIconTap.Tapped += UpdateFollowStatus;
				followStatusBtn.GestureRecognizers.Add (followIconTap);

				masterLayout.AddChildToLayout (followLabel, 10, 70);
				masterLayout.AddChildToLayout (followStatusBtn, Device.OnPlatform(55,50,50), 70);
				#endregion

				statusEntry.IsVisible = true;
				statusLabel.IsVisible = false;
			}
			else 
			{
				statusEntry.IsVisible = false;
				//statusEntry.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY;
				statusLabel.IsVisible = true;

				statusEntry.IsEnabled = false;
				if (userInfo.StatusNote != null) {
					statusEntry.Text = userInfo.StatusNote.Trim ();
				} else {
					statusEntry.IsVisible = false;
				}


			}

			profilePic.ClassId = "camera";
			masterLayout.AddChildToLayout(profilePic, 35, 20);

			Label userDisplayName = new Label {
				Text = !string.IsNullOrEmpty (userInfo.DisplayName) ? userInfo.DisplayName : (!string.IsNullOrEmpty (userInfo.UserName) ? userInfo.UserName : ""),
				//WidthRequest = App.screenWidth * 0.80,
				HorizontalOptions = LayoutOptions.Center,
				XAlign = TextAlignment.Center,
				VerticalOptions = LayoutOptions.Center,
				FontSize = App.screenDensity >= 2 ? 20 : 15,
				TextColor = Color.Black,
				FontAttributes = FontAttributes.Bold
			};

			Label emailLabel = new Label {
				Text = !string.IsNullOrEmpty (userInfo.Email) ? userInfo.Email : "",
				//WidthRequest = App.screenWidth * 0.50,
				HorizontalOptions = LayoutOptions.Center,
				XAlign = TextAlignment.Center,
				VerticalOptions = LayoutOptions.Center,
				FontSize = App.screenDensity >= 2 ? 12 : 10,
				TextColor = Color.Gray,
				FontAttributes = FontAttributes.None

			};

			Image verifiedBadge = new Image {
				Source = "verified_icon.png",
				HeightRequest = App.screenHeight * .05,
				WidthRequest = App.screenWidth * .05,
				HorizontalOptions = LayoutOptions.Start,
				BackgroundColor = Color.Transparent,
				IsVisible = userInfo.VerifiedStatus != 0
			};

			StackLayout nameEmailStack = new StackLayout {
				Orientation = StackOrientation.Vertical,
				HorizontalOptions = LayoutOptions.Center,
				WidthRequest = App.screenWidth * 0.80,
				Spacing = 3,
				Children = {new StackLayout{ Spacing = 2,Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Center, 
						Children = {userDisplayName, verifiedBadge}}, 
						emailLabel,
					new StackLayout{Children = {statusLabel}, Padding = 10, HorizontalOptions = LayoutOptions.Center, Orientation = StackOrientation.Vertical}
				}
			};


			int xpos = 62;
			if (App.screenDensity > 2) {
				xpos = 64;
				masterLayout.AddChildToLayout (nameEmailStack, 10, 40);
				masterLayout.AddChildToLayout (statusEntry, 10, 50);
				//masterLayout.AddChildToLayout (statusLabel, 10, 50);
			} else {
				masterLayout.AddChildToLayout(nameEmailStack,10, 42);
				masterLayout.AddChildToLayout(statusEntry, 10, 52);
				//masterLayout.AddChildToLayout (statusLabel, 10, 52);
			}

			Content = masterLayout;
			progressBar.HideProgressbar ();
		}
コード例 #6
0
		public void Dispose()
		{
			this.statusEntry = null;
			userInfo = null;
			masterLayout = null;
			galleryInputStackTapRecognizer = null;
			galleryInputStack = null;
			galleryInput = null;
			profilePic = null;
			progressBar = null;
			userProfile = null;
			mainTitleBar = null;
			subTitleBar = null;
			CommunitySharingLabel= null;
			communityShareIcon = null;
			communityStatusBtn = null;
			User currentUser = null;

			GC.Collect();
		}
コード例 #7
0
        public ChangePassword()
        {
            NavigationPage.SetHasNavigationBar(this, false);
            CustomLayout masterLayout = new CustomLayout();
            masterLayout.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY;
            PurposeColorBlueSubTitleBar subTitleBar = null;
            subTitleBar = new PurposeColorBlueSubTitleBar(Constants.SUB_TITLE_BG_COLOR, "       Change Password", true, true);
            subTitleBar.BackButtonTapRecognizer.Tapped += (s, e) =>
            {
                try
                {
                    Navigation.PopAsync();
                }
                catch (Exception ex)
                {
                }
            };
            IDeviceSpec deviceSpec = DependencyService.Get<IDeviceSpec>();

            PurposeColorTitleBar mainTitleBar = new PurposeColorTitleBar(Color.FromRgb(8, 135, 224), "Purpose Color", Color.Black, "back", true);
            mainTitleBar.imageAreaTapGestureRecognizer.Tapped += imageAreaTapGestureRecognizer_Tapped;

            oldPaswordEntry = new CustomEntry
            {
                Placeholder = "Old password",
                HeightRequest = Device.OnPlatform(50, 50, 75),
                IsPassword = true
            };

            newPaswordEntry = new CustomEntry
            {
                Placeholder = "New password",
                HeightRequest = Device.OnPlatform(50, 50, 75),
                IsPassword = true
            };

            confirmPaswordEntry = new CustomEntry
            {
                Placeholder = "Confirm new password",
                HeightRequest = Device.OnPlatform(50, 50, 75),
                IsPassword = true
            };

            submitButton = new Button
            {
                Text = "Submit",
                TextColor = Color.White,
                BorderColor = Color.Transparent,
                BorderWidth = 0,
                BackgroundColor = Constants.BLUE_BG_COLOR,
                HeightRequest = Device.OnPlatform(50, 50, 75),
            };

            oldPaswordEntry.WidthRequest = deviceSpec.ScreenWidth * 80 / 100;
            newPaswordEntry.WidthRequest = deviceSpec.ScreenWidth * 80 / 100;
            confirmPaswordEntry.WidthRequest = deviceSpec.ScreenWidth * 80 / 100;
            submitButton.WidthRequest = deviceSpec.ScreenWidth * 80 / 100;

            masterLayout.AddChildToLayout(mainTitleBar, 0, 0);
            masterLayout.AddChildToLayout(subTitleBar, 0, 10);
            masterLayout.AddChildToLayout(oldPaswordEntry, 10, 25);
            masterLayout.AddChildToLayout(newPaswordEntry, 10, 35);
            masterLayout.AddChildToLayout(confirmPaswordEntry, 10, 45);
            masterLayout.AddChildToLayout(submitButton, 10, 55);

            submitButton.Clicked += OnSubmitButtonClicked;

            subTitleBar.NextButtonTapRecognizer.Tapped += (s, e) =>
            {
                OnSubmitButtonClicked(submitButton, null);
            };

            Content = masterLayout;
        }
コード例 #8
0
        public void Dispose()
        {
            this.newPaswordEntry = null;
            this.oldPaswordEntry = null;
            this.confirmPaswordEntry = null;
            this.submitButton.Clicked -= OnSubmitButtonClicked;
            this.submitButton = null;

            GC.Collect();
        }
        public AddEventsSituationsOrThoughts(string title, DetailsPageModel detailsPageModel = null)
        {
            NavigationPage.SetHasNavigationBar(this, false);
            masterLayout = new CustomLayout();
            audioRecorder = DependencyService.Get<PurposeColor.interfaces.IAudioRecorder>();
            //deviceSpec = DependencyService.Get<IDeviceSpec>();
            screenHeight = App.screenHeight;
            screenWidth = App.screenWidth;

            masterLayout.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY;
            pageTitle = title;
            lattitude = string.Empty;
            longitude = string.Empty;
            currentAddress = string.Empty;
            int devWidth = (int)screenWidth;
            App.MediaArray = new List<MediaItem>();
            App.ContactsArray = new List<string>();
            App.PreviewListSource.Clear();
            int textInputWidth = (int)(devWidth * .80);
			contactSelectAction = OnContactSelected;

            #region TITLE BARS
            TopTitleBar = new StackLayout
            {
                BackgroundColor = Constants.BLUE_BG_COLOR,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions = LayoutOptions.StartAndExpand,
                Padding = 0,
                Spacing = 0,
                Children = { new BoxView { WidthRequest = screenWidth } }
            };
            masterLayout.AddChildToLayout(TopTitleBar, 0, 0);
            
            string trimmedPageTitle = string.Empty;

            int titleMaxLength = 24;
            if (App.screenDensity > 1.5)
            {
                titleMaxLength = 24;
            }
            else
            {
                titleMaxLength = 22;
            }

            if (title.Length > titleMaxLength)
            {
                trimmedPageTitle = title.Substring(0, titleMaxLength);
                trimmedPageTitle += "..";
            }
            else
            {
                trimmedPageTitle = pageTitle;
            }

            subTitleBar = new PurposeColorBlueSubTitleBar(Constants.SUB_TITLE_BG_COLOR, trimmedPageTitle, true, true);
            masterLayout.AddChildToLayout(subTitleBar, 0, 1);
            subTitleBar.BackButtonTapRecognizer.Tapped += OnBackButtonTapRecognizerTapped;
            subTitleBar.NextButtonTapRecognizer.Tapped += NextButtonTapRecognizer_Tapped;
            #endregion

            #region EVENT TITLE - CUSTOM ENTRY

            eventTitle = new CustomEntry
            {
                VerticalOptions = LayoutOptions.StartAndExpand,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                BackgroundColor = Color.White,
                Placeholder = "Title",
                TextColor = Color.FromHex("#424646"),
                HeightRequest = Device.OnPlatform(50,50,73),
                WidthRequest = (int)(devWidth * .90) // 90% of screen,
            };
			eventTitle.TextChanged += EventTitle_TextChanged;

            
            //if (App.screenDensity > 1.5)
            //{
            //    eventTitle.HeightRequest = screenHeight * 6 / 100;
            //}
            //else
            //{
            //    eventTitle.HeightRequest = screenHeight * 9 / 100;
            //}
            masterLayout.AddChildToLayout(eventTitle, 5, 11);

            #endregion

            #region EVENT DESCRIPTION

            eventDescription = new CustomEditor
            {
                VerticalOptions = LayoutOptions.StartAndExpand,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                HeightRequest = 100,
                Placeholder = pageTitle,
                BackgroundColor = Color.White
            };
			eventDescription.TextChanged += EventDescription_TextChanged;
				

            eventDescription.WidthRequest = textInputWidth;

            if (detailsPageModel != null)
            {
				if (detailsPageModel.IsCopyingGem) {
					isUpdatePage = false;
				}
				else
				{
					isUpdatePage = true;
				}

                currentGemId = detailsPageModel.gemId;
                if (detailsPageModel.gemType != null)
                {
                    currentGemType = detailsPageModel.gemType;
                    switch (currentGemType)
                    {
                        case GemType.Goal:
                            pageTitle = Constants.EDIT_GOALS;
                            break;
                        case GemType.Event:
                            pageTitle = Constants.EDIT_EVENTS;
                            break;
                        case GemType.Action:
                            pageTitle = Constants.EDIT_ACTIONS;
                            break;
                        default:
                            break;
                    }
                }
                
                if (detailsPageModel.titleVal != null)
                {
                    eventTitle.Text = detailsPageModel.titleVal;
                }
                if ( detailsPageModel.description != null)
	            {
		             eventDescription.Text = detailsPageModel.description;
	            }
            }

            #endregion

            #region MEDIA INPUTS

            Image pinButton = new Image
            {
                BackgroundColor = Color.Transparent,
                VerticalOptions = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                Source = Device.OnPlatform("icn_attach.png", "icn_attach.png", "//Assets//icn_attach.png"),

            };
            StackLayout pinButtonHolder = new StackLayout
            {
                Padding = 10,
                VerticalOptions = LayoutOptions.Start,
                Children = { pinButton }
            };
            TapGestureRecognizer pinButtonTapRecognizer = new TapGestureRecognizer();
            pinButtonHolder.GestureRecognizers.Add(pinButtonTapRecognizer);
            pinButtonTapRecognizer.Tapped += (s, e) =>
            {
                iconContainerGrid.IsVisible = !iconContainerGrid.IsVisible;
            };

            Image audioRecodeOnButton = new Image
            {
                BackgroundColor = Color.Transparent,
                VerticalOptions = LayoutOptions.Center,
                Source = Device.OnPlatform("mic.png", "mic.png", "//Assets//mic.png"),
            };
            audioRecodeOnHolder = new StackLayout
            {
                Padding = 10,
                VerticalOptions = LayoutOptions.End,
                Children = { audioRecodeOnButton }
            };
            TapGestureRecognizer RecodeOnTapRecognizer = new TapGestureRecognizer();
            audioRecodeOnHolder.GestureRecognizers.Add(RecodeOnTapRecognizer);

            audioRecodeOffButton = new Image
            {
                BackgroundColor = Color.Transparent,
                VerticalOptions = LayoutOptions.Center,
                Source = Device.OnPlatform("turn_off_mic.png", "turn_off_mic.png", "//Assets//turn_off_mic.png"),
            };
            audioRecodeOffHolder = new StackLayout
            {
                BackgroundColor = Color.Transparent,
                Padding = 10,
                VerticalOptions = LayoutOptions.End,
                IsVisible = false,
                Children = { audioRecodeOffButton }
            };
            TapGestureRecognizer RecodeOffTapRecognizer = new TapGestureRecognizer();
            audioRecodeOffHolder.GestureRecognizers.Add(RecodeOffTapRecognizer);

            audioRecodeOffHolder.TranslateTo(0, Device.OnPlatform(audioRecodeOffButton.Y + 60, audioRecodeOffButton.Y + 60, audioRecodeOffButton.Y + 50), 5, null);
            audioRecodeOnHolder.TranslateTo(0, Device.OnPlatform(audioRecodeOffButton.Y + 60, audioRecodeOffButton.Y + 60, audioRecodeOffButton.Y + 50), 5, null);

            RecodeOnTapRecognizer.Tapped += RecodeOnTapRecognizer_Tapped;
            RecodeOffTapRecognizer.Tapped += RecodeOffTapRecognizer_Tapped;

            StackLayout menuPinContainer = new StackLayout
            {
                BackgroundColor = Color.White,
                Orientation = StackOrientation.Vertical,
                HeightRequest = 140,
                WidthRequest = (int)(devWidth * .10),
                Children = {
                    pinButtonHolder, 
                    audioRecodeOnHolder, 
                    audioRecodeOffHolder
                }
            };


            TapGestureRecognizer locationlabelTap = new TapGestureRecognizer();

            locationInfo = new Label();
            locationInfo.TextColor = Constants.BLUE_BG_COLOR;
            locationInfo.BackgroundColor = Color.Transparent;
            locationInfo.FontSize = 12;
            locationInfo.HeightRequest = Device.OnPlatform(15, 25, 25);
            locationInfo.GestureRecognizers.Add(locationlabelTap);
            locationlabelTap.Tapped += OnEditLocationInfo;

            editLocationAndContactsStack = new StackLayout();
            editLocationAndContactsStack.Padding = new Thickness(1, 1, 1, 1);
            editLocationAndContactsStack.BackgroundColor = Color.FromRgb(30, 126, 210);
            editLocationAndContactsStack.WidthRequest = App.screenWidth * 90 / 100;
            editLocationAndContactsStack.IsVisible = false;
            editLocationAndContactsStack.Orientation = StackOrientation.Horizontal;


            locAndContactsEntry = new Entry();
            locAndContactsEntry.TextColor = Color.Black;
            locAndContactsEntry.BackgroundColor = Color.White;
            locAndContactsEntry.VerticalOptions = LayoutOptions.Center;
            locAndContactsEntry.WidthRequest = App.screenWidth * 80 / 100;
            locAndContactsEntry.HeightRequest = 50;

            editLocationDoneButton = new CustomImageButton();
            editLocationDoneButton.VerticalOptions = LayoutOptions.Center;
            editLocationDoneButton.ImageName = "icn_done.png";
            editLocationDoneButton.HeightRequest = 25;
            editLocationDoneButton.WidthRequest = 25;
            editLocationDoneButton.Clicked += OnLocationEditCompleted;


            editLocationAndContactsStack.Children.Add(locAndContactsEntry);
            editLocationAndContactsStack.Children.Add(editLocationDoneButton);

            if (Device.OS == TargetPlatform.iOS)
            {
                editLocationAndContactsStack.TranslationY = -30;
            }

            locLayout = new StackLayout();
            locLayout.Orientation = StackOrientation.Vertical;
            locLayout.BackgroundColor = Color.Transparent;



            locLayout.Children.Add(locationInfo);

            TapGestureRecognizer contactsLabelTap = new TapGestureRecognizer();
            contactInfo = new Label();
            contactInfo.TextColor = Constants.BLUE_BG_COLOR;
            contactInfo.BackgroundColor = Color.Transparent;
            contactInfo.FontSize = 12;
            contactInfo.HeightRequest = Device.OnPlatform(15, 25, 25);
            contactInfo.GestureRecognizers.Add(contactsLabelTap);
            contactsLabelTap.Tapped += async (object sender, EventArgs e) =>
            {
                editLocationAndContactsStack.ClassId = "contactedit";
                string spanContacts = "";
                if (contactInfo.FormattedText != null && contactInfo.FormattedText.Spans.Count > 1)
                    spanContacts = contactInfo.FormattedText.Spans[1].Text;
                locAndContactsEntry.Text = spanContacts;
                editLocationAndContactsStack.IsVisible = true;
                contactInfo.IsVisible = false;
                iconContainerGrid.IsVisible = false;
                locationInfo.IsVisible = true;

                await editLocationAndContactsStack.TranslateTo(100, 0, 300, Easing.SinInOut);
                await editLocationAndContactsStack.TranslateTo(0, 0, 300, Easing.SinIn);

            };

            locLayout.IsVisible = false;
            contactInfo.IsVisible = false;
            
            #endregion

            if(detailsPageModel != null)
            {
                if (detailsPageModel.eventMediaArray!= null && detailsPageModel.eventMediaArray.Count > 0)
                {
                    foreach (EventMedia eventObj in detailsPageModel.eventMediaArray)
                    {
						if (eventObj.event_media != null && !eventObj.event_media.Contains("default")) {
							AddFilenameToMediaList(eventObj.event_media);
						}
                    }
                }

                if (detailsPageModel.goal_media != null && detailsPageModel.goal_media.Count > 0)
                {
                    foreach (SelectedGoalMedia goalObj in detailsPageModel.goal_media)
                    {
						if (goalObj.goal_media != null && !goalObj.goal_media.Contains("default")) {
							AddFilenameToMediaList(goalObj.goal_media);
						}
                    }
                }

                if (detailsPageModel.actionMediaArray != null && detailsPageModel.actionMediaArray.Count > 0)
                {
                    foreach (ActionMedia actionObj in detailsPageModel.actionMediaArray)
                    {
						if (actionObj.action_media != null && !actionObj.action_media.Contains("default")) {
							AddFilenameToMediaList(actionObj.action_media);
						}
                    }
                }

            }



            StackLayout entryAndLocContainer = new StackLayout();
            entryAndLocContainer.Orientation = StackOrientation.Vertical;
            entryAndLocContainer.BackgroundColor = Color.White;
            entryAndLocContainer.Children.Add( eventDescription );
			entryAndLocContainer.Children.Add(contactInfo);
            entryAndLocContainer.Children.Add(locLayout);

            textInputContainer = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Spacing = 0,
                Padding = 0,
                Children = { entryAndLocContainer, menuPinContainer }
            };

            #region ICONS

            audioInput = new Image()
            {
                Source = Device.OnPlatform("ic_music.png", "ic_music.png", "//Assets//ic_music.png"),
                Aspect = Aspect.AspectFit
            };

            int ICON_SIZE = 8;

            if( Device.OS == TargetPlatform.WinPhone )
            {
                audioInput.WidthRequest = screenWidth * ICON_SIZE / 100;
                audioInput.HeightRequest = screenWidth * ICON_SIZE / 100;
            }
            audioInputStack = new StackLayout
            {
                Padding = new Thickness(5, 10, 5, 10),
                //BackgroundColor = Constants.STACK_BG_COLOR_GRAY,
                //HorizontalOptions = LayoutOptions.Center,
                Spacing = 0,
                Children = { audioInput 
                                /*, new Label { Text = "Audio", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) }*/ 
                           }
            };

            cameraInput = new Image()
            {
                Source = Device.OnPlatform("icn_camera.png", "icn_camera.png", "//Assets//icn_camera.png"),
                Aspect = Aspect.AspectFit
            };



            if (Device.OS == TargetPlatform.WinPhone)
            {
                cameraInput.WidthRequest = screenWidth * ICON_SIZE / 100;
                cameraInput.HeightRequest = screenWidth * ICON_SIZE / 100;
            }


            cameraInputStack = new StackLayout
            {
                Padding = new Thickness(5, 10, 5, 10),
                //BackgroundColor = Constants.STACK_BG_COLOR_GRAY,
                //HorizontalOptions = LayoutOptions.Center,
                Spacing = 0,
                Children = { cameraInput
                                /*, new Label { Text = "Camera", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) } 
                                 */
                            }
            };
            cameraInputStack.ClassId = "camera";

            #region CAMERA TAP RECOGNIZER
            CameraTapRecognizer = new TapGestureRecognizer();
            cameraInputStack.GestureRecognizers.Add(CameraTapRecognizer);
            CameraTapRecognizer.Tapped += async (s, e) =>
            {
                try
                {
					await ApplyAnimation( cameraInputStack );
                    StackLayout send = s as StackLayout;
                    MediaSourceChooser chooser = new MediaSourceChooser(this, masterLayout, send.ClassId);
                    chooser.ClassId = "mediachooser";
                    masterLayout.AddChildToLayout(chooser, 0, 0);
                   
                }
                catch (System.Exception ex)
                {
                    DisplayAlert("Camera", ex.Message + " Please try again later", "ok");
                }

                /*
                try
                {
                    StackLayout send = s as StackLayout;
                    MediaSourceChooser chooser = new MediaSourceChooser(this, masterLayout, send.ClassId);
                    chooser.ClassId = "mediachooser";
                    masterLayout.AddChildToLayout(chooser, 0, 0);
                }
                catch (System.Exception ex)
                {
                    DisplayAlert("Camera", ex.Message + " Please try again later", "ok");
                }
                */
            };

            #endregion

            galleryInput = new Image()
            {
                Source = Device.OnPlatform("icn_gallery.png", "icn_gallery.png", "//Assets//icn_gallery.png"),
                Aspect = Aspect.AspectFit
            };

            if (Device.OS == TargetPlatform.WinPhone)
            {
                galleryInput.WidthRequest = screenWidth * ICON_SIZE / 100;
                galleryInput.HeightRequest = screenWidth * ICON_SIZE / 100;
            }

            galleryInputStack = new StackLayout
            {
                Padding = new Thickness(5, 10, 5, 10),
                Spacing = 0,
                Children = { galleryInput 
                                //new Label { Text = "Gallery", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) } 
                            }
            };
            galleryInputStack.ClassId = "gallery";

            #region GALLERY  TAP RECOGNIZER

            TapGestureRecognizer galleryInputStackTapRecognizer = new TapGestureRecognizer();
            galleryInputStack.GestureRecognizers.Add(galleryInputStackTapRecognizer);
            galleryInputStackTapRecognizer.Tapped += async (s, e) =>
            {
				await ApplyAnimation( galleryInputStack );
                StackLayout send = s as StackLayout;
                MediaSourceChooser chooser = new MediaSourceChooser(this, masterLayout, send.ClassId);
                chooser.ClassId = "mediachooser";
                masterLayout.AddChildToLayout(chooser, 0, 0);

            };

            #endregion

            locationInput = new Image()
            {
                Source = Device.OnPlatform("icn_location.png", "icn_location.png", "//Assets//icn_location.png"),
                Aspect = Aspect.AspectFit
            };

            if (Device.OS == TargetPlatform.WinPhone)
            {
                locationInput.WidthRequest = screenWidth * ICON_SIZE / 100;
                locationInput.HeightRequest = screenWidth * ICON_SIZE / 100;
            }


            locationInputStack = new StackLayout
            {
                Padding = new Thickness(5, 10, 5, 10),
                //BackgroundColor = Constants.STACK_BG_COLOR_GRAY,
                //HorizontalOptions = LayoutOptions.Center,
                Spacing = 0,
                Children = { locationInput
                                //, new Label { Text = "Location", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) } 
                            }
            };

            #region LOCATION TAP RECOGNIZER

            TapGestureRecognizer locationInputTapRecognizer = new TapGestureRecognizer();
            locationInputStack.GestureRecognizers.Add(locationInputTapRecognizer);
            locationInputTapRecognizer.Tapped += LocationInputTapRecognizer_Tapped;

            #endregion

            contactInput = new Image()
            {
                Source = Device.OnPlatform("icn_contact.png", "icn_contact.png", "//Assets//icn_contact.png"),
                Aspect = Aspect.AspectFit
            };

            if (Device.OS == TargetPlatform.WinPhone)
            {
                contactInput.WidthRequest = screenWidth * ICON_SIZE / 100;
                contactInput.HeightRequest = screenWidth * ICON_SIZE / 100;
            }

            contactInputStack = new StackLayout
            {
                Padding = new Thickness(5, 10, 0, 10),
                Spacing = 0,
                Children = { contactInput
                    //new Label { Text = "Contact", TextColor = Constants.TEXT_COLOR_GRAY, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) }
                     }
            };

            #region CONTACTS TAP RECOGNIZER

            TapGestureRecognizer contactsInputTapRecognizer = new TapGestureRecognizer();
            contactInputStack.GestureRecognizers.Add(contactsInputTapRecognizer);

            contactsInputTapRecognizer.Tapped += async (s, e) =>
            {
				await ApplyAnimation( contactInputStack );

				try
				{
					if( Device.OS == TargetPlatform.Android  || Device.OS == TargetPlatform.iOS )
					{
						IContactPicker testicker = DependencyService.Get< IContactPicker >();
						testicker.ShowContactPicker();
					}	
				}
				catch (Exception ex)
                {
                    DisplayAlert("contactsInputTapRecognizer: ", ex.Message, "ok");
                }
                 
            };

            #endregion

            #endregion

            #region ICON CONTAINER GRID

            iconContainerGrid = new Grid
            {
                IsVisible = false,
                VerticalOptions = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions = 
            {
                    new RowDefinition { Height = GridLength.Auto }
                },
                ColumnDefinitions = 
            {
                    new ColumnDefinition { Width = new GridLength(((screenWidth * .80) )/4, GridUnitType.Absolute) }, // icon container x = 3 //new ColumnDefinition { Width = GridLength.Auto },
                  //  new ColumnDefinition { Width = new GridLength(((screenWidth * .80)) /5, GridUnitType.Absolute) },
                    new ColumnDefinition { Width = new GridLength(((screenWidth * .80))/4, GridUnitType.Absolute) },
                    new ColumnDefinition { Width = new GridLength(((screenWidth * .80))/4, GridUnitType.Absolute) },
                    new ColumnDefinition { Width = new GridLength(((screenWidth * .80))/4, GridUnitType.Absolute) },
            }
            };

            iconContainerGrid.Children.Add(galleryInputStack, 0, 0);
            iconContainerGrid.Children.Add(cameraInputStack, 1, 0);
          //  iconContainerGrid.Children.Add(audioInputStack, 2, 0);
            iconContainerGrid.Children.Add(locationInputStack, 2, 0);
            iconContainerGrid.Children.Add(contactInputStack, 3, 0);

            textinputAndIconsHolder = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.Center,
                Spacing = 0,
                Padding = 0,
				Children = { textInputContainer, iconContainerGrid, editLocationAndContactsStack }
            };

            Button createEvent = new Button();
            if (pageTitle == Constants.ADD_ACTIONS || pageTitle == Constants.ADD_GOALS || pageTitle == Constants.EDIT_ACTIONS || pageTitle == Constants.EDIT_GOALS)
            {
                createEvent.BackgroundColor = Color.Transparent;
                createEvent.TextColor = Constants.BLUE_BG_COLOR;
                createEvent.Text = "Create Reminder";
                createEvent.FontSize = 12;
                createEvent.BorderWidth = 0;
                createEvent.BorderColor = Color.Transparent;
                createEvent.Clicked += createEvent_Clicked;
				if( Device.OS == TargetPlatform.iOS )
				createEvent.TranslationY = -8;
                textinputAndIconsHolder.Children.Add(createEvent);

            }
            masterLayout.AddChildToLayout(textinputAndIconsHolder, 5, 21);


            #region PREVIEW LIST
            listContainer = new StackLayout();
            listContainer.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY;
            listContainer.WidthRequest = screenWidth * 90 / 100;
            listContainer.HeightRequest = screenHeight * 25 / 100;
            listContainer.ClassId = "preview";

            previewListView = new ListView();
            previewListView.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY;
            PreviewListViewCellItem.addEvntObject = this;
            previewListView.ItemTemplate = new DataTemplate(typeof(PreviewListViewCellItem));
            previewListView.SeparatorVisibility = SeparatorVisibility.None;
            previewListView.Opacity = 1;
            previewListView.ItemsSource = App.PreviewListSource;
			previewListView.ItemSelected += (object sender, SelectedItemChangedEventArgs e) => 
			{
              /*  PreviewItem items = previewListView.SelectedItem as PreviewItem;
                if( items != null )
                App.Navigator.PushModalAsync( new VideoPlayerView( items.Path ) );*/
				previewListView.SelectedItem = null;
			};
            listContainer.Children.Add(previewListView);
            masterLayout.AddChildToLayout(listContainer, 5, Device.OnPlatform( 63, 63, 50 ));
            #endregion

			//masterLayout.AddChildToLayout(locationEditStack, 5, 30 );
            #endregion

            Content = masterLayout;
        }
        public void Dispose()
        {
            subTitleBar.BackButtonTapRecognizer.Tapped -= OnBackButtonTapRecognizerTapped;
            subTitleBar.NextButtonTapRecognizer.Tapped -= NextButtonTapRecognizer_Tapped;
            masterLayout = null;
            this.TopTitleBar = null;
            this.subTitleBar = null;
            eventDescription = null;
            this.textInputContainer = null;
            this.audioInputStack = null;
            this.cameraInput = null;
            this.audioInput = null;
            this.cameraInputStack = null;
            this.galleryInput = null;
            this.galleryInputStack = null;
            this.locationInput = null;
            this.locationInputStack = null;
            this.contactInput = null;
            this.contactInputStack = null;
            this.textinputAndIconsHolder = null;
            this.audioRecorder = null;
            eventTitle = null;
            this.iconContainerGrid = null;
			this.locAndContactsEntry = null;
			this.editLocationAndContactsStack = null;
			this.editLocationDoneButton = null;
            GC.Collect();
        }
コード例 #11
0
        public CreateEventPage()
        {
            NavigationPage.SetHasNavigationBar(this, false);
            masterLayout = new CustomLayout();
            masterLayout.BackgroundColor = Color.FromRgb(244, 244, 244);
            deviceSpec = DependencyService.Get<IDeviceSpec>();

			PurposeColorTitleBar mainTitleBar = new PurposeColorTitleBar(Color.FromRgb(8, 135, 224), "Purpose Color", Color.Black, "back", true);
            mainTitleBar.imageAreaTapGestureRecognizer.Tapped += imageAreaTapGestureRecognizer_Tapped;
            PurposeColorSubTitleBar subTitleBar = new PurposeColorSubTitleBar(Constants.SUB_TITLE_BG_COLOR, "Create Reminder", false, true);
            subTitleBar.BackButtonTapRecognizer.Tapped += BackButtonTapRecognizer_Tapped;

			CustomImageButton startDatePickerButton = new CustomImageButton();
			CustomImageButton startTimePickerButton = new CustomImageButton();
			CustomImageButton endDatePickerButton = new CustomImageButton();
			CustomImageButton endTimePickerButton = new CustomImageButton();


            CustomEntry title = new CustomEntry();
			title.WidthRequest = deviceSpec.ScreenWidth * 90 / 100;
			title.Placeholder = " Title";
			title.TextColor = Color.Black;
			title.BackgroundColor = Color.White;


            CustomEntry messege = new CustomEntry();
			messege.WidthRequest = deviceSpec.ScreenWidth * 90 / 100;
			messege.Placeholder = " Description";
			messege.TextColor = Color.Black;
			messege.BackgroundColor = Color.White;


			DatePicker startDatePicker = new DatePicker();
			startDatePicker.WidthRequest = 0;
			startDatePicker.HeightRequest = 0;
			startDatePicker.IsVisible = false;
			startDatePicker.DateSelected += (object sender, DateChangedEventArgs e) => 
			{
				
				startDatePickerButton.Text = startDatePicker.Date.ToString("dd/MM/yyyy");
			};

			DatePicker endDatePicker = new DatePicker();
			endDatePicker.WidthRequest = 0;
			endDatePicker.HeightRequest = 0;
			endDatePicker.IsVisible = false;
			endDatePicker.DateSelected += (object sender, DateChangedEventArgs e) => 
			{
				endDatePickerButton.Text = endDatePicker.Date.ToString("dd/MM/yyyy");
			};

			TimePicker startTimePicker = new TimePicker();
			startTimePicker.WidthRequest = 0;
			startTimePicker.HeightRequest = 0;
			startTimePicker.IsVisible = false;
			startTimePicker.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => 
			{
                try
                {

                    if ("Time" == e.PropertyName)
                    {
                        //	string tie = startTimePicker.Time.ToString("hh:mm tt");
                        string amPM = (startTimePicker.Time.Hours > 12) ? "PM" : "AM";
                        startTimePickerButton.Text = startTimePicker.Time.ToString(); //startTimePicker.Time.Hours.ToString () + " : " + startTimePicker.Time.Minutes.ToString() + "  " + amPM;

                    }

                }
                catch (Exception ex)
                {
                    var test = ex.Message;
                }
			};


			TimePicker endTimePicker = new TimePicker();
			endTimePicker.WidthRequest = 0;
			endTimePicker.HeightRequest = 0;
			endTimePicker.IsVisible = false;
			endTimePicker.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => 
			{
                try
                {
                    if ("Time" == e.PropertyName)
                    {
                        string amPM = (endTimePicker.Time.Hours > 12) ? "PM" : "AM";
                        endTimePickerButton.Text = endTimePicker.Time.ToString();// endTimePicker.Time.Hours.ToString () + " : " + endTimePicker.Time.Minutes.ToString() + "  " + amPM;
                    }
                }
                catch (Exception ex)
                {
                    var test = ex.Message;
                }
			};

            //startDatePickerButton = new CustomImageButton();
            startDatePickerButton.ImageName = Device.OnPlatform("select_box_whitebg.png", "select_box_whitebg.png", "//Assets//select_box_whitebg.png");
            startDatePickerButton.Text = "Start Date";
            startDatePickerButton.FontSize = 17;
            startDatePickerButton.FontFamily = Constants.HELVERTICA_NEUE_LT_STD;
            startDatePickerButton.TextOrientation = interfaces.TextOrientation.Left;
            startDatePickerButton.TextColor = Color.Gray;
            startDatePickerButton.WidthRequest = deviceSpec.ScreenWidth * 40 / 100;
			startDatePickerButton.Clicked += (object sender, EventArgs e) => 
			{
                try
                {
					startDatePicker.Date = DateTime.Now.AddDays(1);
                    startDatePicker.Focus();
                }
                catch (Exception ex)
                {
                    var test = ex.Message;
                }
			};



           // startTimePickerButton = new CustomImageButton();
            startTimePickerButton.ImageName = Device.OnPlatform("select_box_whitebg.png", "select_box_whitebg.png", "//Assets//select_box_whitebg.png");
            startTimePickerButton.Text = " Start Time";
            startTimePickerButton.TextOrientation = TextOrientation.Middle;         
            startTimePickerButton.FontSize = 17;
            startTimePickerButton.FontFamily = Constants.HELVERTICA_NEUE_LT_STD;
            startTimePickerButton.TextOrientation = interfaces.TextOrientation.Left;
            startTimePickerButton.TextColor = Color.Gray;
            startTimePickerButton.WidthRequest = deviceSpec.ScreenWidth * 40 / 100;
			startTimePickerButton.Clicked += (object sender, EventArgs e) => 
			{
                try
                {
                    startTimePicker.Time = new TimeSpan(12, 00, 00);
                    startTimePicker.Focus();
                }
                catch (Exception ex)
                {
                    var test = ex.Message;
                }
			};
		
		
		   // endDatePickerButton = new CustomImageButton();
            endDatePickerButton.ImageName = Device.OnPlatform("select_box_whitebg.png", "select_box_whitebg.png", "//Assets//select_box_whitebg.png");
			endDatePickerButton.Text = "End Date";
			endDatePickerButton.FontSize = 17;
			endDatePickerButton.FontFamily = Constants.HELVERTICA_NEUE_LT_STD;
			endDatePickerButton.TextOrientation = interfaces.TextOrientation.Left;
			endDatePickerButton.TextColor = Color.Gray;
			endDatePickerButton.WidthRequest = deviceSpec.ScreenWidth * 40 / 100;
			endDatePickerButton.Clicked += (object sender, EventArgs e) => 	
			{
                try
                {
					endDatePicker.Date = DateTime.Now.AddDays(1);
                    endDatePicker.Focus();
                }
                catch (Exception ex)
                {
                    var test = ex.Message;
                }
			};


		   // endTimePickerButton = new CustomImageButton();
            endTimePickerButton.ImageName = Device.OnPlatform("select_box_whitebg.png", "select_box_whitebg.png", "//Assets//select_box_whitebg.png");
			endTimePickerButton.Text = " End Time";
			endTimePickerButton.FontSize = 17;
			endTimePickerButton.FontFamily = Constants.HELVERTICA_NEUE_LT_STD;
			endTimePickerButton.TextOrientation = interfaces.TextOrientation.Left;
			endTimePickerButton.TextColor = Color.Gray;
			endTimePickerButton.WidthRequest = deviceSpec.ScreenWidth * 40 / 100;
			endTimePickerButton.Clicked += (object sender, EventArgs e) => 	
			{
                try
                {
                    endTimePicker.Time = new TimeSpan(12, 00, 00);
                    endTimePicker.Focus();
                }
                catch (Exception ex)
                {
                    var test = ex.Message;
                }
			};

			CustomImageButton reminderPickerButton = new CustomImageButton ();
			Picker reminderPicker = new Picker ();
			reminderPicker.Items.Add ("15");
			reminderPicker.Items.Add ("30");
			reminderPicker.Items.Add ("45");
			reminderPicker.Items.Add ("60");
			reminderPicker.WidthRequest = 0;
			reminderPicker.HeightRequest = 0;
			reminderPicker.SelectedIndexChanged += (object sender, EventArgs e) => 
			{
				reminderPickerButton.Text = reminderPicker.Items[reminderPicker.SelectedIndex];
			};


            reminderPickerButton.ImageName = Device.OnPlatform("select_box_whitebg.png", "select_box_whitebg.png", "//Assets//select_box_whitebg.png");
			reminderPickerButton.Text = " Reminder";
			reminderPickerButton.TextOrientation = TextOrientation.Middle;         
			reminderPickerButton.FontSize = 17;
			reminderPickerButton.FontFamily = Constants.HELVERTICA_NEUE_LT_STD;
			reminderPickerButton.TextOrientation = interfaces.TextOrientation.Left;
			reminderPickerButton.TextColor = Color.Gray;
			reminderPickerButton.WidthRequest = deviceSpec.ScreenWidth * 90 / 100;
			reminderPickerButton.Clicked += (object sender, EventArgs e) => 
			{
				reminderPicker.Focus();
			};

			Button createReminderButton = new Button ();
			createReminderButton.Text = "Create Reminder";
			createReminderButton.TextColor = Color.White;
			createReminderButton.BackgroundColor = Color.FromRgb( 30, 126, 210 );
			createReminderButton.WidthRequest = deviceSpec.ScreenWidth * 90 / 100;
			createReminderButton.Clicked += async (object sender, EventArgs e) =>
			{
                try
                {

                    App.CalPage = this;
                    if (startDatePickerButton.Text == "Start Date" || endDatePickerButton.Text == "End Date")
                    {
                        await DisplayAlert(Constants.ALERT_TITLE, "Please select start date and end date to proceed", Constants.ALERT_OK);
                        return;
                    }
                    IReminderService reminder = DependencyService.Get<IReminderService>();

                    if (Device.OS == TargetPlatform.iOS)
                    {
                        var access = await reminder.RequestAccessAsync();
                        if (!access)
                            return;
                    }

                    int reminderValue = 0;
                    if (reminderPickerButton.Text != null && reminderPickerButton.Text.Length > 0 && reminderPicker.SelectedIndex >= 0)
                    {
                        reminderValue = Convert.ToInt32(reminderPickerButton.Text);
                    }

                    DateTime startDateAndTime = new DateTime(startDatePicker.Date.Year, startDatePicker.Date.Month, startDatePicker.Date.Day, startTimePicker.Time.Hours, startTimePicker.Time.Minutes, 0);
                    DateTime endDateAndTime = new DateTime(endDatePicker.Date.Year, endDatePicker.Date.Month, endDatePicker.Date.Day, endTimePicker.Time.Hours, endTimePicker.Time.Minutes, 0);

                    // add this to app datetime fields to serve to api.
                    App.SelectedActionStartDate = startDateAndTime.ToString(); //to be converted into UTC
                    App.SelectedActionEndDate = endDateAndTime.ToString(); //to be converted into UTC
                    App.SelectedActionReminderValue = reminderValue;
                    if (!reminder.Remind(startDateAndTime, endDateAndTime, title.Text, messege.Text, reminderValue))
                    {
                        await DisplayAlert("Purpose Color", "Error in creating calendar event", Constants.ALERT_OK);
                    }
                    else
                    {
                        IProgressBar progress = DependencyService.Get<IProgressBar>();
                        progress.ShowToast("Calander event created");
                        if (Device.OS != TargetPlatform.iOS)
                        { //Navigation.PopAsync(); 
                            await Navigation.PopModalAsync();
                        }

                    }

                }
                catch (Exception ex)
                {
                    var test = ex.Message;
                }
			};

            masterLayout.AddChildToLayout(mainTitleBar, 0, 0);
            masterLayout.AddChildToLayout(subTitleBar, 0, Device.OnPlatform(9, 10, 10));

			masterLayout.AddChildToLayout(startDatePicker, 0, 0);
            masterLayout.AddChildToLayout(startTimePicker, 0, 0);
			masterLayout.AddChildToLayout(endDatePicker, 0, 0);
			masterLayout.AddChildToLayout(endTimePicker, 0, 0);
			masterLayout.AddChildToLayout(reminderPicker, 0, 0);

			masterLayout.AddChildToLayout (title, 5, 20);
			masterLayout.AddChildToLayout(messege, 5, 30);
			masterLayout.AddChildToLayout(startDatePickerButton, 5, 40);
			masterLayout.AddChildToLayout(startTimePickerButton, 55, 40);
			masterLayout.AddChildToLayout(endDatePickerButton, 5, 50);
			masterLayout.AddChildToLayout(endTimePickerButton, 55, 50);
			masterLayout.AddChildToLayout(reminderPickerButton, 5, 70);
			masterLayout.AddChildToLayout(createReminderButton, 5, 80);
            Content = masterLayout;
        }
コード例 #12
0
        public ForgotPassword()
        {
            NavigationPage.SetHasNavigationBar(this, false);
            masterLayout = new CustomLayout();
            

            masterLayout.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY;
            screenHeight = App.screenHeight;
            screenWidth = App.screenWidth;
            Cross.IDeviceSpec deviceSpec = DependencyService.Get<Cross.IDeviceSpec>();
            PurposeColor.CustomControls.PurposeColorTitleBar mainTitleBar = new PurposeColor.CustomControls.PurposeColorTitleBar(Color.FromRgb(8, 135, 224), "Purpose Color", Color.Black, "back", true);
            mainTitleBar.imageAreaTapGestureRecognizer.Tapped += (s, e) =>
            {
                App.masterPage.IsPresented = !App.masterPage.IsPresented;
            };

            subTitleBar = new PurposeColor.CustomControls.PurposeColorBlueSubTitleBar(Constants.SUB_TITLE_BG_COLOR, "       Forgot password");
            subTitleBar.BackButtonTapRecognizer.Tapped += (s, e) =>
            {
                try
                {
                    Navigation.PopAsync();
                }
                catch (Exception)
                {
                }
            };
            masterLayout.AddChildToLayout(mainTitleBar, 0, 0);
            masterLayout.AddChildToLayout(subTitleBar, 0, Device.OnPlatform(9, 10, 10));
            subTitleBar.NextButtonTapRecognizer.Tapped += (s, e) =>
            {
                resetPasswordButton_Clicked(resetPasswordButton, null);
            };

            description = new Label
            {
                Text = "Please provide your registered email adddress, we will send a password reset link to the same. Please add our address in your contacts to prevent routing our mails to spam folder.",
                TextColor = Color.FromHex("#424646"),//Constants.BLUE_BG_COLOR,
                BackgroundColor = Color.Transparent,
                FontSize = 16,
                WidthRequest = screenWidth * 80 / 100,
                HeightRequest = 100
            };

            masterLayout.AddChildToLayout(description, 10, 20);
            email = new CustomEntry
            {
                Placeholder = "Email",
                Keyboard = Keyboard.Email,
                BackgroundColor = Color.Transparent,
                TextColor = Color.Black,
                HeightRequest = Device.OnPlatform(50, 50, 75)
                
            };
            email.WidthRequest = screenWidth * 80 / 100;
            masterLayout.AddChildToLayout(email, 10, 38);

            resetPasswordButton = new Button
            {
                Text = "Submit",
                TextColor = Color.White,
                BorderColor = Color.Transparent,
                BorderWidth = 0,
                BackgroundColor = Constants.BLUE_BG_COLOR
            };

            resetPasswordButton.Clicked += resetPasswordButton_Clicked;

            resetPasswordButton.WidthRequest = screenWidth * 80 / 100;
            masterLayout.AddChildToLayout(resetPasswordButton, 10, Device.OnPlatform(48, 48,46));

            Content = masterLayout;
        }
コード例 #13
0
        void OnAddButtonClicked(object sender, EventArgs e)
        {
            try
            {

                if (pageTitle == Constants.SELECT_EMOTIONS)
                {
                    CustomEntry emotionsEntry = new CustomEntry();
                    emotionsEntry.BackgroundColor = Color.White;
                    emotionsEntry.Placeholder = "Enter emotion";
                    emotionsEntry.WidthRequest = screenWidth * 75 / 100;
                    emotionsEntry.TextColor = Color.Black;
                    listTitle.IsVisible = false;
                    addButton.IsVisible = false;
					emotionsEntry.TextChanged += EmotionsEntry_TextChanged;

                    addEmotionButton = new Image();
                    addEmotionButton.Source = (FileImageSource)ImageSource.FromFile(Device.OnPlatform("tick_with_bg.png", "tick_with_bg.png", "//Assets//tick_with_bg.png"));

                    addEmotionButton.WidthRequest = Device.OnPlatform(25, 25, 30);
                    addEmotionButton.HeightRequest = Device.OnPlatform(25, 25, 30);

                    StackLayout addEmotionButtonLayout = new StackLayout();
                    addEmotionButtonLayout.HeightRequest = 50;
                    addEmotionButtonLayout.WidthRequest = 50;
                    addEmotionButtonLayout.BackgroundColor = Color.Transparent;

                    TapGestureRecognizer addEmotionButtonLayoutTapGestureRecognizer = new TapGestureRecognizer();
                    addEmotionButtonLayoutTapGestureRecognizer.Tapped += async (
                        object addsender, EventArgs adde) =>
                    {

                        IProgressBar progressBar = DependencyService.Get<IProgressBar>();

                        progressBar.ShowProgressbar("sending new emotion");


						//User user = App.Settings.GetUser();

                        listTitle.IsVisible = true;
                        addButton.IsVisible = true;
                        addEmotionButton.IsVisible = false;
                        emotionsEntry.IsVisible = false;
                        addEmotionButtonLayout.IsVisible = false;

                        if (emotionsEntry.Text == null)
                        {
                            progressBar.ShowToast("emotion is empty");
                            progressBar.HideProgressbar();
                            return;
                        }

                        if (emotionsEntry.Text != null && emotionsEntry.Text.Trim().Length == 0)
                        {
                            progressBar.ShowToast("emotion is empty");
                            progressBar.HideProgressbar();
                            return;
                        }
						User user = App.Settings.GetUser();
						if (user == null) {
							return;
						}
						var addService = await ServiceHelper.AddEmotion(FeelingNowPage.sliderValue.ToString(), emotionsEntry.Text,  user.UserId);

                        await FeelingsPage.DownloadAllEmotions();




                        View pickView = pageContainedLayout.Children.FirstOrDefault(pick => pick.ClassId == "ePicker");
                        pageContainedLayout.Children.Remove(pickView);
                        pickView = null;
                        progressBar.HideProgressbar();
						if(listView.SelectedItem != null)
						{
							listView.SelectedItem = null;
						}

						//await Task.Delay( TimeSpan.FromSeconds( 1 ) );

						CustomListViewItem newEmotionItem = new CustomListViewItem();
						newEmotionItem.EmotionID = App.emotionsListSource.First().EmotionID;
						newEmotionItem.Name = App.emotionsListSource.First().Name;
						newEmotionItem.SliderValue = App.emotionsListSource.First().SliderValue;

						SelectedItemChangedEventArgs newEmotionEvent = new SelectedItemChangedEventArgs( newEmotionItem );
						FeelingsPage.OnEmotionalPickerItemSelected( this, newEmotionEvent );

                    };
                    addEmotionButtonLayout.GestureRecognizers.Add(addEmotionButtonLayoutTapGestureRecognizer);

                    masterLayout.AddChildToLayout(addEmotionButton, 85, (100 - topYPos - 2) - 6);
                    masterLayout.AddChildToLayout(emotionsEntry, 7, (100 - topYPos - 2) - Device.OnPlatform(7, 7, 9));
                    masterLayout.AddChildToLayout(addEmotionButtonLayout, Device.OnPlatform(80, 80, 83), Device.OnPlatform((100 - topYPos - 1) - 9, (100 - topYPos - 1) - 9, (100 - topYPos - 1) - 8));
                }
                else
                {
                    //Navigation.PushAsync(new AddEventsSituationsOrThoughts(pageTitle));
					AddEventsSituationsOrThoughts addUtitlty = new AddEventsSituationsOrThoughts(pageTitle);
					/*addUtitlty.feelingsPage = FeelingsPage;
					addUtitlty.feelingSecondPage = feelingSecondPage;*/
					Navigation.PushAsync( addUtitlty );
                    View pickView = pageContainedLayout.Children.FirstOrDefault(pick => pick.ClassId == "ePicker");
                    pageContainedLayout.Children.Remove(pickView);
                    pickView = null;
                }

            }
            catch (Exception ex)
            {
                var test = ex.Message;
            }
        }