///
 /// ------------------------------------------------------------------------------------------------
 /// Name		UpdateDateTime
 ///
 /// <summary>
 /// Updates the data and time for last sync.
 /// </summary>
 /// ------------------------------------------------------------------------------------------------
 ///
 public void UpdateDateTime()
 {
     try
     {
         if (AppData.LastSync.HasValue)
         {
             var time = AppData.LastSync.Value.ToString("HH:mm");
             if (AppData.LastSync.Value.Date == DateTime.Now.Date)
             {
                 Lbl_SyncDateTime.Text = string.Format("today @ {0}", time);
             }
             else if (AppData.LastSync.Value.AddDays(1).Date == DateTime.Now.Date)
             {
                 Lbl_SyncDateTime.Text = string.Format("yesterday @ {0}", time);
             }
             else if (AppData.LastSync.Value.AddDays(7).Date > DateTime.Now.Date)
             {
                 Lbl_SyncDateTime.Text = string.Format("{0} @ {1}", AppData.LastSync.Value.DayOfWeek, time);
             }
             else
             {
                 Lbl_SyncDateTime.Text = string.Format("{0} @ {1}", AppData.LastSync.Value.ToString("dd MMM"), time);
             }
         }
         else
         {
             Lbl_SyncDateTime.Text = "never";
         }
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }
        ///
        /// ------------------------------------------------------------------------------------------------
        /// Name		DrawScreen
        /// <summary>
        /// Initializes a new instance of the PopupLayouts
        /// </summary>
        /// ------------------------------------------------------------------------------------------------
        ///
        private void DrawScreen()
        {
            try
            {
                if (PopupContent == null)
                {
                    PopupContent = new PopupLayouts(Content, Instace(), PageScroll);
                    if (Device.OS != TargetPlatform.iOS)
                    {
                        Content = PopupContent;
                    }
                }

                if (CenterPopupContent == null)
                {
                    CenterPopupContent = new PopupLayouts(Content, Instace(), PageScroll);
                    if (Device.OS != TargetPlatform.iOS)
                    {
                        Content = CenterPopupContent;
                    }
                }
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Exemple #3
0
        /// ------------------------------------------------------------------------------------------------
        /// ------------------------------------------------------------------------------------------------
        #region Private Functions

        #region Get Current Location

        public async Task <Plugin.Geolocator.Abstractions.Position> GetCurrentLocation()
        {
            try
            {
                var locator = CrossGeolocator.Current;
                //locator.AllowsBackgroundUpdates = true;
                //locator.DesiredAccuracy = 50;
                _posistion = await locator.GetPositionAsync(1000);
            }

            catch (Plugin.Geolocator.Abstractions.GeolocationException geoException)
            {
                AppContext.AppContext.CurrentLocation = null;
                if (geoException.Message.Contains("Unavailable"))
                {
                    await SplitView.DisplayAlert(" GPS Disabled ", " Please enable the GPS to access your current location ", "OK", null);
                }
                if (geoException.Message.Contains("Unauthorized"))
                {
                    await SplitView.DisplayAlert("Get Device Location", " Please grant permission for this application to access your current location ", "OK", null);
                }
                _posistion = null;
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
                AppContext.AppContext.CurrentLocation = null;
            }
            return(_posistion);
        }
        /// ------------------------------------------------------------------------------------------------

        /// ------------------------------------------------------------------------------------------------
        #region Public Functions
        /// ------------------------------------------------------------------------------------------------
        ///

        /// <summary>
        /// Initialize the instance of Splitview page
        /// </summary>
        /// <returns>Current Instance of the splitview page</returns>
        ///
        public static SplitView Instace()
        {
            try
            {
                if (_instance == null)
                {
                    _instance = new SplitView();
                    if (Device.OS == TargetPlatform.Android)
                    {
                        MapView = new AndroidMapView();
                    }
                    else
                    {
                        MapView = new WindowsMapView();
                    }
                    Fullmapview = new FullMapView(MapView);

                    FullMapView();
                    _instance.PushInspectionCountView(InspectionCount = new InspectionCountView());

                    _instance.PushLeftContent(HubMaster = new HubMasterView());
                }

                NavigationPage.SetHasNavigationBar(_instance, false);

                return(_instance);
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
                return(null);
            }
        }
        ///
        /// ------------------------------------------------------------------------------------------------
        /// Name		UpdateStatus
        /// <summary>
        /// Updates the current network status of the application.
        /// </summary>
        /// ------------------------------------------------------------------------------------------------
        ///

        public void UpdateStatus()
        {
            try
            {
                switch (Reachability.InternetConnectionStatus())
                {
                case ReachabilityNetworkStatus.NotReachable:
                    SetOffLine();
                    break;

                case ReachabilityNetworkStatus.ReachableViaCarrierDataNetwork:
                    Lbl_ConnectionType.Text = "Data Connection";
                    SetOnline();
                    break;

                case ReachabilityNetworkStatus.ReachableViaWiFiNetwork:
                    Lbl_ConnectionType.Text = "Wifi";
                    SetOnline();
                    break;
                }
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Exemple #6
0
        /// <summary>
        /// List data loaded from Sriproperty
        /// </summary>
        /// <returns></returns>
        private List <RequestGroupViewModel> Lst_Load()
        {
            try
            {
                //List<RequestGroupViewModel> Lst_ReqGrpData = new List<RequestGroupViewModel>();
                foreach (SRiRequestGroup sriReqGrp in SplitView.HubMaster.LstSRiRequestGroups)
                {
                    var customHeight = SplitView.HubMaster.LstSRiRequestGroups.Count * Device.OnPlatform(65, 95, 60);
                    Main_Layout.HeightRequest = customHeight + Device.OnPlatform(70, 70, 70);
                    Main_Grid.HeightRequest   = Main_Layout.HeightRequest + 1;

                    LstReqGrpData.Add(new RequestGroupViewModel
                    {
                        GroupName      = sriReqGrp.Name,
                        TargetResponse = sriReqGrp.EarliestTargetDate.ToString("dddd dd MMM HH:mm", "", "No target date"),
                        ScheduledDate  = Schedule(sriReqGrp).ToString("dddd dd MMM HH:mm", "", "No Scheduled date"),
                        RecordCount    = sriReqGrp.Records.Count
                    });
                }
                return(LstReqGrpData);
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
                return(null);
            }
        }
Exemple #7
0
        /// ------------------------------------------------------------------------------------------------

        /// ------------------------------------------------------------------------------------------------
        #region public constructor
        public RecordSummaryView()
        {
            try
            {
                InitializeComponent();

                Lbl_TitleName.Text = AppData.PropertyModel.SelectedRecord.Record.Record.RefVal;
                OnLoad();
                TapGestures();
                //Option must not be available for new case added
                if (AppData.PropertyModel.SelectedProperty.Status == SyncStatus.New)
                {
                    Img_Add.IsVisible = Boxvw_Add.IsVisible = false;
                }

                //CheckMatchaddres += CheckMatchaddress;
                //if (Reachability.InternetConnectionStatus() != ReachabilityNetworkStatus.NotReachable &&
                //    !AppData.PropertyModel.SelectedProperty.HasValidCoords && AppData.PropertyModel.SelectedProperty.Latitude == null && AppData.PropertyModel.SelectedProperty.Longitude == null)
                //{
                //    Lbl_MatchAddress.IsVisible = true;
                //}
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Exemple #8
0
        /// ------------------------------------------------------------------------------------------------

        /// ------------------------------------------------------------------------------------------------
        #region Public functions
        /// <summary>
        /// Check the Sync
        /// </summary>
        public async void SyncCheck()
        {
            try
            {
                if (await SplitView.DisplayAlert("Sync",
                                                 "All changes saved on the device will be sent to the Uniform Cloud, any " +
                                                 "Cases with no further inspections pending will be removed and any new for the officer " +
                                                 "will be retreived.\r\nDo you wish to continue?",
                                                 "Sync Now", "Cancel"))
                {
                    if (AppContext.AppContext.LstSriproperty.Any(x => x.Status == SyncStatus.New))
                    {
                        if (await HasNoLatLong() || await HasNoUPRN())
                        {
                            return;
                        }
                        else
                        {
                            SyncBegin();
                        }
                    }
                    else
                    {
                        SyncBegin();
                    }
                }
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Exemple #9
0
 public AddNewCasePointOnMapView(IMapView mapview, GeoLocation.Position casePosition)
 {
     try
     {
         _mapview      = mapview;
         _casePosition = casePosition;
         InitializeComponent();
         AppContext.AppContext.NewRecordInProgress = true;
         Tapgestures();
         if (Device.OS == TargetPlatform.Android)
         {
             SplitView.MapView?.ClearPin();
             MoveMapPosition();
             AndroidMapView.HideLocator();
             var googleMap = (AndroidMapView)SplitView.MapView;
             GlMapView.Children.Clear();
             GlMapView.Children.Add(googleMap, 0, 0);
         }
         else
         {
             var formsMap = (WindowsMapView)mapview;
             GlMapView.Children.Add(formsMap, 0, 0);
         }
         MoveToPosition += MoveMapPosition;
         _slowmethod     = SlowConnectionAlert;
         _token          = CancellationToken.None;
         SlowConnection();
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }
Exemple #10
0
 /// Name		OnActionTapped
 ///
 /// <summary>
 /// Handles operation for tapping on Action.
 /// </summary>
 private async void OnActionTapped()
 {
     try
     {
         if (AppData.SyncInProgress)
         {
             await SplitView.DisplayAlert("Sync In Progress", "Please wait for the sync to finish before taking further actions.", "OK", null);
         }
         else if (AppContext.AppContext.NewRecordInProgress)
         {
             await SplitView.DisplayAlert("New Record creation is in progress", "Please save or cancel new sevice record to proceed", "OK", null);
         }
         else
         {
             if (Reachability.InternetConnectionStatus() != ReachabilityNetworkStatus.NotReachable)
             {
                 SplitView.PopupContent.ShowPopupRelative(new ActionView(SplitView.PopupContent), Lbl_Action, 200, 100, true, "");
             }
             else
             {
                 await SplitView.DisplayAlert("Offline", "It is not possible to complete this action while in offline mode.\rConnect the device to a network and try again.", "OK", null);
             }
         }
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }
Exemple #11
0
        /// <summary>
        /// To check the record has completed date or not
        /// </summary>
        /// <param name="record"></param>
        /// <returns></returns>
        public bool CheckComplete(SRiRecord record)
        {
            bool incomplete;

            //
            incomplete = false;
            try
            {
                foreach (var i in record.Inspections)
                {
                    foreach (var v in i.Visits)
                    {
                        if (!v.Visit.DateVisit.HasValue)
                        {
                            incomplete = true;
                            break;
                        }
                    }
                    if (incomplete)
                    {
                        break;
                    }
                }
                return(!incomplete);
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
                return(incomplete);
            }
        }
Exemple #12
0
        /// <summary>
        /// To Check the syncStaus
        /// </summary>
        /// <param name="passed"></param>
        private void SyncFinish(bool passed)
        {
            try
            {
                if (!AppData.SyncInProgress)
                {
                    VwSyncStatus.SyncStopped(AppData.SyncInProgress);
                }
                else
                {
                    VwSyncStatus.SyncStopped(passed);
                }
                //else
                //{
                //    SplitView.Instace()
                //        .DisplayAlert("Sync Timed Out", "The sync has ran for too long and has timed out.", "Ok");
                //}

                AppData.SyncInProgress = false;
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Exemple #13
0
        private async Task <bool> HasNoLatLong()
        {
            try
            {
                bool flag = false;
                foreach (var prop in AppContext.AppContext.LstSriproperty)
                {
                    if (prop.Status == SyncStatus.New)
                    {
                        if ((prop.RequestGroups[0].Records[0].Record.Latitude == null && prop.RequestGroups[0].Records[0].Record.Longitude == null) ||
                            (prop.RequestGroups[0].Records[0].Record.Latitude == 0 && prop.RequestGroups[0].Records[0].Record.Longitude == 0))
                        {
                            await SplitView.Instace().DisplayAlert("New Case has No Location for Case", "The address for " + prop.Address.ShortAddress + " does not have a location. Please correct this and try again", "Ok");

                            flag = true;
                            break;
                        }
                    }
                }
                return(flag);
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
                return(false);
            }
        }
Exemple #14
0
 private async Task <bool> HasNoUPRN()
 {
     try
     {
         bool flag = false;
         foreach (var prop in AppContext.AppContext.LstSriproperty)
         {
             if (prop.Status == SyncStatus.New && prop.RequestGroups[0].Records[0].Record.UPRN == null)
             {
                 if (await SplitView.DisplayAlert("New Case Has Unvalidated Address",
                                                  "The address for " + prop.Address.ShortAddress +
                                                  " was not validated and so does not have a UPRN. Are you sure you want to sync?", "Yes", "No"))
                 {
                     flag = false;
                     break;
                 }
                 else
                 {
                     flag = true;
                     break;
                 }
             }
         }
         return(flag);
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
         return(false);
     }
 }
        /// ------------------------------------------------------------------------------------------------

        /// ------------------------------------------------------------------------------------------------
        #region private functions
        /// <summary>
        /// Refresh the list of vists data
        /// </summary>
        private void OnRefreshList()
        {
            try
            {
                Lstvw_Main.BeginRefresh();
                var iMap = AppData.PropertyModel.SelectedRecord.IndexMap;
                iMap = new IndexMapping(iMap.Property, iMap.RequestGroup, iMap.Record, 0);
                var inspectionList = AppData.PropertyModel.EntityFromMapping(iMap) as SRiInspection;
                var visitsList     = new List <CreateVisitsList>();
                if (inspectionList != null)
                {
                    var visitcount = inspectionList.Visits.Count;
                    for (int j = 0; j < visitcount; j++)
                    {
                        var data       = inspectionList.Visits[j];
                        var visitsData = new CreateVisitsList()
                        {
                            VisitTypeDescription = data.VisitTypeDescription,
                            ScheduleDate         = data.Visit.DateScheduled.ToString("dd MMM yyyy", "Scheduled for ", "Not scheduled"),
                            CompletedDate        = data.Visit.DateVisit.ToString("dd MMM yyyy", "Completed on ", "Outstanding"),
                            VisitListIndex       = j
                        };
                        visitsList.Add(visitsData);
                    }
                }
                Lstvw_Main.ItemsSource   = visitsList;
                Lstvw_Main.HeightRequest = visitsList.Count * 100;
                Lstvw_Main.EndRefresh();
                GC.Collect();
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
 private void LoadPickerData()
 {
     try
     {
         ContactTypes = AppData.ConfigModel.ContactTypes(AppData.PropertyModel.SelectedProperty.Organisation);
         foreach (var res in ContactTypes.OrderBy(x => x.Description).ToList())
         {
             Pkr_CustomerType.Items.Add(res.Description);
         }
         if (AppData.PropertyModel.SelectedRecord.Record.Record.Customers.Count > 0)
         {
             Pkr_CustomerType.SelectedIndex =
                 Pkr_CustomerType.Items.IndexOf(
                     AppData.PropertyModel.SelectedRecord.Record.Record.Customers[0].CustomerTypeDescription);
         }
         else
         {
             Pkr_CustomerType.SelectedIndex = 0;
         }
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }
        ///
        #endregion
        /// ------------------------------------------------------------------------------------------------

        /// ------------------------------------------------------------------------------------------------
        #region Protected Functions
        protected override void OnElementChanged(ElementChangedEventArgs <TableView> e)
        {
            try
            {
                base.OnElementChanged(e);
                Items = AppData.PropertyModel.SelectedAction.Action.Paragraphs;
                Control.ItemLongClick += (s, args) =>
                {
                    ClipData data = ClipData.NewPlainText("List", args.Position.ToString());
                    if (VisitActionDetailsPage.CurrentInstance.IsEditable)
                    {
                        if (VisitActionDetailsPage.CurrentInstance.SingleTypeCode != null)
                        {
                            if (!VisitActionDetailsPage.CurrentInstance.SingleTypeCode.Contains(Items[args.Position - 1].ParagraphType))
                            {
                                CustomDragShadowBuilder myShadownScreen = new CustomDragShadowBuilder(args.View);
                                args.View.StartDrag(data, myShadownScreen, null, 0);
                            }
                        }
                    }
                };
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
        ///
        #endregion
        /// ------------------------------------------------------------------------------------------------

        /// ------------------------------------------------------------------------------------------------
        #region public Constructor
        /// ------------------------------------------------------------------------------------------------
        ///
        public AddNewImageView()
        {
            try
            {
                InitializeComponent();
                IsSaveEnabled = false;
                ImageBytes    = ImageData();
                // Tap cancel
                var tapCancel = new TapGestureRecognizer();
                tapCancel.Tapped += Lbl_CancelClicked;
                Lbl_Cancel.GestureRecognizers.Add(tapCancel);
                //Tap Save
                TapGestureRecognizer tapSave = new TapGestureRecognizer();
                tapSave.Tapped += OnSaveClicked;
                Btn_Save.GestureRecognizers.Add(tapSave);

                Txt_ImageName.TextChanged        += ValidateTextBox;
                Txt_ImageDescription.TextChanged += ValidateTextBox;
                if (ImageBytes != null)
                {
                    Img_Image.Source = ImageSource.FromStream(() => new MemoryStream(ImageBytes));
                }
                Txt_ImageName.TextChanged += TextChanged;
                _isExecute         = true;
                Btn_Save.TextColor = Styles.WindowBackgroundDark;
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
        /// ------------------------------------------------------------------------------------------------

        /// ------------------------------------------------------------------------------------------------
        #region Private Functions

        private void UpdateCellText(object sender, List <KeyValuePair <string, string> > listData, int height, int width)
        {
            try
            {
                var objSender = sender as Label;
                _groupedListPopupView = new GroupedListView(listData, sender);

                height = listData.Count * 85 + 5;

                if (height > 450)
                {
                    height = 450;
                }
                Task.Delay(300);
                if (Device.OS == TargetPlatform.iOS)
                {
                    ParagraphView.CurrentInstance.Drawpopup();
                    ParagraphView.RelativePopup.ShowInstacePopup(ParagraphView.CurrentInstance, ParagraphView.RelativePopup,
                                                                 _groupedListPopupView, objSender, width, height, true, "");
                    ParagraphView.RelativePopup._triangleImage.Source = "";
                }
                else
                {
                    VisitActionDetailsPage.RelativePopup.ShowPopupRelative(_groupedListPopupView, objSender, width, height, true, "");
                    VisitActionDetailsPage.RelativePopup._triangleImage.Source = "";
                }
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Exemple #20
0
        /// ------------------------------------------------------------------------------------------------

        ///
        #region private function
        ///
        /// ------------------------------------------------------------------------------------------------
        /// Name		ContactList
        ///
        /// <summary>	Update the ContactList in Add/Edit Contact details.
        /// </summary>
        /// <param name="detailsList">		Contact details to dispaly.</param>
        ///
        /// <remarks>
        /// </remarks>
        /// ------------------------------------------------------------------------------------------------
        ///
        public void ContactList(RecordSummaryList detailsList)
        {
            try
            {
                ContactsList           = detailsList;
                Lstvw_Main.ItemsSource = ContactsList;
                string address = null;
                foreach (var item in ContactsList)
                {
                    if (item.Key == "Address")
                    {
                        address = item.Value;
                    }
                }
                if (address != null || address != "")
                {
                    Lstvw_Main.HeightRequest = ContactsList.Count * Device.OnPlatform <int>(36, 35, 35) + Device.OnPlatform <int>(55, 0, 55);
                }
                else
                {
                    Lstvw_Main.HeightRequest = detailsList.Count * Device.OnPlatform <int>(36, 35, 35);
                }
                Lbl_Contacts.Text = "Edit Contact Details";
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Exemple #21
0
        ///

        /// ------------------------------------------------------------------------------------------------
        #region Private Functions
        /// ------------------------------------------------------------------------------------------------
        /// <summary>
        /// Handles all Tap events in this page
        /// </summary>
        private void TapGestures()
        {
            try
            {
                //
                var tapback = new TapGestureRecognizer();
                tapback.Tapped += BackImageTapped;
                Lbl_CaseName.GestureRecognizers.Add(tapback);
                //
                var onAddTapped = new TapGestureRecognizer();
                Img_Add.GestureRecognizers.Add(onAddTapped);
                Boxvw_Add.GestureRecognizers.Add(onAddTapped);
                onAddTapped.Tapped += (s, e) =>
                {
                    Task.Delay(300);
                    SplitView.PopupContent.ShowPopupRelative(new AddVisitPopupView(SplitView.PopupContent), Img_Add, 150, 100, true, "");
                };
                //
                //Match Address
                //var tapMatchAddress = new TapGestureRecognizer();
                //tapMatchAddress.Tapped += OnMatchAddressTapped;
                //Lbl_MatchAddress.GestureRecognizers.Add(tapMatchAddress);
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
        /// ------------------------------------------------------------------------------------------------

        /// ------------------------------------------------------------------------------------------------
        #region Private Functions

        /// <summary>
        /// Item tapped in the list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void ActionsItemTapped(object sender, ItemTappedEventArgs e)
        {
            try
            {
                if (_isExecute)
                {
                    _isExecute = false;
                    _popupContent.DismisPopup();
                    var selectedItem = (GroupedListModel)e.Item;

                    var visitMap = AppData.PropertyModel.SelectedAction.IndexMap;

                    var newAction = new SelectedAction(AppData.PropertyModel.SelectedAction.Action, visitMap, true)
                    {
                        Action = { ActionType = selectedItem.Code }
                    };

                    await VisitInstance.LoadActionsForm(newAction);

                    _isExecute = true;
                }
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
        /// <summary>
        /// Push the ContentView at leftside of SplitView
        /// </summary>
        /// <param name="view">The page need to display at leftside passed as view</param>
        /// <returns>Task for async</returns>
        public async Task PushRightContent(View view)
        {
            try
            {
                var currentView = GetCurrentView();
                if (currentView != view || currentView == null)
                {
                    _stackNavigationViews.Push(view);
                    currentView = GetCurrentView();
                }


                Rl_Layout.Children.Add(currentView,

                                       Constraint.RelativeToParent((p) => currentView.X),
                                       Constraint.RelativeToParent((p) => currentView.Y),
                                       Constraint.RelativeToParent((p) => p.Width),
                                       Constraint.RelativeToParent((p) => p.Height)
                                       );
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Exemple #24
0
        /// ------------------------------------------------------------------------------------------------
        /// ------------------------------------------------------------------------------------------------
        /// Name		OntapLegislationTapped
        ///
        /// <summary>	Opens the Popup on touching the Legislation label
        /// </summary>
        /// <param name="sender"> </param>
        ///   /// <param name="e"> event arguments</param>
        /// <remarks>
        /// </remarks>
        /// ------------------------------------------------------------------------------------------------
        ///
        private async void OntapLegislationTapped(object sender, EventArgs e)
        {
            try
            {
                if (GroupedLegislation != null && GroupedLegislation.listData.Count != 0)
                {
                    int height = GroupedLegislation.listData.Count * 90;

                    if (height > 400)
                    {
                        height = 400;
                    }
                    VisitActionDetailsPage.RelativePopup.ShowPopupRelative(GroupedLegislation, BX_Legislation, 400, height, true, "");
                    VisitActionDetailsPage.RelativePopup._triangleImage.Source = "";
                }
                else
                {
                    await VisitActionDetailsPage.CurrentInstance.DisplayAlert("No legislation", "No legislation types set up in Uniform for this visit type. Please contact your Uniform administrator for assistance.", "Ok");
                }
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
        /// ------------------------------------------------------------------------------------------------

        /// ------------------------------------------------------------------------------------------------
        #region Private Functions

        /// ------------------------------------------------------------------------------------------------
        /// Name		TapGestures
        ///
        /// <summary>	It contains the Tapgesture recognisers for the whole Page.
        /// </summary>
        /// ------------------------------------------------------------------------------------------------
        private void TapGestures()
        {
            try
            {
                TapGestureRecognizer tapFilter = new TapGestureRecognizer();
                tapFilter.Tapped += (s, e) =>
                {
                    if (AppContext.AppContext.NewRecordInProgress)
                    {
                        DisplayAlert("New Record creation is in progress", "Please save or cancel new sevice record to proceed", "OK", null);
                    }
                    else
                    {
                        OnFilterTapped();
                    }
                };
                _imgFilter.GestureRecognizers.Add(tapFilter);
                Boxvw_Filter.GestureRecognizers.Add(tapFilter);
                TapGestureRecognizer tapMenu = new TapGestureRecognizer();
                tapMenu.Tapped += (s, e) =>
                {
                    Task.Delay(200);
                    PopupContent.ShowPopupRelative(new MenuView(PopupContent), _imgMenu, 250, 160, true, "");
                };
                _imgMenu.GestureRecognizers.Add(tapMenu);
                Boxvw_Menu.GestureRecognizers.Add(tapMenu);
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
        /// ------------------------------------------------------------------------------------------------

        /// ------------------------------------------------------------------------------------------------
        #region Private Functions
        /// ------------------------------------------------------------------------------------------------
        ///
        /// ------------------------------------------------------------------------------------------------
        /// Name		InputTapped
        ///
        /// <summary>
        /// To give input value
        /// </summary>
        ///
        /// <remarks>
        /// </remarks>
        /// ------------------------------------------------------------------------------------------------
        ///
        private async void InputTapped(object sender, EventArgs e)
        {
            try
            {
                var objSender = sender as Label;

                if (objSender != null)
                {
                    if (Text != ParagraphViewModel.DEFAULT_VALUE_TEXT)
                    {
                        InputValue = Text;
                    }

                    InputValue = await DependencyService.Get <IInputDialog>().ShowDialog(InputValue);

                    if (!string.IsNullOrWhiteSpace(InputValue))
                    {
                        objSender.Text = _getText = InputValue;
                        TextChanged.Invoke();
                        VisitActionDetailsPage.CurrentInstance.RefreshList();
                    }
                }
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
        private async void PropertyUpdated(object sender, PropertyUpdatedEventArgs e)
        {
            try
            {
                switch (e.PropertyType)
                {
                case PropertyType.Config:
                    AppData.Content.SaveConfig();
                    break;

                case PropertyType.PropertyData:
                    AppData.Content.SaveCaseData();
                    InspectionCount?.Update();
                    break;

                case PropertyType.PropertyList:
                    await HubMaster.ReloadPropertyData();

                    InspectionCount?.Update();
                    break;

                case PropertyType.PropertyFilters:
                    // HubMaster.Filter_List();
                    InspectionCount?.Update();
                    break;
                }
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
        /// <summary>
        /// On tapped in visits data
        /// </summary>
        /// <param name="s"></param>
        /// <param name="e"></param>
        private async void Visits_Tapped(object s, ItemTappedEventArgs e)
        {
            try
            {
                if (_isExecute)
                {
                    _isExecute = false;
                    var data = e.Item as CreateVisitsList;
                    AppData.PropertyModel.SelectedVisit = null;
                    var iMap = AppData.PropertyModel.SelectedRecord.IndexMap;
                    if (data != null)
                    {
                        iMap = new IndexMapping(iMap.Property, iMap.RequestGroup, iMap.Record, 0, data.VisitListIndex);

                        var details = AppData.PropertyModel.SelectedRecord.Record.Record.Inspections[0].Visits[data.VisitListIndex];
                        //Details.Status = SyncStatus.New;
                        AppData.PropertyModel.SelectedVisit = new SelectedVisit(details, iMap, false);
                    }
                    //await SplitView.Instace().Navigation.PushModalAsync(new VisitActionPage(),true);
                    PageNavigation.PushMainPage(new VisitActionPage());
                    _isExecute = true;
                }
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Exemple #29
0
        /// ------------------------------------------------------------------------------------------------
        /// Name		OnOfficerTapped
        ///
        /// <summary>	Executed when the Edit function is tapped.
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// ------------------------------------------------------------------------------------------------
        private async void OnOfficerTapped(object sender, EventArgs e)
        {
            try
            {
                if (_groupedOffice != null && _groupedOffice.listData.Count != 0)
                {
                    int height = _groupedOffice.listData.Count * 90;

                    if (height > 400)
                    {
                        height = 400;
                    }
                    RelativePopup.ShowPopupRelative(_groupedOffice, BX_Officer, 400, height, true, "");
                    RelativePopup._triangleImage.Source = "";
                }
                else if (string.IsNullOrEmpty(AppData.PropertyModel.SelectedVisit.GroupMod))
                {
                    return;
                }
                else
                {
                    await LockScreen.ToDisplayAlert(this, "No Officer", "No officer types set up in Uniform for this visit type. Please contact your Uniform administrator for assistance.", "OK");
                }
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Exemple #30
0
 /// ------------------------------------------------------------------------------------------------
 /// ------------------------------------------------------------------------------------------------
 /// Name		OnSave
 ///
 /// <summary>	Saves the search results and dismisses the popup on clicking Save button.
 /// </summary>
 /// <param name="sender"> </param>
 ///   /// <param name="e"> event arguments</param>
 /// <remarks>
 /// </remarks>
 /// ------------------------------------------------------------------------------------------------
 ///
 private void OnSave(object sender, EventArgs e)
 {
     try
     {
         if (!Lbl_SearchSave.IsEnabled)
         {
             return;
         }
         if (!_isSelected)
         {
             SplitView.CenterPopupContent.DismisPopup();
         }
         else
         {
             SplitView.CenterPopupContent.DismisPopup();
             SplitView.Instace().FilterCheckAvailable(true);
             AppData.PropertyModel.SaveSearchResults();
             SplitView.HubMaster.FindByName <Label>("LblSearchHint").IsVisible = false;
             AppData.PropertyModel.SearchResults.Clear();
         }
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }