/// <summary> /// Set all the toolbar items required for a submitted time entry. /// </summary> private void setSubmittedEntryToolbarItems() { if (ViewModel.IsSubmitted()) { // Recall command. recallTimeCommand = ToolbarHelper.createRecallButton(); recallTimeCommand.Command = new RelayCommandAsync(async() => { // Since the toolbar items cannot be disabled, disable the action if // there is already an action going on in the view model. if (!this.ViewModel.IsBusy) { // No need to disable controls here since this control exists only for non-editable entries. this.ViewModel.IsBusy = true; // If recall finishes correctly, stay on the page since the user probably wants to edit the record. if (await this.ViewModel.Recall()) { this.setEditabilityOfControls(ViewModel.CanEdit()); this.setEditableEntryToolbarItems(); ViewModel.HasPendingDataToSave = false; // This needs to be manually changed here because the status has changed. } else { await MessageCenter.ShowErrorMessage(AppResources.RecallError); } this.ViewModel.IsBusy = false; } }); this.ToolbarItems.Add(recallTimeCommand); } }
private void addRecallTimeEntryButton() { if (null == recallButton) { recallButton = ToolbarHelper.createRecallButton(); recallButton.Clicked += RecallButton_Clicked; } this.ToolbarItems.Add(recallButton); }