示例#1
0
        void MenuView_MenuSelected(object sender, MenuItemEventArgs e)
        {
            var id = e.SelectedItem?.Id;

            if (_currentPage == id)
            {
                IsPresented = false; return;
            }

            _currentPage = id;

            switch (id)
            {
            case "home":
                MainNavigation.PushAsync(new MainPage());
                break;

            case "about":
                Device.OpenUri(new Uri("https://www.github.com/ksivamuthu/XamAI"));
                break;

            case "settings":
                MainNavigation.PushAsync(new SettingsPage());
                break;
            }
            IsPresented = false;
        }
示例#2
0
        public MainPage()
        {
            this.InitializeComponent();

            // Hide default title bar.
            var coreTitleBar = CoreApplication.GetCurrentView().TitleBar;

            coreTitleBar.ExtendViewIntoTitleBar = true;
            UpdateTitleBarLayout(coreTitleBar);

            // Set XAML element as a draggable region.
            Window.Current.SetTitleBar(AppTitleBar);

            // Register a handler for when the size of the overlaid caption control changes.
            // For example, when the app moves to a screen with a different DPI.
            coreTitleBar.LayoutMetricsChanged += CoreTitleBar_LayoutMetricsChanged;

            // Register a handler for when the title bar visibility changes.
            // For example, when the title bar is invoked in full screen mode.
            coreTitleBar.IsVisibleChanged += CoreTitleBar_IsVisibleChanged;

            ViewModel = App.Container.Resolve <MainPageViewModel>();

            mainNavigation           = App.Container.Resolve <MainNavigation>();
            mainNavigation.MainFrame = mainFrame;

            mainFrame.Navigating       += MainFrame_Navigating;
            mainPivot.SelectionChanged += MainPivot_SelectionChanged;

            mainNavigation.Navigate(typeof(LibraryPage));
        }
 public TitlesSteps(IWebDriver driver)
 {
     this.driver    = driver;
     mainNavigation = new MainNavigation(driver);
     titlesPage     = new TitlesPage(driver);
     newTitlePage   = new NewTitlePage(driver);
 }
示例#4
0
        private void InitWindow(bool skipWindowCreation)
        {
            var builder = new ContainerBuilder();

            rootPage = Window.Current.Content as MainNavigation;

            if (rootPage == null && !skipWindowCreation)
            {
                rootPage = new MainNavigation();

                FrameAdapter adapter = new FrameAdapter(rootPage.AppFrame);

                builder.RegisterInstance(adapter).AsImplementedInterfaces();

                builder.RegisterType <HomeViewModel>();

                builder.RegisterType <NavigationService>()
                .AsImplementedInterfaces()
                .SingleInstance();

                _container = builder.Build();

                rootPage.InitializeNavigationService(_container.Resolve <INavigationService>());

                adapter.NavigationFailed += OnNavigationFailed;

                Window.Current.Content = rootPage;
                Window.Current.Activate();
            }
        }
 public CommonSteps(IWebDriver driver)
 {
     this.driver    = driver;
     loginPage      = new LoginPage(driver);
     mainNavigation = new MainNavigation(driver);
     basePage       = new BasePage(driver);
 }
示例#6
0
        public App()
        {
            InitializeComponent();

            //MainPage = new BottomNavigationBarXF.MainPage();
            MainPage = new MainNavigation();
        }
        public NowPlayingBarViewModel(
            MainNavigation mainNavigation,
            LibraryService libraryService,
            PlayingQueue playingQueue)
        {
            PlayingQueue   = playingQueue;
            LibraryService = libraryService;
            MainNavigation = mainNavigation;

            PlayingQueue.CurrentItemChanged += PlayingQueue_CurrentItemChanged;
        }
示例#8
0
        public App()
        {
            InitializeComponent();

            //MainPage = new TabbedPage
            //{
            //    Children =
            //    {
            //        new HomePage(),
            //        new Page1(),
            //    }
            //};
            MainPage = new MainNavigation();
        }
