コード例 #1
0
ファイル: CustomTabBar.cs プロジェクト: ntfnd404/XamUI
        public CustomTabBar()
        {
            SelectedTabColor = Color.Blue;
            On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
            var navigationPage = new HomePage();

            navigationPage.IconImageSource = "homeIcon.png";
            navigationPage.Title           = "";
            var navigationPage2 = new ContentPage();

            navigationPage2.IconImageSource = "heartIcon.png";
            navigationPage2.Title           = "";
            var navigationPage3 = new LocationPage();

            navigationPage3.IconImageSource = "pinIcon.png";
            navigationPage3.Title           = "";
            var navigationPage4 = new ContentPage();

            navigationPage4.IconImageSource = "userIcon.png";
            navigationPage4.Title           = "";
            Children.Add(navigationPage);
            Children.Add(navigationPage2);
            Children.Add(navigationPage3);
            Children.Add(navigationPage4);
        }
コード例 #2
0
        public override ActionResult Index(ClosestLocationBlock currentBlock)
        {
            var model = new ClosestLocationViewModel();

            model.Heading = currentBlock.Heading;

            var results = SearchClient.Instance.Search <LocationPage>()
                          .OrderBy(x => x.Coordinates)
                          .DistanceFrom(UserLocation)
                          .Take(1)
                          .FilterForVisitor()
                          .StaticallyCacheFor(new TimeSpan(0, 1, 0))
                          .GetContentResult();

            if (results.TotalMatching > 0)
            {
                LocationPage location = results.FirstOrDefault();
                model.Image       = location.PageImage;
                model.Link        = location.ContentLink;
                model.Name        = location.Name;
                model.Description = location.TeaserText;
            }

            return(PartialView("ClosestLocation", model));
        }
コード例 #3
0
        public App()
        {
            InitializeComponent();

            DependencyService.Register <MockDataStore>();
            MainPage = new LocationPage();
        }
コード例 #4
0
        //adds all the location buttons
        private void AddLocations()
        {
            List <StorageLocation> locations = DatabaseHandler.GetDatabase().GetLocations();

            Console.WriteLine("Total locations: " + locations.Count());
            foreach (StorageLocation location in locations)
            {
                Action tapAction = () =>
                {
                    LocationPage newPage = new LocationPage(location);
                    MasterNavigationPage.ChangePage(newPage);
                };
                this.contentLayout.Children.Add(new LocationsPanelView(location, LocationImageWidth, LocationImageHeight, tapAction));
                this.contentLayout.Children.Add(new DividerLine());
            }
        }
コード例 #5
0
        private async Task SetLocation()
        {
            LocationPage      locationPage      = new LocationPage();
            LocationViewModel locationViewModel = new LocationViewModel(_latitude, _longitude);

            locationViewModel.PropertyChanged += async(sender, args) =>
            {
                if (!args.PropertyName.Equals("Position"))
                {
                    return;
                }

                await UpdateLocation(locationViewModel.Position.Latitude, locationViewModel.Position.Longitude);
            };

            locationPage.BindingContext = locationViewModel;

            await Application.Current.MainPage.Navigation.PushAsync(locationPage);
        }
コード例 #6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            //TabLayoutResource = Resource.Layout.Tabbar;
            //ToolbarResource = Resource.Layout.Toolbar;

            this.Window.ClearFlags(WindowManagerFlags.Fullscreen);

            base.OnCreate(savedInstanceState);

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);


            using (Bundle bundle = new Bundle())
            {
                CrossCurrentActivity.Current.Init(this, bundle);
            }



            SetContentView(Resource.Layout.GPSLocation);

            layout = Window.DecorView.FindViewById(Android.Resource.Id.Content);


            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = "GPS Location Finder";

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);

            Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData));
            Android.Support.V4.App.Fragment locationPage = new LocationPage().CreateSupportFragment(this);
            SupportFragmentManager
            .BeginTransaction()
            .Replace(Resource.Id.fragment_frame_layout, locationPage)
            .Commit();
        }
