public AutoCompleteTest() { getTeamList(); list.ItemTemplate = new DataTemplate(() => { var teamNumber = new Label(); teamNumber.SetBinding(Label.TextProperty, "teamNumber"); return(new ViewCell() { View = new StackLayout() { Children = { teamNumber } } }); }); list.ItemSelected += (sender, e) => { list.IsVisible = false; entryTest.Text = ((TeamData)list.SelectedItem).teamNumber.ToString(); }; entryTest.TextChanged += (sender, e) => { if (semaphore) { autoCompleteOptions(); } else { semaphore = true; } }; var listScroll = new ScrollView() { Content = list }; list.IsVisible = false; var navigationBtns = new NavigationButtons(false); Content = new StackLayout() { HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, Children = { entryTest, list, navigationBtns } }; }
public MatchScheduleIndexPage() { Title = "Match List"; lists = new MatchHeaderLists(); UpdateMatchSchedule(); var navigationBtns = new NavigationButtons(true); navigationBtns.refreshBtn.Clicked += (object sender, EventArgs e) => { UpdateMatchSchedule(); }; this.Appearing += (object sender, EventArgs e) => { UpdateMatchSchedule(); }; this.Content = new StackLayout() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.End, Children = { busyIcon, new StackLayout() { VerticalOptions = LayoutOptions.Start, Children = { lists } }, new StackLayout() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.End, Children = { navigationBtns } } } }; BackgroundColor = Color.White; }
public TestPage() { var list = new CollapsibleListContainer(); var group1 = new CollapsibleList("Pit Scouting Data"); group1.addData(new PitData() { dataHeader = "Data Header", data = "data" }); group1.addData(new PitData() { dataHeader = "Data Header", data = "data" }); group1.addData(new PitData() { dataHeader = "Data Header", data = "data" }); var group2 = new CollapsibleList("Match Scouting Data"); group2.addData(new PitData() { dataHeader = "Data Header", data = "data" }); group2.addData(new PitData() { dataHeader = "Data Header", data = "data" }); group2.addData(new PitData() { dataHeader = "Data Header", data = "data" }); list.AddList(group1); list.AddList(group2); var navigationBtns = new NavigationButtons(); layoutTest.Children.Add(list, 0, 2, 0, 1); layoutTest.Children.Add(navigationBtns, 0, 2, 1, 2); Content = layoutTest; }
public AutoCompleteTest() { getTeamList(); var navigationBtns = new NavigationButtons(false); Content = new StackLayout() { HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, Children = { entryTest, autoComplete, navigationBtns } }; }
public DataAnalysisPage() { Title = "Data Analysis"; var navigationBtns = new NavigationButtons(true); //, {} ); Content = new StackLayout() { HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, Children = { dataGrid, navigationBtns } }; }
public PreMatchScoutingPage(string scouterName) { //Page Title Title = "Match Scouting"; if (!string.IsNullOrEmpty(scouts.scouterName)) { scouts.lineEntry.Text = scouterName; matchNoLineEntry.inputEntry.Text = ""; matchNumber = ""; } var checkBoxLayout = new StackLayout() { HorizontalOptions = LayoutOptions.CenterAndExpand, Orientation = StackOrientation.Horizontal }; for (int i = 0; i < matchPhaseCheckboxes.Length; i++) { matchPhaseCheckboxes[i] = new CheckBox() { DefaultText = matchPhase[i], FontSize = GlobalVariables.sizeSmall } } ; foreach (var box in matchPhaseCheckboxes) { box.CheckedChanged += (sender, e) => { if (!semaphore) { checkBoxChanged(box); } }; checkBoxLayout.Children.Add(box); } getDefaultMatchType(); setNoLbl = new Label { Text = "Set Number:", FontSize = GlobalVariables.sizeSmall, FontAttributes = FontAttributes.Bold, }; setNoPicker.Title = "[Select Set No.]"; setNoPicker.SelectedIndexChanged += (sender, e) => { try { setNumber = Convert.ToInt32(setNoPicker.Items[setNoPicker.SelectedIndex]); } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); } setMatchNumber(); }; matchNoLineEntry = new LineEntry("Match Number:"); matchNoLineEntry.inputEntry.Keyboard = Keyboard.Numeric; matchNoLineEntry.inputEntry.TextChanged += (sender, e) => { setMatchNumber(); }; matchNoLayout = new StackLayout() { Orientation = StackOrientation.Horizontal, Spacing = 10, Children = { new StackLayout() { Children = { setNoLbl, setNoPicker } }, matchNoLineEntry } }; matchNoView = new ContentView() { Content = matchNoLineEntry }; Label allianceLabel = new Label { Text = "Alliance:", FontSize = GlobalVariables.sizeSmall, FontAttributes = FontAttributes.Bold }; alliancePicker = new Picker(); alliancePicker.Title = "[Choose an Option]"; foreach (var i in alliances) { alliancePicker.Items.Add(i); } alliancePicker.SelectedIndexChanged += (sender, e) => { setMatchNumber(); }; var teamNoLbl = new Label { Text = "Team Number:", FontSize = GlobalVariables.sizeSmall, FontAttributes = FontAttributes.Bold }; teamNoPicker = new Picker(); teamNoPicker.Title = "[Select Match No. and Alliance first]"; teamNoPicker.SelectedIndexChanged += (sender, e) => { try { teamNumber = Convert.ToInt32(teamNoPicker.Items[teamNoPicker.SelectedIndex]); } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); } }; teamNoPickerLayout = new StackLayout() { Children = { teamNoLbl, teamNoPicker } }; teamNoView = new ContentView() { Content = teamNoPickerLayout }; teamNoLineEntry = new LineEntry("Team Number:"); teamNoLineEntry.inputEntry.Placeholder = "[Enter Team Number]"; teamNoLineEntry.inputEntry.Keyboard = Keyboard.Numeric; teamNoLineEntry.inputEntry.TextChanged += (sender, e) => { try { teamNumber = Convert.ToInt32(teamNoLineEntry.data); } catch { teamNumber = 0; } }; Label positionLabel = new Label { Text = "Starting Position:", FontSize = GlobalVariables.sizeSmall, FontAttributes = FontAttributes.Bold }; positionPicker = new Picker(); positionPicker.Title = "Choose an Option"; foreach (var i in startPos) { positionPicker.Items.Add(i); } positionPicker.SelectedIndexChanged += (sender, e) => { positionPicker.Title = positionPicker.Items[positionPicker.SelectedIndex]; }; var beginMatchBtn = new Button() { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, Text = "Begin Match", TextColor = Color.Green, BackgroundColor = Color.Black, FontSize = GlobalVariables.sizeMedium }; beginMatchBtn.Clicked += (sender, e) => { bool inputFlag = false; if (string.IsNullOrEmpty(scouts.lineEntry.Text)) { inputFlag = true; } if (string.IsNullOrEmpty(matchNoLineEntry.inputEntry.Text)) { inputFlag = true; } if ((teamNoPicker.SelectedIndex == -1 && (competitionPhase == "F" || competitionPhase == "QM")) || (teamNoPicker.SelectedIndex == -1 && setNoPicker.SelectedIndex == -1 && (competitionPhase == "QF" || competitionPhase == "SF")) || (string.IsNullOrEmpty(teamNoLineEntry.inputEntry.Text) && competitionPhase == "P")) { inputFlag = true; } if (positionPicker.SelectedIndex == -1 || alliancePicker.SelectedIndex == -1 || inputFlag) { DisplayAlert("Error", "Fill out all inputs", "OK"); } else { initializeTeamData(); } }; var navigationBtns = new NavigationButtons(false, new Button[] { beginMatchBtn }); navigationBtns.backBtn.Clicked += (sender, e) => { Navigation.PopModalAsync(); }; var pageLayout = new StackLayout() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Children = { busyIcon, scouts, checkBoxLayout, matchNoView, allianceLabel, alliancePicker, teamNoView, positionLabel, positionPicker } }; var dataScroll = new ScrollView() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Content = pageLayout }; var grid = new Grid() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition { Height = GridLength.Star }, new RowDefinition { Height = GridLength.Auto } } }; grid.Children.Add(dataScroll, 0, 0); grid.Children.Add(navigationBtns, 0, 1); Content = grid; } async Task getDefaultMatchType() { if (CheckInternetConnectivity.InternetStatus()) { var db = new FirebaseClient(GlobalVariables.firebaseURL); var phaseGet = await db .Child(GlobalVariables.regionalPointer) .Child("competitionPhase") .OnceSingleAsync <string>(); int i = 0; foreach (var phase in matchPhase) { if (phase == phaseGet) { break; } i++; } checkBoxChanged(matchPhaseCheckboxes[i]); } } void checkBoxChanged(CheckBox c) { semaphore = true; for (int i = 0; i < matchPhaseCheckboxes.Length; i++) { if (matchPhaseCheckboxes[i] != c) { matchPhaseCheckboxes[i].Checked = false; } else { matchPhaseCheckboxes[i].Checked = true; competitionPhase = matchPhase[i]; } } setMatchTeamNumberLayout(); if (competitionPhase != "QF" || competitionPhase != "SF") { teamNoPicker.Items.Clear(); teamNoPicker.SelectedIndex = -1; teamNoPicker.Title = "[Select A Team]"; } else { setMatchNumber(); } semaphore = false; } void setMatchTeamNumberLayout() { if (competitionPhase == "P") { teamNoView.Content = teamNoLineEntry; matchNoLayout.Children.Remove(matchNoLineEntry); } else { teamNoView.Content = teamNoPickerLayout; if (competitionPhase == "QM" || competitionPhase == "F") { matchNoView.Content = matchNoLineEntry; matchNoLayout.Children.Remove(matchNoLineEntry); } else { matchNoView.Content = matchNoLayout; matchNoLayout.Children.Add(matchNoLineEntry); setNoPicker.Items.Clear(); int items = 0; if (competitionPhase == "QF") { items = 4; } else { items = 2; } for (int i = 1; i <= items; i++) { setNoPicker.Items.Add(i.ToString()); } } } } async Task setMatchNumber() { if (competitionPhase == "QF" || competitionPhase == "SF") { matchNumber = competitionPhase + (setNoPicker.SelectedIndex + 1) + "M" + matchNoLineEntry.inputEntry.Text; } else if (competitionPhase == "F") { matchNumber = competitionPhase + matchNoLineEntry.inputEntry.Text; } else { matchNumber = competitionPhase + (Convert.ToInt64(matchNoLineEntry.inputEntry.Text) < 10 ? "0" + matchNoLineEntry.inputEntry.Text : matchNoLineEntry.inputEntry.Text); } if (!matchPhaseCheckboxes[0].Checked) { await getTeamNoPickerOptions(); } } async Task getTeamNoPickerOptions() { if (CheckInternetConnectivity.InternetStatus()) { try { busyIcon.IsVisible = true; busyIcon.IsRunning = true; var db = new FirebaseClient(GlobalVariables.firebaseURL); EventMatchData matchGet = new EventMatchData(); matchGet = await db .Child(GlobalVariables.regionalPointer) .Child("matchList") .Child(matchNumber.ToString()) .OnceSingleAsync <EventMatchData>(); Console.WriteLine("Match: " + matchNoLineEntry.inputEntry.Text + " , Alliance: " + alliancePicker.Items[alliancePicker.SelectedIndex]); teamNoPicker.Items.Clear(); if (string.IsNullOrEmpty(matchGet.matchNumber)) { teamNoPicker.Title = "[Select Match No. and Alliance first]"; } else { teamNoPicker.Title = "[Select A Team]"; if (alliancePicker.SelectedIndex == 0) { foreach (var item in matchGet.Red) { teamNoPicker.Items.Add(item.ToString()); } } else if (alliancePicker.SelectedIndex == 1) { foreach (var item in matchGet.Blue) { teamNoPicker.Items.Add(item.ToString()); } } } busyIcon.IsVisible = false; busyIcon.IsRunning = false; } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } } } async Task initializeTeamData() { busyIcon.IsVisible = true; busyIcon.IsRunning = true; int matchType = 0; matchData.scouterName = scouts.lineEntry.Text;; matchData.matchNumber = matchNumber; matchData.teamNumber = teamNumber; matchData.matchID = teamNumber + "-" + matchNumber; matchData.alliance = alliancePicker.Items[alliancePicker.SelectedIndex]; matchData.startPos = positionPicker.Items[positionPicker.SelectedIndex]; if (CheckInternetConnectivity.InternetStatus()) { bool test = true; var db = new FirebaseClient(GlobalVariables.firebaseURL); string path = "NULL"; if (competitionPhase != "P") { path = "matchData/" + matchData.matchID; matchType = 0; } else { path = "practiceMatchData/" + matchData.matchID; matchType = -1; } if (await FirebaseAccess.checkExistingMatchData(db, path)) { if (!await DisplayAlert("Error", "Match Data already exists for this team-match. Do you want to overwrite it?", "OK", "Cancel")) { test = false; } } if (test) { FirebaseAccess.saveData(db, path, matchData); await Navigation.PushModalAsync(new AutoMatchScoutingPage(matchData, matchType)); } /* * if (checkValue == 1) { * * var dataCheck = await db * .Child(GlobalVariables.regionalPointer) * .Child("teamMatchData") * .Child(matchData.teamNumber.ToString()) * .Child(matchData.matchNumber) * .OnceSingleAsync<TeamMatchData>(); * * if (dataCheck != null) * if (!await DisplayAlert("Error", "Match Data already exists for this team. Do you want to overwrite it?", "OK", "Cancel")) * test = false; * * if(test){ * var send = db * .Child(GlobalVariables.regionalPointer) * .Child("teamMatchData") * .Child(matchData.teamNumber.ToString()) * .Child(matchData.matchNumber) * .PutAsync(matchData); * * matchType = 0; * * await Navigation.PushAsync(new AutoMatchScoutingPage(matchData, matchType)); * } * } else { * var dataCheck = await db * .Child(GlobalVariables.regionalPointer) * .Child("PracticeMatches") * .Child(matchData.teamNumber.ToString()) * .Child(matchData.matchNumber) * .OnceSingleAsync<TeamMatchData>(); * * if (dataCheck != null) * if (!await DisplayAlert("Error", "Match Data already exists for this team. Do you want to overwrite it?", "OK", "Cancel")) * test = false; * * if(test) { * var send = db * .Child(GlobalVariables.regionalPointer) * .Child("PracticeMatches") * .Child(matchData.teamNumber.ToString()) * .Child(matchData.matchNumber) * .PutAsync(matchData); * * matchType = -1; * * await Navigation.PushAsync(new AutoMatchScoutingPage(matchData, matchType)); * } * * } */ } busyIcon.IsVisible = false; busyIcon.IsRunning = false; } }
public RobotInfoIndexPage() { Title = "Robot Info"; searchBar = new Grid() { HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, ColumnSpacing = 0, RowSpacing = 0, ColumnDefinitions = { new ColumnDefinition() { Width = GridLength.Auto }, new ColumnDefinition() { Width = GridLength.Star }, new ColumnDefinition() { Width = GridLength.Auto }, new ColumnDefinition() { Width = 5 }, }, RowDefinitions = { new RowDefinition() { Height = GridLength.Auto } } }; searchEntry = new Entry() { Placeholder = "Search team", MinimumWidthRequest = Width, FontSize = GlobalVariables.sizeMedium }; searchEntry.TextChanged += (sender, e) => { autoCompleteOptions(); searchCancel.IsVisible = true; searchCancel.IsEnabled = true; if (string.IsNullOrEmpty(searchEntry.Text)) { searchEntry.Text = ""; searchEntry.Placeholder = "Search team"; searchCancel.IsVisible = false; searchCancel.IsEnabled = false; } }; searchCancel = new Label() { VerticalOptions = LayoutOptions.CenterAndExpand, Text = "x", FontSize = GlobalVariables.sizeTitle, TextColor = searchEntry.PlaceholderColor, IsVisible = false, IsEnabled = false, }; var tap = new TapGestureRecognizer(); tap.Tapped += (sender, e) => { searchEntry.Text = ""; }; var searchCell = new ContentView() { Content = searchCancel }; searchCell.GestureRecognizers.Add(tap); searchBar.Children.Add(searchEntry, 1, 0); searchBar.Children.Add(searchCell, 2, 0); teamListView.MinimumHeightRequest = Height; teamListView.ItemTemplate = new DataTemplate(() => { var teamNumber = new Label() { TextColor = Color.Black, FontSize = GlobalVariables.sizeMedium, VerticalOptions = LayoutOptions.CenterAndExpand }; teamNumber.SetBinding(Label.TextProperty, "teamNumber"); var cell = new ViewCell() { View = new StackLayout() { BackgroundColor = Color.White, Children = { teamNumber } } }; return(cell); }); teamListView.ItemSelected += (sender, e) => { ((ListView)sender).SelectedItem = null; }; teamListView.ItemTapped += (sender, e) => { Navigation.PushPopupAsync(new TeamCardPopupPage((TeamData)e.Item)); }; var navigationBtns = new NavigationButtons(true); navigationBtns.refreshBtn.Clicked += (object sender, EventArgs e) => { updateMatchLists(); }; this.Content = new StackLayout() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Spacing = 1, Children = { busyIcon, searchBar, teamListView, navigationBtns } }; BackgroundColor = Color.White; }
public AdminPage() { Title = "Admin Page"; var updateMatchListBtn = new Button() { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, Text = "Update Match List", TextColor = Color.Green, BackgroundColor = Color.Black, FontSize = GlobalVariables.sizeMedium }; updateMatchListBtn.Clicked += (sender, e) => { UpdateMatchList(); }; var updateTeamListBtn = new Button() { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, Text = "Update Team List", TextColor = Color.Green, BackgroundColor = Color.Black, FontSize = GlobalVariables.sizeMedium }; updateTeamListBtn.Clicked += (sender, e) => { UpdateTeamList(); }; var eventStatTestBtn = new Button() { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, Text = "Test OPR Grab", TextColor = Color.Green, BackgroundColor = Color.Black, FontSize = GlobalVariables.sizeMedium }; eventStatTestBtn.Clicked += (sender, e) => { //getEventStats(); }; var updateTeamStats = new LineEntry("Update Single Team Stats"); updateTeamStats.inputEntry.Placeholder = "Enter Team No."; updateTeamStats.inputEntry.Keyboard = Keyboard.Numeric; var singleTeamStatUpdateBtn = new Button() { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, Text = "Update", TextColor = Color.Green, BackgroundColor = Color.Black, FontSize = GlobalVariables.sizeMedium }; singleTeamStatUpdateBtn.Clicked += (sender, e) => { //updateAvgTeamData(Convert.ToInt32(updateTeamStats.data), true); }; var singleTeamStatUpdateView = new StackLayout() { HorizontalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Horizontal, Spacing = 1, Children = { updateTeamStats, singleTeamStatUpdateBtn } }; var allTeamStatUpdateBtn = new Button() { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, Text = "Update All Team Stats", TextColor = Color.Green, BackgroundColor = Color.Black, FontSize = GlobalVariables.sizeMedium }; allTeamStatUpdateBtn.Clicked += (sender, e) => { //allTeamsStatsUpdateGrab(); }; var addMatchBtn = new Button() { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, Text = "Add Match", TextColor = Color.Green, BackgroundColor = Color.Black, FontSize = GlobalVariables.sizeMedium }; addMatchBtn.Clicked += (sender, e) => { Navigation.PushPopupAsync(new AddMatchPopupPage()); }; var updateTeamOPRS = new Button() { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, Text = "Update OPRS", TextColor = Color.Green, BackgroundColor = Color.Black, FontSize = GlobalVariables.sizeMedium }; updateTeamOPRS.Clicked += (sender, e) => { getEventOprs(); }; var logoutBtn = new Button() { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, Text = "Logout", TextColor = Color.Green, BackgroundColor = Color.Black, FontSize = GlobalVariables.sizeMedium }; logoutBtn.Clicked += (sender, e) => { logout(); }; Button[] btnArray = { logoutBtn }; var navigationBtns = new NavigationButtons(false, btnArray); Content = new StackLayout() { Children = { busyIcon, new ScrollView() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Content = new StackLayout() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Children = { updateTeamListBtn, updateMatchListBtn, //ingleTeamStatUpdateView, //allTeamStatUpdateBtn, addMatchBtn, updateTeamOPRS //eventStatTestBtn, } } }, navigationBtns } }; }