Пример #1
0
        public override void ViewWillDisappear(bool animated)
        {
            base.ViewWillDisappear (animated);
            loadingOverlay = null;

            this.BingWebView = null;
        }
Пример #2
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear (animated);

            this.BingWebView.LoadRequest (new NSUrlRequest(new NSUrl(webURL)));
            BingWebView.ScalesPageToFit = true;

            loadingOverlay = new LoadingOverlay(this.BingWebView.Bounds);

            //When the web view starts to load
            this.BingWebView.LoadStarted += (object sender, EventArgs e) => {
                if (loadingOverlay != null)
                this.BingWebView.Add(loadingOverlay);
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
            };

            //When the web view is finished loading
            this.BingWebView.LoadFinished += (object sender, EventArgs e) => {
                if (loadingOverlay != null)
                loadingOverlay.Hide();
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
            };
        }
        public override void ViewDidLoad()
        {
            this.NavigationItem.Title = "Sign Up: User Info";

            this.View.UserInteractionEnabled = true;

            loadingOverlay = new LoadingOverlay(this.View.Bounds);
            this.View.Add(loadingOverlay);

            // Navigation
            UIBarButtonItem btn = new UIBarButtonItem ();
            btn.Image = UIImage.FromFile("Navigation Back Icon.png");
            btn.Clicked += (sender , e)=>{
                this.NavigationController.PopViewController(false);
            };
            NavigationItem.LeftBarButtonItem = btn;

            //***************************************** Hiding Back Button ***********************//

            //			NavigationItem.SetHidesBackButton (true, false);
            //			NavigationItem.SetLeftBarButtonItem(null, true);
            TextBoxShouldReturn ();
            //			if (AppDelegate.UserProfile.name != null) {
            //				LoadUserDetails ();
            //			}
            TableViewState.Hidden = true;
            ButtonLineOfBusiness.Enabled = false;
            TextBoxLineOfBusiness.UserInteractionEnabled = false;

            IList<string> States = new List<string>
            {
                "AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI",
                "MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX",
                "UT","VT","VA","WA","WV","WI","WY"
            };

            ScrollViewSignUpDetails.ContentSize =  new SizeF (350.0f, 1050.0f);

            ScrollViewSignUpDetails.Scrolled += delegate {
                TableViewState.Hidden = true;
                TableViewIndustry.Hidden = true;
                TextBoxZip.ResignFirstResponder ();
                TextBoxPhone.ResignFirstResponder ();
            };

            ButtonCancel.Layer.CornerRadius = 3.0f;
            ButtonNext.Layer.CornerRadius = 3.0f;
            ButtonSubmit.Layer.CornerRadius = 3.0f;

            TableViewState.Source = new TableSource(States,this , "States");
            TableViewState.ContentSize = new SizeF (100f,50f);
            ButtonState.TouchUpInside += (object sender, EventArgs e) =>  {
                TableViewState.Hidden = false;
            };

            TableViewIndustry.Hidden = true;
            LoadScreen ();

            //			Industries =  AppDelegate.industryBL.GetIndustry ();
            //			listLOB = AppDelegate.industryBL.GetLOB();

            TableViewIndustry.Layer.BorderColor=UIColor.FromRGB(169,169,169).CGColor;
            //TableViewIndustry.ContentSize = new SizeF (100f,50f);
            ButtonIndustry.TouchUpInside += (object sender, EventArgs e) =>  {
                TextBoxLineOfBusiness.Text = string.Empty;
                TableViewIndustry.Frame = new CGRect(25,345,this.View.Bounds.Size.Width - 50,122);
                TableViewIndustry.Hidden = false;
                TableViewIndustry.Source = new TableSource(Industries,this, "Industry");
                TableViewIndustry.ReloadData ();
            };

            ButtonLineOfBusiness.TouchUpInside+= (object sender, EventArgs e) => {
                TableViewIndustry.Frame = new CGRect(25,435,this.View.Bounds.Size.Width - 50,122);
                TableViewIndustry.Hidden = false;
                TableViewIndustry.ReloadData ();
            };

            ButtonNext.TouchUpInside += (object sender, EventArgs e) => {

                if(isFromDashBoard == false && Validation()) {
                    SaveUserDetails();
                    AccountManagementVC accountManagementVC = this.Storyboard.InstantiateViewController ("AccountManagementVC") as AccountManagementVC;
                    if (accountManagementVC != null) {
                        accountManagementVC.isFromSignUp = true;
                        this.NavigationController.PushViewController (accountManagementVC, true);
                    }
                }
            //				}else if (isFromDashBoard == true && Validation()) {
            //					SaveUserDetails();
            //					DismissViewController(true,null);
            //				}
            };
            loadingOverlay.Hide ();

            ButtonSubmit.TouchUpInside += (object sender, EventArgs e) =>  {
                if (isFromDashBoard == true && Validation()) {
                SaveUserDetails();
                AppDelegate.userBL.UpdateUserDetails(AppDelegate.UserDetails);
                DismissViewController(true,null);
                }
            };

            ButtonCancel.TouchUpInside += (object sender, EventArgs e) => {
                DismissViewController (true, null);
            };
        }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			UIBarButtonItem btn = new UIBarButtonItem ();
			btn.Image = UIImage.FromFile("Navigation Back Icon.png");
			btn.Clicked += (sender , e)=>{				
				this.NavigationController.PopViewController(false);
			};
			NavigationItem.LeftBarButtonItem = btn;

			this.Title = "Customer Profile";

			loadingOverlay = new LoadingOverlay(this.View.Bounds);
			this.View.Add(loadingOverlay);

