示例#1
0
        //Sets up Match Setting UI
        public MatchSettingsPage()
        {
            InitializeComponent();

            //Gets checkout list before it is needed in the matchpage so the user can use the calculator as soon as they hit start match
            Task getMongoData = Task.Factory.StartNew(() =>
            {
                try
                {
                    MongoService mongoservice = new MongoService();
                    checkouts = mongoservice.GetAllData();
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e.StackTrace);
                }
            });

            NavigationPage.SetHasNavigationBar(this, false);

            toolbarStk.BackgroundColor   = Color.FromHex("#3f7247");
            toolbarStk.HeightRequest     = 55;
            toolbarStk.HorizontalOptions = LayoutOptions.FillAndExpand;

            bar.Text = "Match Settings";
            bar.HorizontalTextAlignment = TextAlignment.Start;
            bar.Margin         = 15;
            bar.TextColor      = Color.White;
            bar.FontSize       = 18;
            bar.FontAttributes = FontAttributes.Bold;

            settingsGrd.Padding = 10;

            Label l1 = new Label()
            {
                Text = "Player 1 Name: ",
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Center,
                FontSize          = 15,
                FontAttributes    = FontAttributes.Bold
            };

            Label l2 = new Label()
            {
                Text = "Player 2 Name: ",
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Center,
                FontSize          = 15,
                FontAttributes    = FontAttributes.Bold
            };

            Label l3 = new Label()
            {
                Text = "Start Score: ",
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Center,
                FontSize          = 15,
                FontAttributes    = FontAttributes.Bold
            };

            Label l4 = new Label()
            {
                Text = "Number of Sets: ",
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Center,
                FontSize          = 15,
                FontAttributes    = FontAttributes.Bold
            };

            player1 = new Entry()
            {
                Placeholder       = "Player 1",
                WidthRequest      = 200,
                HeightRequest     = 40,
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Center
            };

            player2 = new Entry()
            {
                Placeholder       = "Player 2",
                WidthRequest      = 200,
                HeightRequest     = 40,
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Center
            };

            testStartScore = new Entry()
            {
                Placeholder       = "301 OR 501 OR 701",
                WidthRequest      = 200,
                HeightRequest     = 40,
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Center
            };

            setNumber = new Entry()
            {
                Placeholder       = "(3 legs in a set)",
                WidthRequest      = 200,
                HeightRequest     = 40,
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Center
            };

            Button startBtn = new Button()
            {
                Text            = "Start new Game",
                HeightRequest   = 50,
                BackgroundColor = Color.FromHex("#e2e2e2")
            };

            startBtn.Clicked += StartBtn_Clicked;

            settingsGrd.Children.Add(l1, 0, 0);
            settingsGrd.Children.Add(l2, 0, 1);
            settingsGrd.Children.Add(l3, 0, 2);
            settingsGrd.Children.Add(l4, 0, 3);
            settingsGrd.Children.Add(player1, 0, 0);
            settingsGrd.Children.Add(player2, 0, 1);
            settingsGrd.Children.Add(testStartScore, 0, 2);
            settingsGrd.Children.Add(setNumber, 0, 3);
            settingsGrd.Children.Add(startBtn, 0, 4);
        }
示例#2
0
 //Gets Game Stats from Mongo
 public void getMongoData()
 {
     MongoService ms = new MongoService();
     var          x  = ms.GetAllStats();
 }