Exemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            _fragments = new List<MvxFragmentWithTitle>
                {
                    new Tab1Fragment(),
                    new Tab2Fragment(),
                    new Tab3Fragment(),
                    new Tab3Fragment(),
                    new Tab3Fragment(),
                    new Tab3Fragment(),
                    new Tab3Fragment(),
                    new Tab3Fragment()
                };

            _adapter = new FragmentTextAdapter(SupportFragmentManager, _fragments);

            _pager = FindViewById<ViewPager>(Resource.Id.pager);
            _pager.Adapter = _adapter;

            _indicator = FindViewById<TitlePageIndicator>(Resource.Id.indicator);
            _indicator.SetViewPager(_pager);
        }
Exemplo n.º 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (Reachability.IsHostReachable(Settings._baseDomain))
            {
                LoadingOverlay loadingOverlay = new LoadingOverlay(View.Frame);
                View.Add(loadingOverlay);
                Task.Run(() =>
                {
                    var image = HelperMethods.FromUrl(Settings.BanManProURL);
                    BeginInvokeOnMainThread(() =>
                    {
                        loadingOverlay.Hide();
                        BanManProImageView.Image = image;
                    });
                });
            }
            else
            {
                BanManProImageView.Image = UIImage.FromBundle("ad_placeholder.jpg");
            }

            tapGesture1 = new UITapGestureRecognizer(TapImageAction1);

            int currentIndex = this.DataObject.MagazinePageIndex;
            int totalPages   = this.DataObject.TotalPages;

            PageIndicator.SetIndicatorState(currentIndex, totalPages);
        }
Exemplo n.º 3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            adapter         = new MyPagerAdapter(SupportFragmentManager);
            pager           = FindViewById <ViewPager> (Resource.Id.pager);
            tabs            = FindViewById <PagerSlidingTabStrip> (Resource.Id.tabs);
            pager.Adapter   = adapter;
            tabs.Visibility = ViewStates.Invisible;
            tabs.SetViewPager(pager);

            var pageMargin = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 4, Resources.DisplayMetrics);

            pager.PageMargin          = pageMargin;
            tabs.OnPageChangeListener = this;

            PageIndicator mIndicator = FindViewById <CirclePageIndicator> (Resource.Id.indicator);

            mIndicator.SetViewPager(pager);

            mIndicator.SetOnPageChangeListener(new MyPageChangeListener(this));


//			timer.Elapsed+=timer_Elapsed;
//			timer.Start();


            SupportActionBar.SetDisplayHomeAsUpEnabled(false);
            SupportActionBar.SetHomeButtonEnabled(false);
        }
Exemplo n.º 4
0
 private void Start()
 {
     InitializePagePosition();   //모양 초기화
     if (indicatorSwitcher == null)
     {
         indicatorSwitcher = GetComponentInChildren <PageIndicator>();
     }
 }
Exemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            maximumPage = 0;
            //RestClientClass rClient = new RestClientClass();
            theResponse   = null;
            rClient.title = null;
            rClient.type  = null;
            rClient.year  = null;
            if (textTitle.Text != null && textType.Text == null && textYear.Text == null)
            {
                rClient.title    = "s=" + textTitle.Text;
                rClient.endPoint = rClient.key + rClient.title;
            }
            if (textTitle.Text != null && textType.Text != null && textYear.Text == null)
            {
                rClient.title    = "s=" + textTitle.Text;
                rClient.type     = "&type=" + textType.Text;
                rClient.endPoint = rClient.key + rClient.title + rClient.type;
            }
            if (textTitle.Text != null && textType.Text == null && textYear.Text != null)
            {
                rClient.title    = "s=" + textTitle.Text;
                rClient.year     = "&y=" + textYear.Text;
                rClient.endPoint = rClient.key + rClient.title + rClient.year;
            }
            if (textTitle.Text != null && textType.Text != null && textYear.Text != null)
            {
                rClient.title    = "s=" + textTitle.Text;
                rClient.type     = "&type=" + textType.Text;
                rClient.year     = "&y=" + textYear.Text;
                rClient.endPoint = rClient.key + rClient.title + rClient.type + rClient.year;
            }
            theResponse = rClient.makeRequest();
            firstCall   = rClient.endPoint;
            PageIndicator.Clear();
            listResponse.Items.Clear();
            listType.Items.Clear();
            listYear.Items.Clear();
            int totalResults = Convert.ToInt32(theResponse.totalResults);

            maximumPage = (int)Math.Ceiling((double)totalResults / theResponse.Search.Length);
            page        = 1;
            if (page != maximumPage)
            {
                GoRight.Enabled      = true;
                GoToLastPage.Enabled = true;
            }
            for (int i = 0; i < theResponse.Search.Length; i++)
            {
                listResponse.Items.Add(theResponse.Search[i].Title);
                listType.Items.Add(theResponse.Search[i].Type);
                listYear.Items.Add(theResponse.Search[i].Year);
            }
            debugOutput("1");
        }
Exemplo n.º 6
0
 private void debugOutput(string theOutputText)
 {
     try
     {
         System.Diagnostics.Debug.Write(theOutputText + Environment.NewLine);
         PageIndicator.Text           = PageIndicator.Text + theOutputText + Environment.NewLine;
         PageIndicator.SelectionStart = PageIndicator.TextLength;
         PageIndicator.ScrollToCaret();
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.Write(ex.Message, ToString() + Environment.NewLine);
     }
 }