示例#9
0
        public void OnItemTapped(object sender, ItemTappedEventArgs args)
        {
            if (args.Item == null)
            {
                return;
            }

            var dest = args.Item as Sample;

            if (dest != null && dest.Class != null)
            {
                Type pageType = dest.Class;

                var page = Activator.CreateInstance(pageType) as Page;
                NavigationPage.SetHasNavigationBar(page, false);
                MainNavigation.PushAsync(page as Page);
            }
        }
示例#10
0
        public ActionResult MainNavigation()
        {
            bool showAll = false;
            var  model   = new MainNavigation()
            {
                LoggedIn                   = false,
                ShortMenuFormat            = false,
                ShowGuildMenu              = true,
                BossFightDifficultyRecords = _bossFightRepository.GetBossFightsAndDifficultySettings()
            };

            if (Request.IsAuthenticated)
            {
                if (User.IsInRole(UserGroups.Admin))
                {
                    showAll = true;
                }
                var user = _authRepository.GetUserAccount(User.Identity.GetUserId());
                if (user != null)
                {
                    model.LoggedIn        = true;
                    model.ShortMenuFormat = user.ShortMenuFormat;
                    model.ShowGuildMenu   = user.ShowGuildMenu;
                }
            }

            var guilds = showAll
                ? _guildRepository.GetAll()
                : _guildRepository.GetVisibleGuilds(User.Identity.GetUserId());

            foreach (var guild in guilds)
            {
                guild.Name = guild.Name.Substring(0, 1).ToUpper() + guild.Name.Substring(1);
            }
            model.Guilds = guilds.OrderBy(g => g.Name).ToList();

            return(PartialView("_MainNavigation", model));
        }
示例#11
0
 private void Awake()
 {
     cameraScript = FindObjectOfType <CameraMovement>();
     _instance    = this;
 }
示例#12
0
 public MainPageViewModel(MainNavigation mainNavigation)
 {
     this.mainNavigation = mainNavigation;
 }
 public void OnMetadataButtonClick()
 {
     MainNavigation.Navigate(typeof(NowPlayingPage));
 }
