public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.TimerDialog, container, false); TextView timeLeftField = view.FindViewById <TextView>(Resource.Id.timeLeft); Button startButton = view.FindViewById <Button>(Resource.Id.TimerStartButton); Button cancelButton = view.FindViewById <Button>(Resource.Id.CancelButton); var timer = new JumpTimer(timeLeftField, context); bool isStarted = false; startButton.Click += delegate { if (isStarted) { timer.Cancel(); startButton.Text = "Start"; timer.initTime(); } else { timer.Start(); startButton.Text = "Reset"; } isStarted = !isStarted; }; cancelButton.Click += delegate { timer.Cancel(); Dismiss(); }; return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) { View view = inflater.Inflate(Resource.Layout.JumpNotes, container, false); view.FindViewById <TextView>(Resource.Id.jumpCommentsIntro).Text = string.Join(GetString(Resource.String.JumpSeparator), jump); ExpandableListView listOutput = view.FindViewById <ExpandableListView>(Resource.Id.jumpNotesListView); var adapter = new FormationsWithNotesAdapter(this.Activity, listOutput, FSNotesHandler.Notes, this.jump, null, true); listOutput.SetAdapter(adapter); for (int i = 0; i < adapter.GroupCount; i++) { listOutput.ExpandGroup(i); } TextView timeLeftField = view.FindViewById <TextView>(Resource.Id.jumpTimeLeft); Button jumpTimerOperButton = view.FindViewById <Button>(Resource.Id.jumpTimerOperButton); var timer = new JumpTimer(timeLeftField, context); timeLeftField.Text = timer.formatRemainingTime(FSNotesHandler.JUMPTIME_MS / 1000); bool isStarted = false; //muuta nappi taustaltaa värikkääskis!!!! jumpTimerOperButton.Click += delegate { if (isStarted) { timer.Cancel(); jumpTimerOperButton.Text = "Start timer"; timer.initTime(); } else { timer.Start(); jumpTimerOperButton.Text = "Stop timer"; } isStarted = !isStarted; }; return(view); }