Exemplo n.º 7
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			this.RequestedOrientation = global::Android.Content.PM.ScreenOrientation.Portrait;

			AsAbout = Intent.GetBooleanExtra ("AsAbout", false);

			SetContentView (Resource.Layout.Intro);
			mAdapter = new IntroFragmentAdapter (SupportFragmentManager);
		
			mPager = FindViewById<global::Android.Support.V4.View.ViewPager> (Resource.Id.pager);
			mPager.Adapter = mAdapter;
		

			mIndicator = FindViewById<CirclePageIndicator> (Resource.Id.indicator);
			mIndicator.SetViewPager (mPager);
		}
Exemplo n.º 8
0
 private void GoToFirstPage_Click(object sender, EventArgs e)
 {
     if (page != 1)
     {
         page = 1;
         PageIndicator.Clear();
         listResponse.Items.Clear();
         listType.Items.Clear();
         listYear.Items.Clear();
         rClient.endPoint = firstCall + "&page=" + page;
         theResponse      = rClient.makeRequest();
         for (int i = 0; i < theResponse.Search.Length; i++)
         {
             listResponse.Items.Add(theResponse.Search[i].Title);
             listType.Items.Add(theResponse.Search[i].Type);
             listYear.Items.Add(theResponse.Search[i].Year);
         }
         debugOutput(page.ToString());
     }
     if (page == 1)
     {
         GoLeft.Enabled        = false;
         GoToFirstPage.Enabled = false;
     }
     else
     {
         GoLeft.Enabled        = true;
         GoToFirstPage.Enabled = true;
     }
     if (page == maximumPage)
     {
         GoRight.Enabled      = false;
         GoToLastPage.Enabled = false;
     }
     else
     {
         GoRight.Enabled      = true;
         GoToLastPage.Enabled = true;
     }
 }
