private void ViewSwitchGroup_CheckedChanged(object sender, EventArgs e) { var group = sender as ItemIdHolderRadioGroup; ItemHolderRadioButton selectedButton = group.GetSelected(); if (selectedButton.Text.Equals("Aanvallen")) { viewFlipper.DisplayedChild = viewFlipper.IndexOfChild(viewFlipper.FindViewById(Resource.Id.attacksList)); SetAttacksView(); } else { viewFlipper.DisplayedChild = viewFlipper.IndexOfChild(viewFlipper.FindViewById(Resource.Id.overView)); LoadStats(); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment View view = inflater.Inflate(Resource.Layout.statistic_game_view, container, false); myViewModel = new GameStatisticViewModel(DbManager.Instance); Button shotclockButton = view.FindViewById <Button>(Resource.Id.shotclockButton); Button turnoverButton = view.FindViewById <Button>(Resource.Id.turnoverButton); Button shotButton = view.FindViewById <Button>(Resource.Id.shotButton); Button goalButton = view.FindViewById <Button>(Resource.Id.goalButton); TextView homeTeam = view.FindViewById <TextView>(Resource.Id.homeTeamText); TextView awayTeam = view.FindViewById <TextView>(Resource.Id.awayTeamText); homeTeam.Text = myViewModel.HomeTeam; awayTeam.Text = myViewModel.AwayTeam; shotButton.Click += ShotButton_Click; turnoverButton.Click += TurnoverButton_Click; shotclockButton.Click += ShotclockButton_Click; goalButton.Click += GoalButton_Click; cardViewLeft = view.FindViewById <CardView>(Resource.Id.statCardLeft); cardViewRight = view.FindViewById <CardView>(Resource.Id.statCardRight); view.FindViewById <ImageButton>(Resource.Id.returnButton).Click += ReturnButton_Click; statInputSwitcher = view.FindViewById <LinearLayout>(Resource.Id.statsInput).FindViewById <ViewFlipper>(Resource.Id.viewSwitcher1); view.FindViewById <LinearLayout>(Resource.Id.statsInput).FindViewById <Button>(Resource.Id.backButton).Click += BackButton_Clicked;; view.FindViewById <LinearLayout>(Resource.Id.statsInput).FindViewById <Button>(Resource.Id.cancelButton).Click += CancelButtonClicked; okButton = view.FindViewById <LinearLayout>(Resource.Id.statsInput).FindViewById <Button>(Resource.Id.okButton); okButton.Click += StatsInput_OkButton_Clicked; myViewModel.PropertyChanged += MyViewModel_PropertyChanged; statButtonLayout = statInputSwitcher.FindViewById <LinearLayout>(Resource.Id.buttonLayout); actionButtonLayout = view.FindViewById <LinearLayout>(Resource.Id.statsInput).FindViewById <LinearLayout>(Resource.Id.actionButtons); okButton.Visibility = ViewStates.Gone; statInputSwitcher.FindViewById(Resource.Id.four4Choice).FindViewById <MultiLineRadioGroup>(Resource.Id.radioGroup1).CheckedChanged += GameStatisticsActivity_CheckedChanged; statInputSwitcher.FindViewById(Resource.Id.twoChoice).FindViewById <ItemIdHolderRadioGroup>(Resource.Id.radioGroup1).CheckedChange += RadioButtonGroup_CheckedChange; statInputSwitcher.FindViewById(Resource.Id.goaltype).FindViewById <MultiLineRadioGroup>(Resource.Id.radioGroup1).CheckedChanged += GameStatisticsActivity_CheckedChanged; myGameStatus = view.FindViewById <TextView>(Resource.Id.gameStatus); myGameStatus.Text = myViewModel.GameStatus; myEndHalfButton = view.FindViewById <Button>(Resource.Id.endHalfButton); myEndHalfButton.Click += EndHalfButton_Clicked; myCurrentPlayersLayout = view.FindViewById <SquaredTextViewLayout>(Resource.Id.currentPlayersLayout); myHomeScoreTextView = view.FindViewById <TextView>(Resource.Id.homeTeamScore); myAwayScoreTextView = view.FindViewById <TextView>(Resource.Id.awayTeamScore); view.FindViewById(Resource.Id.bottomBar).FindViewById <ImageButton>(Resource.Id.rightActionButton).Click += Bottom_RightButtonClicked; view.FindViewById(Resource.Id.bottomBar).FindViewById <ImageButton>(Resource.Id.undoButton).Click += UndoButton_Clicked; view.FindViewById(Resource.Id.bottomBar).FindViewById <ImageButton>(Resource.Id.leftActionButton).Click += LeftActionButton_Clicked; view.FindViewById(Resource.Id.bottomBar).FindViewById <ImageButton>(Resource.Id.leftActionButton).SetImageDrawable(Context.GetDrawable(Resource.Drawable.ic_playerchange_48px)); // view.FindViewById(Resource.Id.bottomBar).FindViewById<ImageButton>(Resource.Id.redoButton).Click += (e, args) => myViewModel.Redo(); myViewModel.Init(); return(view); // return base.OnCreateView(inflater, container, savedInstanceState); }
private void CancelButtonClicked(object sender, EventArgs e) { statInputSwitcher.DisplayedChild = statInputSwitcher.IndexOfChild(statInputSwitcher.FindViewById <LinearLayout>(Resource.Id.buttonLayout)); actionButtonLayout.Visibility = ViewStates.Gone; myViewModel.RemoveCommand(); }