/// ------------------------------------------------------------------------------------------------ /// Name CancelClick /// /// <summary> Executed when the cancel button is clicked. /// </summary> /// <remarks> /// </remarks> /// ------------------------------------------------------------------------------------------------ private async Task CancelClick(object sender, EventArgs e) { try { Lbl_Cancel.IsVisible = Lbl_Cancel.IsEnabled = Boxvw_Cancel.IsVisible = Boxvw_Cancel.IsEnabled = false; PageNavigation.PopMainPage(); //Application.Current.MainPage = SplitView.VisitActionsInstace; } catch (Exception ex) { LogTracking.LogTrace(ex.ToString()); } }
/// /// ------------------------------------------------------------------------------------------------ /// Name Cancel /// ------------------------------------------------------------------------------------------------ /// /// <summary> Set selected Action in property model to null /// Back to previous page /// </summary> /// ------------------------------------------------------------------------------------------------ /// private void Cancel() { try { //await SplitView.Instace().Navigation.PopModalAsync(); PageNavigation.PopMainPage(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); LogTracking.LogTrace(ex.ToString()); } }
/// ------------------------------------------------------------------------------------------------ /// Name SaveClick /// /// <summary> Executed when the save button is clicked. /// </summary> /// <remarks> /// </remarks> /// ------------------------------------------------------------------------------------------------ private async Task SaveClick(object sender, EventArgs e) { try { if (_isExecute) { Lbl_Save.IsVisible = Lbl_Save.IsEnabled = Boxvw_Save.IsEnabled = false; _isExecute = false; var sriAction = AppData.PropertyModel.SelectedAction.Action; if (Pkr_Status.IsVisible) { if (Pkr_Status.Items[Pkr_Status.SelectedIndex] == "Completed") { sriAction.ActualDateTime = Dtp_CompletedDate.Date + Tmp_CompletedDate.Time; } else { sriAction.ActualDate = null; } } else { sriAction.ActualDateTime = Dtp_CompletedDate.Date + Tmp_CompletedDate.Time; } sriAction.Hours = AppContext.AppContext.RevertHt(Pkr_TimeTakenHours.Items[Pkr_TimeTakenHours.SelectedIndex], Pkr_TimeTakenMinutes.Items[Pkr_TimeTakenMinutes.SelectedIndex]); if (Dtp_ScheduledDate.IsVisible || Tmp_ScheduledDate.IsVisible) { sriAction.DueDate = Dtp_ScheduledDate.Date + Tmp_ScheduledDate.Time; } var officeDetails = _groupedOffice?.SelectedValue?.Split('-'); if (officeDetails == null) { if (Lbl_Officer.Text != "Value") { var officerText = Lbl_Officer.Text?.Split('-'); if (officerText != null) { string officerCode = officerText[0].Remove(officerText[0].Length - 1); sriAction.Officer = officerCode; } } } else { var officer = officeDetails[0].Remove(officeDetails[0].Length - 1); sriAction.Officer = officer; } if (VisitActionDetailsViewCell.GroupedLegislation != null) { var legislationDetails = VisitActionDetailsViewCell.GroupedLegislation?.SelectedValue?.Split('-'); if (legislationDetails != null) { var legislation = legislationDetails[0].Remove(legislationDetails[0].Length - 1); sriAction.LegislationType = legislation; } } Exception error; AppData.PropertyModel.SaveAction(out error); // AppData.PropertyModel.SaveVisit(out error); if (error == null) { //await SplitView.Instace().Navigation.PopModalAsync(); PageNavigation.PopMainPage(); // Application.Current.MainPage = SplitView.VisitActionsInstace; AppContext.AppContext.RefreshList.Invoke(sender, e); } else { throw error; } _isExecute = true; Lbl_Save.IsVisible = Lbl_Save.IsEnabled = Boxvw_Save.IsEnabled = true; } } catch (Exception ex) { LogTracking.LogTrace(ex.ToString()); } }