Exemplo n.º 9
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //Hide MT Buttons
            //Ad1MTButton.Alpha = 0f;
            //Ad2MTButton.Alpha = 0f;
            //Ad3MTButton.Alpha = 0f;
            //Ad4MTButton.Alpha = 0f;

            var ad1 = DataObject.Ads[0];

            //var ad2 = DataObject.Ads[1];
            //var ad3 = DataObject.Ads[2];
            //var ad4 = DataObject.Ads[3];

            //Hide text button if broker doesn't have a cell phone
            if (string.IsNullOrEmpty(ad1.BrokerCellPhone))
            {
                Ad1MessageButton.Alpha = 0f;
            }
            ;
            //if (string.IsNullOrEmpty(ad2.BrokerCellPhone))
            //{
            //	Ad2MessageButton.Alpha = 0f;
            //};
            //if (string.IsNullOrEmpty(ad3.BrokerCellPhone))
            //{
            //	Ad3MessageButton.Alpha = 0f;
            //};
            //if (string.IsNullOrEmpty(ad4.BrokerCellPhone))
            //{
            //	Ad4MessageButton.Alpha = 0f;
            //};



            AdImage1.SetImage(
                url: new NSUrl(ad1.ImageURL),
                placeholder: UIImage.FromBundle("ad_placeholder.jpg")
                );

            AdName1.Text  = ad1.Name;
            AdPrice1.Text = ad1.Price;



            Ad1NameButton.SetTitle(ad1.Name, UIControlState.Normal);


            //		AdImage2.SetImage(
            //	url: new NSUrl(ad2.ImageURL),
            //	placeholder: UIImage.FromBundle("ad_placeholder.jpg")
            //);

            //		AdName2.Text = ad2.Name;
            //		AdPrice2.Text = ad2.Price;


            //		Ad2NameButton.SetTitle(ad2.Name, UIControlState.Normal);


            //		AdImage3.SetImage(
            //	url: new NSUrl(ad3.ImageURL),
            //	placeholder: UIImage.FromBundle("ad_placeholder.jpg")
            //);

            //		AdName3.Text = ad3.Name;
            //		AdPrice3.Text = ad3.Price;


            //		Ad3NameButton.SetTitle(ad3.Name, UIControlState.Normal);


            //		AdImage4.SetImage(
            //	url: new NSUrl(ad4.ImageURL),
            //	placeholder: UIImage.FromBundle("ad_placeholder.jpg")
            //);

            //		AdName4.Text = ad4.Name;
            //		AdPrice4.Text = ad4.Price;


            //		Ad4NameButton.SetTitle(ad4.Name, UIControlState.Normal);

            var labelAttribute = new UIStringAttributes
            {
                Font = UIFont.BoldSystemFontOfSize(18)
            };
            var brokerLabelAttribute = new UIStringAttributes
            {
                Font = UIFont.BoldSystemFontOfSize(15)
            };

            var valueAttribute = new UIStringAttributes
            {
                Font            = UIFont.SystemFontOfSize(15),
                ForegroundColor = UIColor.Blue
            };

            Ad1TeaserLabel.Text = ad1.Teaser == string.Empty ? "Inquire for Details" : ad1.Teaser;
            //Ad2TeaserLabel.Text = ad2.Teaser == string.Empty ? "Inquire for Details" : ad2.Teaser;
            //Ad3TeaserLabel.Text = ad3.Teaser == string.Empty ? "Inquire for Details" : ad3.Teaser;
            //Ad4TeaserLabel.Text = ad4.Teaser == string.Empty ? "Inquire for Details" : ad4.Teaser;

            #region attributed labels
            Ad1BrokerButton.SetAttributedTitle(HelperMethods.GetBrokerAttributedString(ad1, brokerLabelAttribute, valueAttribute), UIControlState.Normal);
            //Ad2BrokerButton.SetAttributedTitle(HelperMethods.GetBrokerAttributedString(ad2, brokerLabelAttribute, valueAttribute), UIControlState.Normal);
            //Ad3BrokerButton.SetAttributedTitle(HelperMethods.GetBrokerAttributedString(ad3, brokerLabelAttribute, valueAttribute), UIControlState.Normal);
            //Ad4BrokerButton.SetAttributedTitle(HelperMethods.GetBrokerAttributedString(ad4, brokerLabelAttribute, valueAttribute), UIControlState.Normal);

            Ad1RegistrationLabel.AttributedText = HelperMethods.GetRegistrationAttributedString(ad1, labelAttribute);
            //Ad2RegistrationLabel.AttributedText = HelperMethods.GetRegistrationAttributedString(ad2, labelAttribute);
            //Ad3RegistrationLabel.AttributedText = HelperMethods.GetRegistrationAttributedString(ad3, labelAttribute);
            //Ad4RegistrationLabel.AttributedText = HelperMethods.GetRegistrationAttributedString(ad4, labelAttribute);

            Ad1SerialLabel.AttributedText = HelperMethods.GetSerialAttributedString(ad1, labelAttribute);
            //Ad2SerialLabel.AttributedText = HelperMethods.GetSerialAttributedString(ad2, labelAttribute);
            //Ad3SerialLabel.AttributedText = HelperMethods.GetSerialAttributedString(ad3, labelAttribute);
            //Ad4SerialLabel.AttributedText = HelperMethods.GetSerialAttributedString(ad4, labelAttribute);

            Ad1TimeLabel.AttributedText = HelperMethods.GetTotalTimeAttributedString(ad1, labelAttribute);
            //Ad2TimeLabel.AttributedText = HelperMethods.GetTotalTimeAttributedString(ad2, labelAttribute);
            //Ad3TimeLabel.AttributedText = HelperMethods.GetTotalTimeAttributedString(ad3, labelAttribute);
            //Ad4TimeLabel.AttributedText = HelperMethods.GetTotalTimeAttributedString(ad4, labelAttribute);

            Ad1LocationLabel.AttributedText = HelperMethods.GetLocationAttributedString(ad1, labelAttribute);
            //Ad2LocationLabel.AttributedText = HelperMethods.GetLocationAttributedString(ad2, labelAttribute);
            //Ad3LocationLabel.AttributedText = HelperMethods.GetLocationAttributedString(ad3, labelAttribute);
            //Ad4LocationLabel.AttributedText = HelperMethods.GetLocationAttributedString(ad4, labelAttribute);
            #endregion

            #region price changed
            if (!HelperMethods.ShowPriceChangedLabel(ad1.PriceLastUpdated))
            {
                Ad1PriceChangeLabel.Alpha = 0f;
            }
            //if (!HelperMethods.ShowPriceChangedLabel(ad2.PriceLastUpdated))
            //{
            //	Ad2PriceChangeLabel.Alpha = 0f;

            //}
            //if (!HelperMethods.ShowPriceChangedLabel(ad3.PriceLastUpdated))
            //{
            //	Ad3PriceChangeLabel.Alpha = 0f;

            //}
            //if (!HelperMethods.ShowPriceChangedLabel(ad4.PriceLastUpdated))
            //{
            //	Ad4PriceChangeLabel.Alpha = 0f;
            //}
            #endregion



            //Set initial state of like buttons
            if (DataObject.Ads[0].IsLiked)
            {
                HelperMethods.SetInitialLikeButtonState(AdLike1, DataObject.Ads[0]);
            }

            //if (DataObject.Ads[1].IsLiked)
            //{
            //	HelperMethods.SetInitialLikeButtonState(AdLike2, DataObject.Ads[1]);
            //}

            //if (DataObject.Ads[2].IsLiked)
            //{
            //	HelperMethods.SetInitialLikeButtonState(AdLike3, DataObject.Ads[2]);
            //}

            //if (DataObject.Ads[3].IsLiked)
            //{
            //	HelperMethods.SetInitialLikeButtonState(AdLike4, DataObject.Ads[3]);
            //}

            //webview image tap gestures
            AdImage1.UserInteractionEnabled = true;
            AdImage2.UserInteractionEnabled = true;
            AdImage3.UserInteractionEnabled = true;
            AdImage4.UserInteractionEnabled = true;

            //UITapGestureRecognizer tapGesture1 = new UITapGestureRecognizer(TapImageAction1);
            //AdImage1.AddGestureRecognizer(tapGesture1);
            //UITapGestureRecognizer tapGesture2 = new UITapGestureRecognizer(TapImageAction2);
            //AdImage2.AddGestureRecognizer(tapGesture2);
            //UITapGestureRecognizer tapGesture3 = new UITapGestureRecognizer(TapImageAction3);
            //AdImage3.AddGestureRecognizer(tapGesture3);
            //UITapGestureRecognizer tapGesture4 = new UITapGestureRecognizer(TapImageAction4);
            //AdImage4.AddGestureRecognizer(tapGesture4);

            tapGesture1 = new UITapGestureRecognizer(TapImageAction1);
            tapGesture2 = new UITapGestureRecognizer(TapImageAction2);
            tapGesture3 = new UITapGestureRecognizer(TapImageAction3);
            tapGesture4 = new UITapGestureRecognizer(TapImageAction4);

            int currentIndex = this.DataObject.MagazinePageIndex;
            int totalPages   = this.DataObject.TotalPages;

            PageIndicator.SetIndicatorState(currentIndex, totalPages);

            //Randomly load banmanpro
            //HelperMethods.LoadWebBanManPro(this.View);
        }