コード例 #7
0
 public LocationViewModel(LocationPage lp) : base(lp.fromIdx, lp.count, lp.total) {
     this.Locations = lp.locations;
 }
コード例 #8
0
        public void Create_Credit_App_Firefox()
        {
            browser_.Navigate().GoToUrl(HOME_PAGE);
            //1st step is to select get started button
            try
            {
                HomePage homePage = new HomePage(browser_);
                homePage.GetStartedButton.Click();
            }
            catch (Exception ex)
            {
                Trace.TraceError(ex.Message);
                Assert.Fail("Fail at Home page");
            }

            //2nd step is to randomly "Select Make"
            string newUsedText = "";

            try
            {
                MakePage makePage = new MakePage(rng_, browser_);

                IWebElement randomButton = makePage.SelectRandomNewUsedButton();
                randomButton.Click();
                newUsedText = randomButton.Text;
                Trace.WriteLine("New/Used: " + randomButton.Text);
                Trace.WriteLine("MakesCollection Count: " + makePage.MakesCollection.Count);
                IWebElement randomMakeType = makePage.SelectRandomMakeType();
                Trace.WriteLine("Make Type Selected: " + makePage.RandomMakeTypeTitle);
                randomMakeType.Click();
            }
            catch (Exception ex)
            {
                Trace.TraceError(ex.Message);
                Assert.Fail("Fail at Select Make page");
            }

            try
            {
                //3rd step is to randomly select a car
                PageSelector modelPageSelector = new PageSelector(rng_, browser_);
                BasePage     nextPage          = modelPageSelector.GetNewOrUsedModelPage(newUsedText);

                if (nextPage is ModelPage)
                {
                    ModelPage modelPage = (ModelPage)nextPage;
                    Trace.WriteLine("ModelsCollection Count: " + modelPage.ModelsCollection.Count);
                    IWebElement randomModelType = modelPage.SelectRandomModelType();
                    Trace.WriteLine("Car Model Selected: " + modelPage.RandomModelTypeTitle);
                    randomModelType.Click();
                }
                else if (nextPage is UsedPage)
                {
                    UsedPage usedModelPage = (UsedPage)nextPage;
                    Trace.WriteLine("Used ModelsCollection Count: " + usedModelPage.UsedCollection.Count);
                    IWebElement randomUsedModelType = usedModelPage.SelectRandomUsedItem();
                    Trace.WriteLine("Used Car Model Selected: " + randomUsedModelType.Text);
                    randomUsedModelType.Click();
                }

                //4th step
                LocationPage location = new LocationPage(browser_);
                if (!location.IsLocationSpecified)
                {
                    Trace.WriteLine("Location Modal is Displayed");
                    location.UseMyLocationButton.Click();
                    //alternate way of inputting location information
                    //location.LocationInputField.SendKeys(ZIP_CODE);
                    //location.FindLocationButton.Click();
                }
            }
            catch (Exception ex)
            {
                Trace.TraceError(ex.Message);
                Assert.Fail("Fail at Model Selection page");
            }

            //5th step determine if the new page has a inventory list or a trim list
            bool wasTrimPageVisited = false;

            try
            {
                PageSelector pageSelector = new PageSelector(rng_, browser_);
                BasePage     newPage      = pageSelector.GetNewPage();

                if (newPage is TrimPage)
                {
                    TrimPage    trimPage = (TrimPage)newPage;
                    IWebElement trimCard = trimPage.SelectRandomTrimCard();
                    Trace.WriteLine("Trim selected: " + trimPage.TrimCardTitle.Text);
                    trimCard.Click();
                    wasTrimPageVisited = true;
                }
                else if (newPage is InventoryPage)
                {
                    InventoryPage inventoryPage = (InventoryPage)newPage;
                    IWebElement   inventoryCard = inventoryPage.SelectRandomInventoryCard();
                    Trace.WriteLine("Inventory selected: " + inventoryPage.InventoryCardTitle.Text);
                    string dealerName = inventoryPage.DealerName.Text;
                    inventoryCard.Click();

                    //Review Vehicle Page
                    ReviewVehiclePage reviewVehiclePage = new ReviewVehiclePage(browser_);
                    Trace.WriteLine("Dealership Name: " + reviewVehiclePage.DealerName.Text);
                    Assert.AreEqual(dealerName, reviewVehiclePage.DealerName.Text);
                    reviewVehiclePage.NextButton.Click();
                }
                else if (newPage is UsedPage)
                {
                    UsedPage    usedYearPage = new UsedPage(rng_, browser_);
                    IWebElement yearElement  = usedYearPage.SelectRandomUsedItem();
                    Trace.WriteLine("Used Year: " + yearElement.Text);
                    yearElement.Click();

                    UsedPage    usedTrimPage = new UsedPage(rng_, browser_);
                    IWebElement trimElement  = usedTrimPage.SelectRandomUsedItem();
                    Trace.WriteLine("Used Trim: " + trimElement.Text);
                    trimElement.Click();
                    wasTrimPageVisited = true;
                }
            }
            catch (Exception ex)
            {
                Trace.TraceError(ex.Message);
                Assert.Fail("Fail at PageSelector");
            }

            //6th step ~ no trade-in
            try
            {
                ReviewDetailsPage reviewDetailsPage = new ReviewDetailsPage(rng_, browser_);

                if (newUsedText.Equals("used", StringComparison.InvariantCultureIgnoreCase))
                {
                    reviewDetailsPage.UsedVehiclePriceInput.SendKeys(MIN_USED_VEHICLE_PRICE);
                    reviewDetailsPage.OdomoterReadingInput.SendKeys(USED_ODOMETER_VALUE);
                    IWebElement financeType = browser_.FindElement(By.ClassName("sectionTitleBar___1cVBK"));
                    Trace.WriteLine("used finance type: " + financeType.Text);
                }
                else //new car
                {
                    Trace.WriteLine("Finance Toggle Count: " + reviewDetailsPage.FinanceToggles.Count);
                    reviewDetailsPage.SelectRandomFinanceToggle().Click();
                    Trace.WriteLine("finance type: " + reviewDetailsPage.FinanceType.Text);
                }

                reviewDetailsPage.NoTradeInButton.Click();
                reviewDetailsPage.NextButton.Click();
            }
            catch (Exception ex)
            {
                Trace.TraceError(ex.Message);
                Assert.Fail("Fail at Review Details page");
            }

            //7th step ~ pick a random dealership if TrimPage was visited instead of inventory page
            if (wasTrimPageVisited)
            {
                try
                {
                    DealershipPage dealershipPage = new DealershipPage(rng_, browser_);
                    dealershipPage.SelectRandomDealer();
                    Trace.WriteLine("Dealership name selected: " + dealershipPage.DealerName.Text);

                    if (!dealershipPage.SelectDealerButton.Displayed)
                    {
                        dealershipPage.ToggleDropdown.Click();
                    }

                    foreach (IWebElement button in dealershipPage.DealerButtons)
                    {
                        Trace.WriteLine("display: " + button.Displayed);
                    }

                    dealershipPage.SelectDealerButton.Click();
                }
                catch (Exception ex)
                {
                    Trace.WriteLine(ex.Message);
                    Assert.Fail("Fail at Dealership Page");
                }
            }

            //8th step is to stop at "Search For Financing" Personal Information Page
            try
            {
                PersonalInformationPage personalInfoPage = new PersonalInformationPage(browser_);
                Assert.AreEqual("Personal Information", personalInfoPage.PersonalInformation.Text);
                Trace.WriteLine("Test Succeeded!");
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
                Trace.WriteLine("Test Failed!");
                Assert.Fail("Fail at Personal Information page");
            }
        }
コード例 #9
0
 public LocationsSteps(IWebDriver driver)
 {
     _driver = driver;
     _page   = new LocationPage(driver);
 }