public async void CreateTicketCommandExecute() { if (string.IsNullOrWhiteSpace(TicketTitle)) { ServiceBus.AlertService.ShowMessageBox("Add Review", "Please fill the title of your review"); return; } if (string.IsNullOrWhiteSpace(Details)) { ServiceBus.AlertService.ShowMessageBox("Add Review", "Please fill the description of your review"); return; } if ((Date - DateTime.Now).TotalHours < 1) { ServiceBus.AlertService.ShowMessageBox("Add Review", "Please check the date of your review"); return; } if (Group == ReviewerGroup.None) { ServiceBus.AlertService.ShowMessageBox("Add Review", "Please select a category"); return; } try { var ticket = new Ticket { TitleName = TicketTitle, DateReview = Date, ReviewText = Details, GroupId = ((int)Group).ToString() }; var s = Tags.Replace(" ", ",") .Replace(",,", ",") .Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (var t in s) { ticket.ListOfTagTitles.Add(t); } await ServiceBus.ReviewerService.CreateReviewTicketAsync(ticket); NavigateBack?.Invoke(); //ShowViewModel<ReviewerViewModel>(); } catch (Exception ex) { Log.Error(ex); ServiceBus.AlertService.ShowConnectionLostMessage(); } }
/// <summary> /// Update the person with the service /// </summary> /// <returns></returns> private async Task SavePerson() { // Simplistic avoidance of duplicate calls if (this.IsBusy) { return; } // Validation if (string.IsNullOrEmpty(this.Person.FirstName) || string.IsNullOrEmpty(this.Person.LastName)) { this.NotValid = true; return; } this.IsBusy = true; try { // Save the person and navigate back if (this.Person.Id == 0) { await PersonService.AddPersonAsync(this.Person); } else { await PersonService.UpdatePersonAsync(this.Person); } NavigateBack?.Invoke(this, new EventArgs()); } catch (Exception ex) { // Placeholder error handling Debug.WriteLine(ex); } finally { IsBusy = false; } }
public static void RaiseNavigateBack() => NavigateBack?.Invoke(null, EventArgs.Empty);
/// <summary> /// Send command to navigate back /// </summary> public void GoBack() { NavigateBack?.Invoke(); }
public void BackButtonClick() { NavigateBack?.Invoke(this, null); }
public void NavigateToPreviousScreen() { NavigateBack?.Invoke(); }