Exemplo n.º 10
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var ad3 = DataObject.Ads[0];
            var ad2 = DataObject.Ads[1];
            var ad1 = DataObject.Ads[2];

            //Hide text button if broker doesn't have a cell phone
            if (string.IsNullOrEmpty(ad1.BrokerCellPhone))
            {
                Ad1MessageButton.Alpha = 0f;
            }
            ;
            if (string.IsNullOrEmpty(ad2.BrokerCellPhone))
            {
                Ad2MessageButton.Alpha = 0f;
            }
            ;
            if (string.IsNullOrEmpty(ad3.BrokerCellPhone))
            {
                Ad3MessageButton.Alpha = 0f;
            }
            ;


            AdImage1.SetImage(
                url: new NSUrl(ad1.ImageURL),
                placeholder: UIImage.FromBundle("ad_placeholder.jpg")
                );

            Ad1BrokerButton.SetTitle("", UIControlState.Normal);
            Ad1TeaserLabel.Text = ad1.Teaser == string.Empty ? "Inquire for Details" : ad1.Teaser;
            AdPrice1.Text       = (ad1.Price.Length == 0 ? "Call" : ad1.Price);

            var ad2AircraftDetails = new AircraftDetails[] {
                new AircraftDetails("", "Technical Specifications", false, true, false),
                new AircraftDetails("", "Aircraft Range", false, false, true),
                new AircraftDetails("Price:", (ad2.Price.Length == 0 ? "Call" : ad2.Price), false),
                new AircraftDetails("Offered by:", ad2.BrokerName, true),
                new AircraftDetails("Registration:", ad2.RegistrationNumber, false),
                new AircraftDetails("Serial Number:", ad2.SerialNumber, false),
                new AircraftDetails("Time:", ad2.TotalTime, false),
                new AircraftDetails("Location:", ad2.Location, false),
                new AircraftDetails("Summary:", ad2.Teaser == string.Empty ? "Inquire for Details" : ad2.Teaser, false),
            };

            var ad3AircraftDetails = new AircraftDetails[] {
                new AircraftDetails("", "Technical Specifications", false, true, false),
                new AircraftDetails("", "Aircraft Range", false, false, true),
                new AircraftDetails("Price:", (ad3.Price.Length == 0 ? "Call" : ad3.Price), false),
                new AircraftDetails("Offered by:", ad3.BrokerName, true),
                new AircraftDetails("Registration:", ad3.RegistrationNumber, false),
                new AircraftDetails("Serial Number:", ad3.SerialNumber, false),
                new AircraftDetails("Time:", ad3.TotalTime, false),
                new AircraftDetails("Location:", ad3.Location, false),
                new AircraftDetails("Summary:", ad3.Teaser == string.Empty ? "Inquire for Details" : ad3.Teaser, false),
            };

            Ad2TableView.Source = new AircraftDetailsTableSource(ad2AircraftDetails, ad2);
            Ad3TableView.Source = new AircraftDetailsTableSource(ad3AircraftDetails, ad3);

            Ad1BrokerLabel.Text = ad1.BrokerName;


            Ad1NameButton.SetTitle(ad1.Name, UIControlState.Normal);
            Ad1NameButton.Layer.BorderColor = UIColor.White.CGColor;
            Ad1NameButton.Layer.BorderWidth = 1f;

            AdImage2.SetImage(
                url: new NSUrl(ad2.ImageURL),
                placeholder: UIImage.FromBundle("ad_placeholder.jpg")
                );



            Ad2NameButton.SetTitle(ad2.Name, UIControlState.Normal);
            Ad2NameButton.Layer.BorderColor = UIColor.White.CGColor;
            Ad2NameButton.Layer.BorderWidth = 1f;

            AdImage3.SetImage(
                url: new NSUrl(ad3.ImageURL),
                placeholder: UIImage.FromBundle("ad_placeholder.jpg")
                );

            Ad3NameButton.SetTitle(ad3.Name, UIControlState.Normal);
            Ad3NameButton.Layer.BorderColor = UIColor.White.CGColor;
            Ad3NameButton.Layer.BorderWidth = 1f;

            var labelAttribute = new UIStringAttributes
            {
                Font = UIFont.BoldSystemFontOfSize(18)
            };

            var brokerLabelAttribute = new UIStringAttributes
            {
                Font = UIFont.BoldSystemFontOfSize(15)
            };

            var valueAttribute = new UIStringAttributes
            {
                Font            = UIFont.SystemFontOfSize(15),
                ForegroundColor = UIColor.Blue
            };

            Ad1RegistrationLabel.Text = HelperMethods.GetRegistrationString(ad1, labelAttribute);
            Ad1SerialLabel.Text       = HelperMethods.GetSerialString(ad1, labelAttribute);
            Ad1TimeLabel.Text         = HelperMethods.GetTotalTimeString(ad1, labelAttribute);
            Ad1LocationLabel.Text     = ad1.Location;

            #region price changed
            if (!HelperMethods.ShowPriceChangedLabel(ad1.PriceLastUpdated))
            {
                Ad1PriceChangedLabel.Alpha = 0f;
            }
            if (!HelperMethods.ShowPriceChangedLabel(ad2.PriceLastUpdated))
            {
                Ad2PriceChangeLabel.Alpha = 0f;
            }
            if (!HelperMethods.ShowPriceChangedLabel(ad3.PriceLastUpdated))
            {
                Ad3PriceChangeLabel.Alpha = 0f;
            }
            #endregion

            ////Set initial state of like buttons
            if (DataObject.Ads[0].IsLiked)
            {
                HelperMethods.SetInitialLikeButtonState(AdLike1, DataObject.Ads[0]);
            }

            //webview image tap gestures
            AdImage1.UserInteractionEnabled = true;
            AdImage2.UserInteractionEnabled = true;
            AdImage3.UserInteractionEnabled = true;

            tapGesture1 = new UITapGestureRecognizer(TapImageAction1);
            tapGesture2 = new UITapGestureRecognizer(TapImageAction2);
            tapGesture3 = new UITapGestureRecognizer(TapImageAction3);

            int currentIndex = this.DataObject.MagazinePageIndex;
            int totalPages   = this.DataObject.TotalPages;

            PageIndicator.SetIndicatorState(currentIndex, totalPages);
        }
