public void initGoalScreenView0()
 {
     goalScreenView=new GoalScreenView ();
     goalScreenView.raffleNameTextView.Text = "Default Event";
     goalScreenView.organizationLabel.Text = "N/A";
     goalScreenView.timeLeftLabel.Text = "N/A";
     goalScreenView.progressPercentCompletedView.angle = 0;
     goalScreenView.totalRaiseLabel.Text = String.Format ("${0}", 0);
     goalScreenView.rightArrow.TouchUpInside += (s, e) => {
         nextBtnClick ();
     };
     goalScreenView.rightArrow.TouchUpInside += (s, e) => {
         previousBtnClick ();
     };
     View.Add (goalScreenView);
 }
        public void initGoalScreenView()
        {
            goalScreenView=new GoalScreenView ();
            Tap5050Event raffle = Global.eventlist [position];
            goalScreenView.raffleImageView.Image = Global.eventImageList[position];
            goalScreenView.raffleNameTextView.Text = raffle.event_name;
            goalScreenView.organizationLabel.Text = raffle.organization;
            try{
                DateTime eventEndTime=DateTime.ParseExact (raffle.event_end_time.Substring (0, 19),
                    "yyyy-MM-ddTHH:mm:ss", null);
                double hoursleft=(eventEndTime-DateTime.Now).TotalHours;
                int daysRemain=(int)(hoursleft/24.0);
                int hoursRemain=(int)(hoursleft%24.0);
                goalScreenView.timeLeftLabel.Text =String.Format("{0} Days, {1} Hours",daysRemain,hoursRemain);
                if(daysRemain<1&&hoursRemain<0){
                    goalScreenView.timeLeftLabel.Text= GoalScreenData.lessThanAnHour;
                }
                if(daysRemain<1){
                    goalScreenView.timeLeftLabel.TextColor = UIColor.Red;

                }
                else{
                    goalScreenView.timeLeftLabel.TextColor = UIColor.White;
                }
            }
            catch{
                goalScreenView.timeLeftLabel.Text = "N/A";
                goalScreenView.timeLeftLabel.TextColor = UIColor.White;
            }

            int completePercentage = 0;
            try{

                completePercentage=(Int32)(Convert.ToInt32(raffle.gross_sales)*100/Convert.ToInt32(raffle.seller_goal));
                if(completePercentage<0){
                    completePercentage=0;
                }
                goalScreenView.progressPercentageLabel.Text=String.Format("{0}%", completePercentage.ToString());
            }
            catch{
                completePercentage = 0;
                goalScreenView.progressPercentageLabel.Text = String.Format ("{0}%", completePercentage.ToString ());
            }

            goalScreenView.progressPercentCompletedView.angle = completePercentage > 100 ? 2f : (float)2f*completePercentage/100f;

            if (!String.IsNullOrEmpty (raffle.gross_sales)) {
                goalScreenView.totalRaiseLabel.Text = String.Format ("${0}", raffle.gross_sales);
            } else {
                goalScreenView.totalRaiseLabel.Text =String.Format ("${0}", "0");
            }
            if (!String.IsNullOrEmpty (raffle.seller_goal)) {
                goalScreenView.goalLabel.Text = String.Format("${0}",raffle.seller_goal);
            } else {
                goalScreenView.goalLabel.Text =String.Format ("${0}", "0");
            }

            try{
                if (raffle.seller_prize_image_id!="0") {
                    goalScreenView.clickToSeeGoalPrizeLabel.Hidden = false;
                    goalScreenView.goalPrizeDescription.Hidden = false;
                    goalScreenView.goalPrizeDescription.Text = raffle.seller_prize_description;
                    goalScreenView.goalPrizeImageView.Hidden = false;

                    var imageFileName=GoalScreenData.SellerPrizeImageFileNames [Convert.ToInt32 (raffle.seller_prize_image_id)];
                    goalScreenView.goalPrizeImageView.Image = UIImage.FromFile (imageFileName);
                    goalScreenView.goalPrizeBtn.Hidden = false;
                    goalScreenView.goalPrizeBtn.TouchUpInside += (s, e) => {
                        goalPrizeBtnClick();
                    };
                }
            }
            catch{
                goalScreenView.clickToSeeGoalPrizeLabel.Hidden = true;
                goalScreenView.goalPrizeDescription.Hidden = true;
                goalScreenView.goalPrizeImageView.Hidden = true;
                goalScreenView.goalPrizeBtn.Hidden = true;
            }

            if (Global.eventlist [position].seller_position == "0") {
                goalScreenView.positionImageView.Image = null;
                goalScreenView.positionLabel.Text=GoalScreenData.NoSellerSalesRecordNameText;
            } else {
                goalScreenView.positionLabel.Text = Global.eventlist [position].seller_position;
                if(Global.eventlist [position].seller_position=="1"){
                    goalScreenView.positionImageView.Image = UIImage.FromFile(GoalScreenData.position1ImageFileName);
                }
                else if(Global.eventlist [position].seller_position=="2"){
                    goalScreenView.positionImageView.Image = UIImage.FromFile(GoalScreenData.position2ImageFileName);
                }
                else if(Global.eventlist [position].seller_position=="3"){
                    goalScreenView.positionImageView.Image = UIImage.FromFile(GoalScreenData.position3ImageFileName);
                }
                else{
                    goalScreenView.positionImageView.Image = null;
                }
            }
            goalScreenView.leaderBoard.Hidden = false;
            goalScreenView.leaderBoard.Source = new LeaderBoardSource (position);
            goalScreenView.rightArrow.TouchUpInside += (s, e) => {
                nextBtnClick ();
            };
            goalScreenView.leftArrow.TouchUpInside += (s, e) => {
                previousBtnClick ();
            };
            View.Add (goalScreenView);
        }
        //********************************************
        //public GroupGoalScreenView GroupGoalView{ get; set;}
        public RaffleDetailScreenView(Tap5050Event raffle,UIImage raffleImage,UIInterfaceOrientation UIInterfaceOrientation)
        {
            this.raffle = raffle;
            this.raffleImage = raffleImage;

            BackgroundColor = UIColor.FromRGB (235, 235, 235);
            ScrollEnabled = false;
            //GUI component***********************************************
            PersonalBtn=UIButton.FromType(UIButtonType.System);
            PersonalBtn.BackgroundColor = UIColor.Clear;
            PersonalBtn.SetTitle (RaffleDetailData.PersonalGoalBtnTitle, UIControlState.Normal);
            PersonalBtn.SetTitleColor (UIColor.Black, UIControlState.Normal);
            Add(PersonalBtn);

            GrpBtn=UIButton.FromType(UIButtonType.System);
            GrpBtn.BackgroundColor = UIColor.Clear;
            GrpBtn.SetTitle (RaffleDetailData.GroupGoalBtnTitle, UIControlState.Normal);
            GrpBtn.SetTitleColor (UIColor.Black, UIControlState.Normal);
            Add(GrpBtn);

            RaffleDetailBtn=UIButton.FromType(UIButtonType.System);
            RaffleDetailBtn.BackgroundColor = UIColor.Clear;
            RaffleDetailBtn.SetTitle (RaffleDetailData.RaffleDetailBtnTitle, UIControlState.Normal);
            RaffleDetailBtn.SetTitleColor (UIColor.Black, UIControlState.Normal);
            Add(RaffleDetailBtn);

            RaffleDetailBarView= new UIView () {
                BackgroundColor=UIColor.FromRGB (245, 245, 245),
            };
            Add (RaffleDetailBarView);
            PersonalBarView= new UIView () {
                BackgroundColor=UIColor.FromRGB (245, 245, 245),
            };
            Add (PersonalBarView);
            GrpBarView= new UIView () {
                BackgroundColor=UIColor.FromRGB (245, 245, 245),
            };
            Add (GrpBarView);

            raffleDetailView = new UIScrollView () {
                BackgroundColor=UIColor.Clear,
            };
            Add (raffleDetailView);

            GoalView = new  GoalScreenView ();
            Add (GoalView);

            jackPotLabel = new UILabel ()
            {
                TextColor = UIColor.Red,
                TextAlignment=UITextAlignment.Center,
                Text="$"+raffle.jackpot_total,
                Hidden=(raffle.has_jackpot == "Y"?false:true)
            };
            raffleDetailView.Add(jackPotLabel);

            jackPotDescriptionLabel = new UILabel ()
            {
                TextColor = UIColor.Black,
                TextAlignment=UITextAlignment.Center,
                Text=raffle.jackpot_description,
                Hidden=(raffle.has_jackpot == "Y"?false:true)
            };
            raffleDetailView.Add(jackPotDescriptionLabel);

            raffleImageView=new UIImageView()
            {
                ContentMode = UIViewContentMode.ScaleAspectFit,
                Image = raffleImage
            };
            raffleDetailView.Add (raffleImageView);

            raffleNameTextView = new UITextView ()
            {
                TextColor = UIColor.Black,
                TextAlignment=UITextAlignment.Center,
                Text=raffle.event_name,
                Editable=false,
                BackgroundColor=UIColor.Clear,
                ScrollEnabled=false
            };
            raffleDetailView.Add(raffleNameTextView);

            licenseNumberLabel = new UILabel ()
            {
                TextColor = UIColor.Black,
                TextAlignment=UITextAlignment.Center,
                Text=RaffleDetailData.LicenseNumberLabelText,
            };
            raffleDetailView.Add(licenseNumberLabel);

            licenseNumberLabel2 = new UILabel ()
            {
                TextColor = UIColor.Black,
                TextAlignment=UITextAlignment.Center,
                Text=raffle.licence_number
            };
            raffleDetailView.Add(licenseNumberLabel2);

            organizationLabel = new UILabel ()
            {
                TextColor = UIColor.Black,
                TextAlignment=UITextAlignment.Center,
                Text=raffle.organization,
            };
            raffleDetailView.Add(organizationLabel);

            descriptionTextView = new UITextView ()
            {
                TextColor = UIColor.Black,
                TextAlignment=UITextAlignment.Left,
                Text=raffle.description,
                Editable=false,
                BackgroundColor=UIColor.Clear,
                ScrollEnabled=false
            };
            raffleDetailView.Add(descriptionTextView);

            seePrizeBtn =new CustomBtn();
            seePrizeBtn.SetTitle (RaffleDetailData.SeePrizeBtnTitle, UIControlState.Normal);
            seePrizeBtn.SetTitleColor (UIColor.White, UIControlState.Normal);
            seePrizeBtn.Hidden = (String.IsNullOrEmpty (raffle.prize_url)||(!raffle.prize_url.ToLower ().Contains ("https://")) ? true : false);
            raffleDetailView.Add(seePrizeBtn);

            sellTicketBtn =new CustomBtn();
            sellTicketBtn.SetTitle (RaffleDetailData.SellTicketBtnTitle, UIControlState.Normal);
            sellTicketBtn.SetTitleColor (UIColor.White, UIControlState.Normal);
            sellTicketBtn.Hidden = (raffle.have_contract == "Y" ? false : true);
            raffleDetailView.Add(sellTicketBtn);

            applyContractBtn =new CustomBtn();
            applyContractBtn.SetTitle (RaffleDetailData.ApplyContractBtnTitle, UIControlState.Normal);
            applyContractBtn.SetTitleColor (UIColor.White, UIControlState.Normal);
            applyContractBtn.Hidden = (raffle.have_contract == "Y" ? true : false);
            raffleDetailView.Add(applyContractBtn);

            //GroupGoalView = new  GroupGoalScreenView ();
            //Add (GroupGoalView);

            //move the view when the keyboard is up
            NSNotificationCenter.DefaultCenter.AddObserver
            (UIKeyboard.DidShowNotification,KeyBoardUpNotification);

            Rotate (UIInterfaceOrientation);
        }