//			LoadScreenData ();
//			ButtonDealMakerUsed.Hidden = true;
//			//customerDetails.dealMaker != null 
//			if (customerDetails.dealMaker != null) {
//				LabelDealMakerUsed.Text = customerDetails.dealMaker.BrokerName;
//				ButtonDealMakerUsed.Hidden = false;
//			}
			//DealMakersImage1.Hidden = customerDetails.dealMaker != null ? false : true;
			//Add code to navigate to dealmaker details 
			ButtonDealMakerUsed.TouchUpInside += (object sender, EventArgs e) => {
				MyDealMakerDetailVC dealmakerDetailObject = this.Storyboard.InstantiateViewController ("MyDealMakerDetailVC") as MyDealMakerDetailVC;
				if (dealmakerDetailObject != null) { 
					dealmakerDetailObject.brokerObj = customerDetails.dealMaker;
					this.NavigationController.PushViewController (dealmakerDetailObject, true);
				}
			};
			
			ButtonPhone.TouchUpInside += (object sender, EventArgs e) => {
				var phone = string.IsNullOrEmpty(customerDetails.Phone.Trim()) == true ? "0" : customerDetails.Phone;
				var url = new NSUrl ("tel://" + phone);
				if (!UIApplication.SharedApplication.OpenUrl (url)) {
					var av = new UIAlertView ("Not supported",
						"Scheme 'tel:' is not supported on this device",
						null,
						"OK",
						null);
					av.Show ();
				};
				CustomerInteraction customerinteract = new CustomerInteraction();
				customerinteract.CustomerName =  customerDetails.Name;
				customerinteract.UserId = AppDelegate.UserDetails.UserId;
				customerinteract.Type = "Phone";
				customerinteract.DateNTime = DateTime.Now.ToString();
				customerinteract.LeadID = customerDetails.LeadId;
				AppDelegate.customerBL.SaveCutomerInteraction(customerinteract);
				//Xamarin Insights tracking
				Insights.Track("SaveCutomerInteraction", new Dictionary <string,string>{
					{"UserId", customerinteract.UserId.ToString()},
					{"CustomerName", customerinteract.CustomerName}
				});
			};

			ButtonMail.TouchUpInside += (object sender, EventArgs e) => {
				MFMailComposeViewController mailController;
				if (MFMailComposeViewController.CanSendMail) {
					// do mail operations here
					mailController = new MFMailComposeViewController ();
					mailController.SetToRecipients (new string[]{customerDetails.Email});
					mailController.SetSubject ("Quick request");
					mailController.SetMessageBody ("", false);
					this.PresentViewController (mailController, true, null);
					mailController.Finished += ( object s, MFComposeResultEventArgs args) => {
						switch(args.Result)
						{
								case MFMailComposeResult.Cancelled: 							
									break;
								case MFMailComposeResult.Saved: 
									break;
								case MFMailComposeResult.Sent: 	
									CustomerInteraction customerinteract = new CustomerInteraction();
									customerinteract.CustomerName =  customerDetails.Name;
									customerinteract.UserId = AppDelegate.UserDetails.UserId;
									customerinteract.Type = "Email";
									customerinteract.DateNTime = DateTime.Now.ToString();
									customerinteract.LeadID = customerDetails.LeadId;
									AppDelegate.customerBL.SaveCutomerInteraction(customerinteract);				

									// Xamarin Insights tracking
									Insights.Track("Save CutomerInteraction", new Dictionary <string,string>{
										{"UserId", customerinteract.UserId.ToString()},
										{"CustomerName", customerinteract.CustomerName},
										{"Type", "Email"}
									});
									break;
								case MFMailComposeResult.Failed: 
									break;
						}
						args.Controller.DismissViewController (true, null);
					};


				}
			};

			ButtonCalendarEvent.TouchUpInside += (object sender, EventArgs e) => {
//				CalenderHomeDVC calendarHomeDV = new CalenderHomeDVC ();
//				this.NavigationController.PushViewController(calendarHomeDV, true);
				LaunchCreateNewEvent();
			};
			//await LoadCustomerAndMeetingInfo ();
		}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            this.NavigationItem.SetHidesBackButton (true, false);
            this.NavigationItem.SetLeftBarButtonItem(null, true);

            SetUILayOut ();

            // Code to start the Xamarin Test Cloud Agent
            #if ENABLE_TEST_CLOUD
            Xamarin.Calabash.Start ();
            #endif

            AppDelegate.IsFromSignUp = false;
            ButtonLogin.TouchUpInside +=  async (object sender, EventArgs e) => {

                loadingOverlay = new LoadingOverlay(this.View.Bounds);
                this.View.Add(loadingOverlay);

                if ( ValidateCredentials ()) {
                    // Call to Get user details and validate credentials
                    LandingTabBarVC landingVC = this.Storyboard.InstantiateViewController ("LandingTabBarVC") as LandingTabBarVC;
                    if (landingVC != null) {
                        this.NavigationController.PushViewController(landingVC, true);
                    }
                }
            };

            ButtonLinkedInLogin.TouchUpInside += async (object sender, EventArgs e) => {

                //var auth0 = new Auth0Client("donow.auth0.com","1ghdA3NFkpT9V7ibOuIKp8QK3oF49RId");
                var auth0 = new Auth0Client("donowx.auth0.com","T2GQGMUwY1jxHHD2sKTGtiX865rynYQh");
                Auth0User user = null;
                try
                {
                    user = await auth0.LoginAsync(this,"linkedin");

                }
                catch (AggregateException ex)
                {
                //this.SetResultText(e.Flatten().Message);
                }
                catch (Exception ex)
                {
                //this.SetResultText(e.Message);
                }

                if(user != null)
                {
                    loadingOverlay = new LoadingOverlay(this.View.Bounds);
                    this.View.Add(loadingOverlay);

                    AppDelegate.UserProfile = Newtonsoft.Json.JsonConvert.DeserializeObject<Profile>(user.Profile.ToString());

                    if(AppDelegate.UserProfile.email_verified == true)
                    {

                        //AppDelegate.UserDetails =  AppDelegate.userBL.GetUserFromEmail(AppDelegate.UserProfile.email);
                        AppDelegate.UserDetails =  AppDelegate.userBL.GetUserDetails(AppDelegate.UserProfile.email);

                        if(AppDelegate.UserDetails != null && AppDelegate.UserDetails.UserId > 0)
                        {

                            LandingTabBarVC landingVC = this.Storyboard.InstantiateViewController ("LandingTabBarVC") as LandingTabBarVC;
                            if (landingVC != null) {
                                this.NavigationController.PushViewController(landingVC, true);
                            }
                        }
                        else
                        {
                            signUpOtherDetailsVC signUpVC = this.Storyboard.InstantiateViewController ("signUpOtherDetailsVC") as signUpOtherDetailsVC;
                            if (signUpVC != null) {
            //								signUpVC.NavigationItem.SetHidesBackButton (true, false);
            //								signUpVC.NavigationItem.SetLeftBarButtonItem(null, true);

                                if (signUpVC != null) {
                                    signUpVC.NavigationItem.SetHidesBackButton (true, false);
                                }
                                this.NavigationController.PushViewController(signUpVC, true);
                            }
                        }
                    }
                }
            };

            ButtonSignUp.TouchUpInside += (object sender, EventArgs e) => {
                AppDelegate.UserProfile = null;
                signUpLoginDetailsVC signUpVC = this.Storyboard.InstantiateViewController ("signUpLoginDetailsVC") as signUpLoginDetailsVC;
                if (signUpVC != null) {
                    this.NavigationController.PushViewController(signUpVC, true);
                }
            };

            ButtonForgotPassword.TouchUpInside += (object sender, EventArgs e) => {

                ForgotPasswordVC forgotPasswordVC = this.Storyboard.InstantiateViewController ("ForgotPasswordVC") as ForgotPasswordVC;
                if (forgotPasswordVC != null) {
                    this.NavigationController.PushViewController(forgotPasswordVC, true);
                }
            };

            ButtonVideo.TouchUpInside += (object sender, EventArgs e) => {
                var url = new NSUrl ("http://www.youtube.com/watch?v=I0N-4Dtog6E");
                if (!UIApplication.SharedApplication.OpenUrl (url)) {
                    var av = new UIAlertView ("Error:",
                        "error in opening video link",
                        null,
                        "OK",
                        null);
                    av.Show ();
                };
            };

            ButtonWebsite.TouchUpInside += (object sender, EventArgs e) => {
                var url = new NSUrl ("http://donowx.com");
                if (!UIApplication.SharedApplication.OpenUrl (url)) {
                    var av = new UIAlertView ("Error:",
                        "error in opening video link",
                        null,
                        "OK",
                        null);
                    av.Show ();
                };
            };
        }