Exemplo n.º 11
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();


            var ad1 = DataObject.Ads[0];
            var ad2 = DataObject.Ads[1];

            //Hide text button if broker doesn't have a cell phone
            if (string.IsNullOrEmpty(ad1.BrokerCellPhone))
            {
                Ad1MessageButton.Alpha = 0f;
            }
            ;
            if (string.IsNullOrEmpty(ad2.BrokerCellPhone))
            {
                Ad2MessageButton.Alpha = 0f;
            }
            ;



            AdImage1.SetImage(
                url: new NSUrl(ad1.ImageURL),
                placeholder: UIImage.FromBundle("ad_placeholder.jpg")
                );

            //Commenting out for new detail view
            //AdName1.Text = ad1.Name;

            AdPrice1.Text = ad1.Price;

            if (ad1.Price.Length == 0)
            {
                AdPrice1.Text = "Call";
            }

            Ad1BrokerButton.SetTitle(ad1.BrokerName, UIControlState.Normal);
            //Ad1BrokerButton.SetTitleColor(UIColor.Green, UIControlState.Normal);

            Ad2BrokerButton.SetTitle(ad2.BrokerName, UIControlState.Normal);


            Ad1NameButton.SetTitle(ad1.Name, UIControlState.Normal);
            Ad1NameButton.Layer.BorderColor = UIColor.White.CGColor;
            Ad1NameButton.Layer.BorderWidth = 1f;



            Ad2Image.SetImage(
                url: new NSUrl(ad2.ImageURL),
                placeholder: UIImage.FromBundle("ad_placeholder.jpg")
                );

            //Ad2NameLabel.Text = ad2.Name;
            Ad2PriceLabel.Text = ad2.Price;
            if (ad2.Price.Length == 0)
            {
                Ad2PriceLabel.Text = "Call";
            }

            Ad2NameButton.SetTitle(ad2.Name, UIControlState.Normal);
            Ad2NameButton.Layer.BorderColor = UIColor.White.CGColor;
            Ad2NameButton.Layer.BorderWidth = 1f;


            var labelAttribute = new UIStringAttributes
            {
                Font = UIFont.BoldSystemFontOfSize(18)
            };


            Ad1TeaserLabel.Text = ad1.Teaser == string.Empty ? "Inquire for Details" : ad1.Teaser;
            Ad2TeaserLabel.Text = ad2.Teaser == string.Empty ? "Inquire for Details" : ad2.Teaser;


            //#region attributed labels

            Ad1RegistrationLabel.Text = HelperMethods.GetRegistrationString(ad1, labelAttribute);
            Ad2RegistrationLabel.Text = HelperMethods.GetRegistrationString(ad2, labelAttribute);


            Ad1SerialLabel.Text = HelperMethods.GetSerialString(ad1, labelAttribute);
            Ad2SerialLabel.Text = HelperMethods.GetSerialString(ad2, labelAttribute);


            Ad1TimeLabel.Text = HelperMethods.GetTotalTimeString(ad1, labelAttribute);
            Ad2TimeLabel.Text = HelperMethods.GetTotalTimeString(ad2, labelAttribute);


            Ad1LocationLabel.Text = ad1.Location;
            Ad2LocationLabel.Text = ad2.Location;
            //#endregion

            #region price changed
            if (!HelperMethods.ShowPriceChangedLabel(ad1.PriceLastUpdated))
            {
                Ad1PriceChangeLabel.Alpha = 0f;
            }
            if (!HelperMethods.ShowPriceChangedLabel(ad2.PriceLastUpdated))
            {
                Ad2PriceChangeLabel.Alpha = 0f;
            }
            #endregion



            //Set initial state of like buttons
            if (DataObject.Ads[0].IsLiked)
            {
                HelperMethods.SetInitialLikeButtonState(AdLike1, DataObject.Ads[0]);
            }



            if (DataObject.Ads[1].IsLiked)
            {
                HelperMethods.SetInitialLikeButtonState(Ad2LikeButton, DataObject.Ads[1]);
            }

            //webview image tap gestures
            AdImage1.UserInteractionEnabled = true;
            Ad2Image.UserInteractionEnabled = true;

            //UITapGestureRecognizer tapGesture1 = new UITapGestureRecognizer(TapImageAction1);
            //AdImage1.AddGestureRecognizer(tapGesture1);

            //UITapGestureRecognizer tapGesture2 = new UITapGestureRecognizer(TapImageAction2);
            //Ad2Image.AddGestureRecognizer(tapGesture2);

            tapGesture1 = new UITapGestureRecognizer(TapImageAction1);
            tapGesture2 = new UITapGestureRecognizer(TapImageAction2);

            int currentIndex = this.DataObject.MagazinePageIndex;
            int totalPages   = this.DataObject.TotalPages;

            PageIndicator.SetIndicatorState(currentIndex, totalPages);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            Ad1NameButton.TouchUpInside   += AdSortButton_TouchUpInside;
            Ad1BrokerButton.TouchUpInside += AdSortButton_TouchUpInside;


            this.NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem(
                                                         UIImage.FromFile("new_home.png"), UIBarButtonItemStyle.Plain, (sender, args) =>
            {
                NavigationController.PopViewController(true);
            }), true);

            //Hide MT Buttons
            //Ad1MTButton.Alpha = 0f;

            //Hide text button if broker doesn't have a cell phone
            if (string.IsNullOrEmpty(DataObject.Ads[0].BrokerCellPhone))
            {
                AdMessages1.Alpha = 0f;
            }
            ;
            //Hide text button if broker doesn't have a cell phone
            if (string.IsNullOrEmpty(DataObject.Ads[0].BrokerPhone))
            {
                AdPhone1.Alpha = 0f;
            }

            var ad1 = DataObject.Ads[0];

            try
            {
                FeaturedLabel.Hidden = !ad1.IsFeatured;

                AdImage1.SetImage(
                    url: new NSUrl(ad1.ImageURL),
                    placeholder: UIImage.FromBundle("ad_placeholder.jpg")
                    );
                //string originalURL = "https://images.globalair.com/ganimages/ads/large/77711_22210_(1)__kopia_e1.jpg";
                //string newURL = "https://images.globalair.com/ganimages/ads/large/77711_22210_(1)—kopia_e1.jpg";
                //NSUrl url = new NSUrl(newURL);

                //var uri = new Uri(originalURL);
                //var nsurl = new NSUrl(uri.GetComponents(UriComponents.HttpRequestUrl, UriFormat.UriEscaped));
            }
            catch (Exception ex)
            {
                string debugLine = ex.Message;
            }



            //Ensure label and text are visible layered on a dark or light image...
            AdName1.Text  = ad1.Name;
            AdPrice1.Text = ad1.Price;
            if (ad1.Price.Length == 0)
            {
                AdPrice1.Text = "Call";
            }


            var labelAttribute = new UIStringAttributes
            {
                Font = UIFont.BoldSystemFontOfSize(18)
            };

            var brokerLabelAttribute = new UIStringAttributes
            {
                Font = UIFont.BoldSystemFontOfSize(15)
            };
            var brokerValueAttribute = new UIStringAttributes
            {
                Font            = UIFont.SystemFontOfSize(15),
                ForegroundColor = UIColor.Blue
            };

            Ad1TeaserLabel.Text = ad1.Teaser == string.Empty ? "Inquire for Details" : ad1.Teaser;

            //Ad1NameButton.SetTitle(ad1.Name, UIControlState.Normal);

            Ad1NameLabel.Text = ad1.Name;
            Ad1NameLabel.Layer.BorderColor = UIColor.White.CGColor;
            Ad1NameLabel.Layer.BorderWidth = 1f;

            // #region attributed labels

            //Ad1BrokerButton.SetTitle(ad1.BrokerName, UIControlState.Normal);
            Ad1BrokerLabel.Text = ad1.BrokerName;

            //Ad1BrokerButton.SetAttributedTitle(HelperMethods.GetBrokerAttributedString(ad1, brokerLabelAttribute, brokerValueAttribute), UIControlState.Normal);

            Ad1RegistrationLabel.Text = HelperMethods.GetRegistrationString(ad1, labelAttribute);

            Ad1SerialLabel.Text = HelperMethods.GetSerialString(ad1, labelAttribute);

            Ad1TimeLabel.Text = HelperMethods.GetTotalTimeString(ad1, labelAttribute);

            Ad1LocationLabel.Text = ad1.Location;

            //#endregion

            #region price changed
            if (!HelperMethods.ShowPriceChangedLabel(ad1.PriceLastUpdated))
            {
                Ad1PriceChangeLabel.Alpha = 0f;
            }

            #endregion


            //Set initial state of like buttons
            if (DataObject.Ads[0].IsLiked)
            {
                HelperMethods.SetInitialLikeButtonState(AdLike1, DataObject.Ads[0]);
            }



            //webview image tap gestures
            AdImage1.UserInteractionEnabled = true;

            //UITapGestureRecognizer tapGesture1 = new UITapGestureRecognizer(TapImageAction1);
            //AdImage1.AddGestureRecognizer(tapGesture1);

            tapGesture1 = new UITapGestureRecognizer(TapImageAction1);

            int currentIndex = this.DataObject.MagazinePageIndex;
            int totalPages   = this.DataObject.TotalPages;

            PageIndicator.SetIndicatorState(currentIndex, totalPages);

            //Randomly load banmanpro
            //HelperMethods.LoadWebBanManPro(this.View);



            //var specTableViewController = this.Storyboard.InstantiateViewController("SpecViewController_") as SpecViewController_;

            //specTableViewController.Spec = specification;

            //this.PresentViewController(specTableViewController, true, null);
            loadSpeciafication();
        }
        void ReleaseDesignerOutlets()
        {
            if (Ad1BrokerButton != null)
            {
                Ad1BrokerButton.Dispose();
                Ad1BrokerButton = null;
            }

            if (Ad1BrokerLabel != null)
            {
                Ad1BrokerLabel.Dispose();
                Ad1BrokerLabel = null;
            }

            if (Ad1LocationLabel != null)
            {
                Ad1LocationLabel.Dispose();
                Ad1LocationLabel = null;
            }

            if (Ad1NameButton != null)
            {
                Ad1NameButton.Dispose();
                Ad1NameButton = null;
            }

            if (Ad1NameLabel != null)
            {
                Ad1NameLabel.Dispose();
                Ad1NameLabel = null;
            }

            if (Ad1PriceChangeLabel != null)
            {
                Ad1PriceChangeLabel.Dispose();
                Ad1PriceChangeLabel = null;
            }

            if (Ad1RegistrationLabel != null)
            {
                Ad1RegistrationLabel.Dispose();
                Ad1RegistrationLabel = null;
            }

            if (Ad1RGButton != null)
            {
                Ad1RGButton.Dispose();
                Ad1RGButton = null;
            }

            if (Ad1SerialLabel != null)
            {
                Ad1SerialLabel.Dispose();
                Ad1SerialLabel = null;
            }

            if (Ad1TeaserLabel != null)
            {
                Ad1TeaserLabel.Dispose();
                Ad1TeaserLabel = null;
            }

            if (Ad1TechnicalSpecButton != null)
            {
                Ad1TechnicalSpecButton.Dispose();
                Ad1TechnicalSpecButton = null;
            }

            if (Ad1TimeLabel != null)
            {
                Ad1TimeLabel.Dispose();
                Ad1TimeLabel = null;
            }

            if (AdEmail1 != null)
            {
                AdEmail1.Dispose();
                AdEmail1 = null;
            }

            if (AdImage1 != null)
            {
                AdImage1.Dispose();
                AdImage1 = null;
            }

            if (AdLike1 != null)
            {
                AdLike1.Dispose();
                AdLike1 = null;
            }

            if (AdMessages1 != null)
            {
                AdMessages1.Dispose();
                AdMessages1 = null;
            }

            if (AdName1 != null)
            {
                AdName1.Dispose();
                AdName1 = null;
            }

            if (AdPhone1 != null)
            {
                AdPhone1.Dispose();
                AdPhone1 = null;
            }

            if (AdPrice1 != null)
            {
                AdPrice1.Dispose();
                AdPrice1 = null;
            }

            if (AdPriceLabel != null)
            {
                AdPriceLabel.Dispose();
                AdPriceLabel = null;
            }

            if (AdShare1 != null)
            {
                AdShare1.Dispose();
                AdShare1 = null;
            }

            if (FeaturedLabel != null)
            {
                FeaturedLabel.Dispose();
                FeaturedLabel = null;
            }

            if (PageIndicator != null)
            {
                PageIndicator.Dispose();
                PageIndicator = null;
            }

            if (SpecTableView != null)
            {
                SpecTableView.Dispose();
                SpecTableView = null;
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();



            this.NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem(
                                                         UIImage.FromFile("new_home.png"), UIBarButtonItemStyle.Plain, (sender, args) =>
            {
                NavigationController.PopViewController(true);
            }), true);

            //Hide text button if broker doesn't have a cell phone
            if (string.IsNullOrEmpty(DataObject.Ads[0].BrokerCellPhone))
            {
                AdMessages1.Alpha = 0f;
            }
            ;

            var ad1 = DataObject.Ads[0];

            try
            {
                FeaturedLabel.Hidden = !ad1.IsFeatured;

                AdImage1.SetImage(
                    url: new NSUrl(ad1.ImageURL),
                    placeholder: UIImage.FromBundle("ad_placeholder.jpg")
                    );
            }
            catch (Exception ex)
            {
                string debugLine = ex.Message;
            }



            var labelAttribute = new UIStringAttributes
            {
                Font = UIFont.BoldSystemFontOfSize(18)
            };

            var brokerLabelAttribute = new UIStringAttributes
            {
                Font = UIFont.BoldSystemFontOfSize(15)
            };
            var brokerValueAttribute = new UIStringAttributes
            {
                Font            = UIFont.SystemFontOfSize(15),
                ForegroundColor = UIColor.Blue
            };



            Ad1NameButton.SetTitle(ad1.Name, UIControlState.Normal);
            Ad1NameButton.Layer.BorderWidth  = 1;
            Ad1NameButton.Layer.BorderColor  = UIColor.White.CGColor;
            Ad1NameButton.Layer.CornerRadius = 5;


            string price = "";

            if (ad1.Price.Length == 0)
            {
                price = "Call";
            }
            else
            {
                price = ad1.Price;
            }

            AircraftDetails[] aircraftDetails;


            if (ad1.IsFeatured)
            {
                var airframeDetails    = ad1.FeaturedSpec.AirframeDetails.Replace("<br>", "\n");
                var engineDetails      = ad1.FeaturedSpec.EngDetails.Replace("<br>", "\n");
                var interiorDetails    = ad1.FeaturedSpec.IntDetails.Replace("<br>", "\n");
                var exteriorDetails    = ad1.FeaturedSpec.ExtDetails.Replace("<br>", "\n");
                var maintenanceDetails = ad1.FeaturedSpec.Maintenance.Replace("<br>", "\n");
                var avionicsDetails    = ad1.FeaturedSpec.AvDetails.Replace("<br>", "\n");
                var additionalDetails  = ad1.FeaturedSpec.DescriptionDetails.Replace("<br>", "\n");

                aircraftDetails = new AircraftDetails[] {
                    new AircraftDetails("Price:", price, false),
                    new AircraftDetails("Offered by:", ad1.BrokerName, true),
                    new AircraftDetails("Registration:", HelperMethods.GetRegistrationString(ad1, labelAttribute), false),
                    new AircraftDetails("Serial Number:", HelperMethods.GetSerialString(ad1, labelAttribute), false),
                    new AircraftDetails("Time:", HelperMethods.GetTotalTimeString(ad1, labelAttribute), false),
                    new AircraftDetails("Location:", ad1.Location, false),
                    new AircraftDetails("Summary:", ad1.Teaser == string.Empty ? "Inquire for Details" : ad1.Teaser, false),
                    new AircraftDetails("AIRFRAME:", airframeDetails == "" ? "N/A" : airframeDetails, false),
                    new AircraftDetails("ENGINE(S):", engineDetails == "" ? "N/A" : engineDetails, false),
                    new AircraftDetails("INTERIOR:", interiorDetails == "" ? "N/A" : interiorDetails, false),
                    new AircraftDetails("EXTERIOR:", exteriorDetails == "" ? "N/A" : exteriorDetails, false),
                    new AircraftDetails("MAINTENANCE:", maintenanceDetails == "" ? "N/A" : maintenanceDetails, false),
                    new AircraftDetails("AVIONICS:", avionicsDetails == "" ? "N/A" : avionicsDetails, false),
                    new AircraftDetails("ADDITIONAL DETAILS:", additionalDetails == "" ? "N/A" : additionalDetails, false)
                };
            }
            else
            {
                aircraftDetails = new AircraftDetails[] {
                    new AircraftDetails("Price:", price, false),
                    new AircraftDetails("Offered by:", ad1.BrokerName, true),
                    new AircraftDetails("Registration:", HelperMethods.GetRegistrationString(ad1, labelAttribute), false),
                    new AircraftDetails("Serial Number:", HelperMethods.GetSerialString(ad1, labelAttribute), false),
                    new AircraftDetails("Time:", HelperMethods.GetTotalTimeString(ad1, labelAttribute), false),
                    new AircraftDetails("Location:", ad1.Location, false),
                    new AircraftDetails("Summary:", ad1.Teaser == string.Empty ? "Inquire for Details" : ad1.Teaser, false),
                };
            }



            #region price changed
            if (!HelperMethods.ShowPriceChangedLabel(ad1.PriceLastUpdated))
            {
                Ad1PriceChangeLabel.Alpha = 0f;
            }

            #endregion


            //Set initial state of like buttons
            if (DataObject.Ads[0].IsLiked)
            {
                HelperMethods.SetInitialLikeButtonState(AdLike1, DataObject.Ads[0]);
            }



            //webview image tap gestures
            AdImage1.UserInteractionEnabled = true;

            tapGesture1 = new UITapGestureRecognizer(TapImageAction1);

            int currentIndex = this.DataObject.MagazinePageIndex;
            int totalPages   = this.DataObject.TotalPages;

            PageIndicator.SetIndicatorState(currentIndex, totalPages);


            loadSpeciafication();

            //SpecTableView.RegisterClassForCellReuse(typeof(AircraftDetailsLabelCell), AircraftDetailsTableSource.CellLabelIdentifier);

            SpecTableView.Source = new AircraftDetailsTableSource(aircraftDetails, DataObject.Ads[0]);
        }