public async override void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); ViewModel = await EditTimeEntryGroupViewModel.Init(TimeEntryIds.ToList()); ProjectField.TextField.Click += (sender, e) => OpenProjectListActivity(); ProjectField.Click += (sender, e) => OpenProjectListActivity(); durationBinding = this.SetBinding(() => ViewModel.Duration, () => DurationTextView.Text); startTimeBinding = this.SetBinding(() => ViewModel.StartDate, () => StartTimeEditText.Text).ConvertSourceToTarget(dateTime => dateTime.ToDeviceTimeString()); stopTimeBinding = this.SetBinding(() => ViewModel.StopDate, () => StopTimeEditText.Text).ConvertSourceToTarget(dateTime => dateTime.ToDeviceTimeString()); projectBinding = this.SetBinding(() => ViewModel.ProjectName, () => ProjectField.TextField.Text); clientBinding = this.SetBinding(() => ViewModel.ClientName, () => ProjectField.AssistViewTitle); descriptionBinding = this.SetBinding(() => ViewModel.Description, () => DescriptionField.TextField.Text, BindingMode.TwoWay); isRunningBinding = this.SetBinding(() => ViewModel.IsRunning).WhenSourceChanges(() => { StopTimeEditText.Visibility = ViewModel.IsRunning ? ViewStates.Gone : ViewStates.Visible; stopTimeEditLabel.Visibility = ViewModel.IsRunning ? ViewStates.Gone : ViewStates.Visible; }); var settingsStore = ServiceContainer.Resolve <SettingsStore> (); if (settingsStore.ChooseProjectForNew && LogTimeEntriesListFragment.NewTimeEntry) { OpenProjectListActivity(); } else if (LogTimeEntriesListFragment.NewTimeEntry) { DescriptionField.RequestFocus(); ((EditTimeEntryActivity)Activity).ShowSoftKeyboard(DescriptionField.TextField, false); LogTimeEntriesListFragment.NewTimeEntry = false; } else { DescriptionField.ClearFocus(); } // Set adapter using Mvvm light utils. timeEntriesListView.Adapter = ViewModel.TimeEntryCollection.GetAdapter(GetTimeEntryView); timeEntriesListView.ItemClick += (sender, e) => HandleTimeEntryClick(ViewModel.TimeEntryCollection [e.Position]); }
public async override void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); ViewModel = await EditTimeEntryGroupViewModel.Init(TimeEntryIds.ToList()); ProjectField.TextField.Click += OnProjectEditTextClick; ProjectField.Click += OnProjectEditTextClick; durationBinding = this.SetBinding(() => ViewModel.Duration, () => DurationTextView.Text); startTimeBinding = this.SetBinding(() => ViewModel.StartDate, () => StartTimeEditText.Text).ConvertSourceToTarget(dateTime => dateTime.ToDeviceTimeString()); stopTimeBinding = this.SetBinding(() => ViewModel.StopDate, () => StopTimeEditText.Text).ConvertSourceToTarget(dateTime => dateTime.ToDeviceTimeString()); projectBinding = this.SetBinding(() => ViewModel.ProjectName, () => ProjectField.TextField.Text); clientBinding = this.SetBinding(() => ViewModel.ClientName, () => ProjectField.AssistViewTitle); descriptionBinding = this.SetBinding(() => ViewModel.Description, () => DescriptionField.TextField.Text, BindingMode.TwoWay); isRunningBinding = this.SetBinding(() => ViewModel.IsRunning).WhenSourceChanges(() => { StopTimeEditText.Visibility = ViewModel.IsRunning ? ViewStates.Gone : ViewStates.Visible; stopTimeEditLabel.Visibility = ViewModel.IsRunning ? ViewStates.Gone : ViewStates.Visible; }); // Set adapter using Mvvm light utils. timeEntriesListView.Adapter = ViewModel.TimeEntryCollection.GetAdapter(GetTimeEntryView); timeEntriesListView.ItemClick += (sender, e) => HandleTimeEntryClick(ViewModel.TimeEntryCollection [e.Position]); }