示例#14
0
 // Use this for initialization
 void Start()
 {
     _mainNavigation = GameObject.Find("MainNavigation").GetComponent <MainNavigation>();
 }
        public MainWindow()
        {
            InitializeComponent();

            MainNavigation.Navigate(new Start());
        }
        /// <summary>
        /// Method used to fill database with single or multiple order from a selected location
        /// </summary>
        void ordering()
        {
            using (var db = new AppDbContext())
            {
                while (anotherBuy) //this while loop is used for user that wants to make multiple order
                {
                    Console.Clear();
                    displayLocation.ShowLocationItem();
                    Console.WriteLine("Please select the pet you would like to take home today!" +
                                      "\nEnter pet number displayed next to the name to add to cart:");

                    try                                                 //this try will check if the entered id is a valid id within that selected location and if it is an integer
                    {
                        int purchaseId = int.Parse(Console.ReadLine()); //parse input to int
                        userPickedItem = db.StoreItems.Include(x => x.StoreLocation).Include(x => x.StoreItemInventory)
                                         .Where(x => x.StoreLocation.StoreLocationId == DisplayLocations.input1)
                                         .First(x => x.StoreItemId == purchaseId);                 //stores the item selected, its location, its inventory into userPickedItem
                        userPickedItemInventory = userPickedItem.StoreItemInventory.itemInventory; //store the available inventory of the selected pet
                    }
                    catch (InvalidOperationException)                                              //if any exceptions were caught, return to the start of the 'anotherBuy' while loop.
                    {
                        Console.WriteLine("The pet id you entered did not match any of the pets, Please enter to try again");
                        Console.ReadLine();
                        continue; //when exception is caught, 'continue' allows this program to start over from 'anotherbuy' while loop again
                    }
                    catch (FormatException)
                    {
                        Console.WriteLine("Please enter a valid Id NUMBER, enter to try again");
                        Console.ReadLine();
                        continue; //when exception is caught, 'continue' allows this program to start over from 'anotherbuy' while loop again
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                        Console.WriteLine("I don't know what you entered but please read, Please enter to try again");
                        Console.ReadLine();
                        continue;                    //when exception is caught, 'continue' allows this program to start over from 'anotherbuy' while loop again
                    }
                    while (loopConditionForQuantity) //while loop for input validation on quantity of pet selected, will loop as long as user enter wrong quantity
                    {
                        Console.WriteLine($"How many would you like to take home?");
                        if (int.TryParse(Console.ReadLine(), out enteredQuantity) &&
                            enteredQuantity <= userPickedItemInventory &&
                            enteredQuantity > 0)                                                  //check if user entered quantity is a number, below the store inventory, and above 0
                        {
                            newInventory             = userPickedItemInventory - enteredQuantity; //store the updated inventory of pet after purchase
                            loopConditionForQuantity = false;                                     //leave the input validation loop
                        }
                        else
                        {
                            Console.WriteLine("The entered amount exceeds or is " +
                                              "not a valid input in our store inventory, please try again."); //restart the while loop because the conditional 'loopConditionForQuantity' is still true
                        }
                    }
                    var currentUser1    = db.UserInfos.ToList().Find(x => x.userName == UserLogin._userName);            //stores current user info
                    var currentItem     = db.StoreItems.ToList().Find(x => x.StoreItemId == userPickedItem.StoreItemId); //stores current item id
                    var currentLocation = db.StoreItems.Include(x => x.StoreLocation).ToList()
                                          .Find(x => x.StoreItemId == userPickedItem.StoreItemId).StoreLocation;         //stores current store location

                    if (ifDoesntExist)                                                                                   //if statement to create user order only once. once created bool value are assigned negative.
                    {
                        UserOrder userOrder = new UserOrder                                                              //create a new order
                        {
                            StoreLocation = currentLocation,
                            UserInfo      = currentUser1, //store current user information
                            timeStamp     = DateTime.Now  //store time stamp of this new order
                        };
                        db.Add(userOrder);                //add a user order entity to the database, this needs to be added first before the latter two due to FK restrictions
                        db.SaveChanges();
                        ifDoesntExist = false;
                    }
                    var           currentUserOrder = db.UserOrders.ToList().Last(); //store the current order id
                    UserOrderItem userOrderItem    = new UserOrderItem              //create a new item order obj
                    {
                        StoreItem = currentItem,
                        UserOrder = currentUserOrder
                    };
                    db.Add(userOrderItem);                                      //add a user order item entity to the database

                    UserOrderQuantity userOrderQuantity = new UserOrderQuantity //create a new user order quantity obj
                    {
                        UserOrder     = currentUserOrder,
                        StoreItem     = currentItem,
                        orderQuantity = enteredQuantity
                    };
                    db.Add(userOrderQuantity);                    //add a user order quantity entity to the database

                    var updateInventory = db.StoreItemInventories //selects the user chosen item inventory
                                          .First(x => x.StoreItemInventoryId == userPickedItem.StoreItemInventory.StoreItemInventoryId);
                    updateInventory.itemInventory = newInventory; //update the new store inventory of pet in database
                    db.SaveChanges();

                    Console.WriteLine("Would you like to bring home another pet? Please select Y/N");
                    string yesNo = Console.ReadLine();
                    if (yesNo == "Y" || yesNo == "y")    //if statement to return back to the beginning while statement.
                    {
                        loopConditionForQuantity = true; //allow console to prompt for item quantity again
                        continue;
                    }
                    else
                    {
                        anotherBuy = false; //exits the main 'anotherBuy' while loop
                    }
                }
                MainNavigation test7 = new MainNavigation();
                test7.WhereToNavigation();
            }
        }