Beispiel #1
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);
            }
        }
        public async void PostionSelected(double selectedLatitude, double selectedLongitude)
        {
            try
            {
                //API Call
                await AppData.API.UtilityByCoordinates(selectedLatitude, selectedLongitude);

                if (AddNewCaseView.UtilityAddressesByCoord == null)
                {
                    return;
                }
                //Close Map Page
                await CloseView();

                //Open Add Case View
                AppContext.AppContext.SelectedNewLatitude  = selectedLatitude;
                AppContext.AppContext.SelectedNewLongitude = selectedLongitude;
                AddNewCaseView.isAddressChanged            = true;
                if (Device.OS == TargetPlatform.Android)
                {
                    await SplitView.Instace().PushRightContent(FullMapView.NewCaseAddView = new AddNewCaseView(selectedLatitude, selectedLatitude));
                }
                else
                {
                    FullMapView.NewCaseAddView.UpdateLatLong(selectedLatitude, selectedLongitude);
                }
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Beispiel #3
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());
     }
 }
        /// ------------------------------------------------------------------------------------------------
        /// Name		SaveClick
        ///
        /// <summary>	Executed when the save button is clicked.
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// ------------------------------------------------------------------------------------------------
        private void SaveClick(object sender, EventArgs e)
        {
            Exception error;

            AppData.PropertyModel.SelectedAction.Action.ActualDateTime = Dtp_CompletedDate.Date + Tmp_CompletedDate.Time;
            AppData.PropertyModel.SelectedAction.Action.Hours          = AppContext.AppContext.RevertHt(Pkr_TimeTakenHours.Items[Pkr_TimeTakenHours.SelectedIndex], Pkr_TimeTakenMinutes.Items[Pkr_TimeTakenMinutes.SelectedIndex]);
            var officeDetails = _groupedOffice.SelectedValue?.Split('-');

            if (officeDetails != null)
            {
                var officer = officeDetails[0].Remove(officeDetails[0].Length - 1);
                AppData.PropertyModel.SelectedAction.Action.Officer = officer;
            }
            var legislationDetails = VisitActionDetailsViewCell.GroupedLegislation.SelectedValue?.Split('-');

            if (legislationDetails != null)
            {
                var legislation = legislationDetails[0].Remove(legislationDetails[0].Length - 1);
                AppData.PropertyModel.SelectedAction.Action.LegislationType = legislation;
            }
            AppData.PropertyModel.SaveAction(out error);
            //  AppData.PropertyModel.SaveVisit(out error);
            if (error == null)
            {
                SplitView.Instace().Navigation.PopModalAsync();
                AppContext.AppContext.RefreshList.Invoke(sender, e);
            }
            else
            {
                throw error;
            }
        }
        /// <summary>
        /// To set the height of popup height
        /// </summary>
        /// <param name="count"></param>
        /// <returns></returns>
        private double GetHeight(int count)
        {
            var    minHeight = count * GroupedListView.GroupedListViewCellHeight + GroupedListView.GroupedListViewPadding;
            double maxHeight = SplitView.Instace().Height * 0.55;

            return(maxHeight < minHeight ? maxHeight : minHeight);
        }
Beispiel #6
0
        private double GetHeight(int count, int groupedCount)
        {
            int    minHeight;
            double maxHeight;
            int    headerHeight = 40;

            if (count == 1)
            {
                minHeight = (count * AddressesNearbyView.CellHeight + groupedCount) + headerHeight + 80;
            }
            else
            {
                minHeight = count * AddressesNearbyView.CellHeight + groupedCount + headerHeight;//for two counts => 160 = 1*40+40
            }
            if (Device.OS == TargetPlatform.iOS)
            {
                maxHeight = SplitView.Instace().Height * 0.7;
            }
            else
            {
                maxHeight = SplitView.Instace().Height * 0.5;
            }

            return(maxHeight < minHeight ? maxHeight : minHeight);
        }
Beispiel #7
0
 protected override void OnResume()
 {
     try
     {
         // Handle when your app resumes
         if (AppData.LastActivity != null)
         {
             if (AppData.LastActivity.HasValue &&
                 DateTime.Now > AppData.LastActivity.Value.AddMinutes(2))
             {
                 if (App.Current.MainPage.ToString() != "ServiceRequest.Pages.LoginPage" &&
                     !SplitView.Instace().Navigation.ModalStack.Contains(AppContext.AppContext.LoginPage))
                 {
                     AppData.MainModel.CurrentUser.LoginAction = LoginActions.Existing;
                     AppContext.AppContext.IsForLockScreen     = true;
                     LockScreen.ClosePopups();
                     //  SplitView.DisplayLockScreen.Invoke();
                     LockScreen.CheckLockScreen();
                 }
                 ClosePopups();
             }
         }
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }
Beispiel #8
0
        /// <summary>
        /// Raises the Case touch up inside event.
        /// </summary>
        /// <param name="cellIndex">Case index.</param>
        public async void OnCellTouchUpInside(int cellIndex)
        {
            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
                    {
                        var  touchedEntry      = MEntries[cellIndex];
                        bool isTouchingToClose = touchedEntry.IsOpen;
                        var  entriesToClose    = MEntries.Where(e => e.IsOpen);
                        foreach (var entry in entriesToClose)
                        {
                            InspectionCellView.CurrentUnifiedItem = null;
                            InspectionCellView.DeSelectItem();
                            CloseCase(entry);
                            // CloseAllEntries();
                            entry.IsOpen = false;
                            Update(entry.Index, entry.IsOpen);
                        }

                        if (!isTouchingToClose)
                        {
                            await SplitView.Instace().Clear();

                            OpenCase(touchedEntry);
                            touchedEntry.IsOpen = true;
                            Update(touchedEntry.Index, touchedEntry.IsOpen);
                            if (Device.OS == TargetPlatform.Android)
                            {
                                await
                                SplitView.Instace()
                                .PushRightContent(SplitView.PropertySummary = new PropertySummary());
                            }
                            else
                            {
                                await SplitView.Instace().PushRightContent(new PropertySummary());
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Beispiel #9
0
 /// <summary>
 /// Executes the OnNotesTapped event
 /// </summary>
 /// <returns></returns>
 private async void OnNotesTapped()
 {
     try
     {
         await SplitView.Instace().PushRightContent(new PropertyNotesView());
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }
Beispiel #10
0
 /// <summary>
 /// Executes the OnDocumentsTapped event
 /// </summary>
 /// <returns></returns>
 private async void OnDocumentsTapped()
 {
     try
     {
         await SplitView.Instace().PushRightContent(new DocumentListView());
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }
        /// ------------------------------------------------------------------------------------------------

        /// ------------------------------------------------------------------------------------------------
        #region Private Functions
        ///-------------------------------------------------------------------------------------------------
        /// ------------------------------------------------------------------------------------------------
        /// Name		BackImageTapped
        ///
        /// <summary> handles the navigation to the previous page.
        /// </summary>
        /// /// <param name="sender">  </param>
        /// <param name="e">event arguments</param>
        /// <remarks>
        /// </remarks>
        /// ------------------------------------------------------------------------------------------------
        ///
        private async void BackImageTapped(object sender, EventArgs e)
        {
            try
            {
                await SplitView.Instace().PopRightContent();
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Beispiel #12
0
        private async void SkipLocationClicked(object sender, EventArgs e)
        {
            try
            {
                await CloseView();

                await SplitView.Instace().PushRightContent(FullMapView.NewCaseAddView = new AddNewCaseView());
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
 ///
 /// ------------------------------------------------------------------------------------------------
 /// Name		BtnIncomplete_OnClicked
 ///
 /// <summary>
 /// Handles operation for clicking on InComplete button.
 /// </summary>
 ///
 /// <remarks>
 /// </remarks>
 /// ------------------------------------------------------------------------------------------------
 ///
 private async void BtnIncomplete_OnClicked(object sender, EventArgs e)
 {
     try
     {
         ChangeButton(AppData.PropertyModel.Filter = FilterMode.Incomplete);
         PopupLayout.DismisPopup();
         await SplitView.Instace().Clear();
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }
Beispiel #14
0
        public async void SetExpandCollapse(bool selected, int presentCaseIndex)
        {
            try
            {
                if (MEntries.Count != 0)
                {
                    var imgCollapse      = MEntries[presentCaseIndex]?.Cell.FindByName <Image>("Img_Collapse");
                    var imgExpand        = MEntries[presentCaseIndex]?.Cell.FindByName <Image>("Img_Expand");
                    var glInspectionCell = MEntries[presentCaseIndex]?.Cell.FindByName <StackLayout>("Main_Layout");
                    var mainGridCaselist = MEntries[presentCaseIndex]?.Cell.FindByName <Grid>("Main_Grid");
                    var caseCell         = MEntries[presentCaseIndex]?.Cell;
                    var inspectionlist   = MEntries[presentCaseIndex]?.View.FindByName <ListView>("Lstvw_Inspections");

                    if (mainGridCaselist != null)
                    {
                        var mainLayoutHeight = mainGridCaselist.HeightRequest;

                        if (imgExpand != null && imgCollapse != null && glInspectionCell != null)
                        {
                            imgExpand.IsVisible = selected;
                            if (imgExpand.IsVisible)
                            {
                                caseCell.HeightRequest = 55;                     //Set the casecelllist view height

                                SplitView.Instace().FilterCheckAvailable(false); //Toenable and Disable the filter
                            }
                            else
                            {
                                await SplitView.Instace().Clear();

                                //Disposing Map instance
                                AppContext.AppContext.MapView?.DisposeMap();
                                GC.Collect(0, GCCollectionMode.Forced);
                                //
                                AppData.PropertyModel.SelectedRecord   = null;  // To set the selected record summary details as null
                                AppData.PropertyModel.SelectedProperty = null;
                                caseCell.HeightRequest      = mainLayoutHeight; //Set the casecelllist view height
                                inspectionlist.SelectedItem = null;
                                SplitView.Instace().FilterCheckAvailable(true);
                            }
                            imgCollapse.IsVisible            = !selected;
                            glInspectionCell.BackgroundColor = selected ? Color.White : Styles.WindowBackground;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Beispiel #15
0
 private async void OnLblDeleteVisitTapped()
 {
     try
     {
         if (await LockScreen.ToDisplayAlert(SplitView.Instace(), "Delete Service Record", "Are you sure you want to delete this service record?", "Yes", "No"))
         {
             InspectionCellViewCell.OnDelete(InspectionCellView.CurrentUnifiedItem);
         }
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }
Beispiel #16
0
        private async void Nrequest(object sender, EventArgs e)
        {
            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 (!AppData.ConfigModel.IsNotEmpty)
                {
                    await SplitView.DisplayAlert("No data", "Please download the data to proceed", "OK", null);
                }
                else
                {
                    UserPosition = await SplitView.Fullmapview.GetCurrentLocation();

                    if (Reachability.InternetConnectionStatus() == ReachabilityNetworkStatus.NotReachable)
                    {
                        await SplitView.Instace().PushRightContent(NewCaseAddView = new AddNewCaseView());
                    }
                    else
                    {
                        if (Device.OS == TargetPlatform.Android)
                        {
                            PointOnMapView = new AndroidMapView();
                        }
                        else
                        {
                            PointOnMapView = new WindowsMapView();
                        }

                        await SplitView.Instace().PushRightContent(AddNewCasePointOnMapView = new AddNewCasePointOnMapView(PointOnMapView, UserPosition));
                    }
                    if (Device.OS != TargetPlatform.Android)
                    {
                        var t = Task.Run(async delegate
                        {
                            await Task.Delay(TimeSpan.FromSeconds(1));
                            AddNewCasePointOnMapView.MoveToPosition?.Invoke();
                            return(42);
                        });
                    }
                }
            }
            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)
        {
            var data = e.Item as CreateVisitsList;

            AppData.PropertyModel.SelectedVisit = null;
            IndexMapping iMap;

            iMap = AppData.PropertyModel.SelectedRecord.IndexMap;
            iMap = new IndexMapping(iMap.Property, iMap.RequestGroup, iMap.Record, 0, data.VisitListIndex);

            var Details = AppData.PropertyModel.SelectedRecord.Record.Record.Inspections[0].Visits[data.VisitListIndex];

            AppData.PropertyModel.SelectedVisit = new SelectedVisit(Details, iMap, false);
            await SplitView.Instace().Navigation.PushModalAsync(new VisitActionPage());
        }
Beispiel #18
0
 private async void SlowConnectionAlert()
 {
     try
     {
         var currentPage = SplitView.Instace().GetCurrentView();
         if (currentPage.GetType() == typeof(AddNewCasePointOnMapView))
         {
             await SplitView.DisplayAlert("Slow Connection", "If your map is taking a while to load it could be due to a slow internet connection. \nPlease click 'Skip' in the bottom right of the screen to set the location later or wait for the map to appear.", "Ok", null);
         }
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }
Beispiel #19
0
        /// ------------------------------------------------------------------------------------------------
        #region Public Constructor
        /// ------------------------------------------------------------------------------------------------
        ///

        ///
        /// ------------------------------------------------------------------------------------------------
        /// Name		RequestErrorPopup
        /// <summary>
        /// Constructor fires when the param type is RequestResponseEventArgs
        /// </summary>
        /// <param name="responseArgs"> Request Response Args.</param>
        /// ------------------------------------------------------------------------------------------------
        ///
        public RequestErrorPopup(RequestResponseEventArgs responseArgs)
        {
            InitializeComponent();
            m_oResponseArgs = responseArgs;
            TapGestures();
            SetContent();
            //
            EdUserInfo.Text      = UserInfoPlaceholder;
            EdUserInfo.TextColor = Styles.WindowBackgroundDark;
            this.Done           += () =>
            {
                SplitView.CenterPopupContent.DismisPopup();
                SendMail();
                SplitView.Instace().DisplayAlert("Mail Sent", "The mail has sent successfully", "Ok");
            };
        }
        private async Task CloseView()
        {
            try
            {
                await SplitView.Instace().PopRightContent();

                _mapview.DisposeMap();
                GC.Collect(0, GCCollectionMode.Forced);
                AddNewCaseView.EditLocInstance = null;
                //AppContext.AppContext.NewRecordInProgress = false;
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
        /// ------------------------------------------------------------------------------------------------

        /// ------------------------------------------------------------------------------------------------
        #region Public Constructor
        public ParagraphViewCell()
        {
            try
            {
                InitializeComponent();
                var typeGestureRecognizer = new TapGestureRecognizer();
                Lbl_Type.GestureRecognizers.Add(typeGestureRecognizer);

                typeGestureRecognizer.Tapped += (sender, args) =>
                {
                    var objSender = sender as Label;
                    AppContext.AppContext.IsTypeList = true;
                    UpdateCellText(sender, ParagraphView.ParaViewModel.TypeList, 250, 150);
                    AppContext.AppContext.IsTypeList = false;
                    if (objSender != null)
                    {
                        objSender.PropertyChanged += Lbl_TypePropertyChanged;
                    }
                };

                var paragraphGestureRecognizer = new TapGestureRecognizer();
                Lbl_Paragraph.GestureRecognizers.Add(paragraphGestureRecognizer);

                paragraphGestureRecognizer.Tapped += (sender, args) =>
                {
                    var objSender = sender as Label;
                    int width     = (int)(SplitView.Instace().Width * 0.4);
                    AppContext.AppContext.IsParalist = true;
                    UpdateCellText(sender, ParagraphView.ParaViewModel.GetParaDescList(ParagraphView.ParaViewModel.ParagraphList), 100, width);
                    AppContext.AppContext.IsParalist = false;
                    if (objSender != null)
                    {
                        objSender.PropertyChanged += Lbl_ParagraphPropertyChanged;
                    }
                };
                var imgDeleteGestureRecognizer = new TapGestureRecognizer();
                Img_Delete.GestureRecognizers.Add(imgDeleteGestureRecognizer);

                imgDeleteGestureRecognizer.Tapped += OnDelete;
                _typedPara             = null;
                BindingContextChanged += OnBindingContextChanged;
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
 private void Lbl_Moblie_TextChanged(object sender, TextChangedEventArgs e)
 {
     try
     {
         var sb = new StringBuilder();
         if (Lbl_Moblie.Text.Length <= 12)
         {
             if (Regex.Match(Lbl_Moblie.Text, @"^[0-9_ ]*$").Success)
             {
                 foreach (char text in Lbl_Moblie.Text)
                 {
                     sb.Append(text);
                 }
             }
             else
             {
                 sb.Append(mobile);
                 if (Device.OS == TargetPlatform.iOS)
                 {
                     DependencyService.Get <IDisplayAlertPopup>().OnlyDigits();
                 }
                 else
                 {
                     SplitView.Instace().DisplayAlert("Warning", "Phone numbers can not contain letters or special characters", "OK");
                 }
             }
         }
         else
         {
             sb.Append(mobile);
             if (Device.OS == TargetPlatform.iOS)
             {
                 DependencyService.Get <IDisplayAlertPopup>().Exceed12();
             }
             else
             {
                 SplitView.Instace().DisplayAlert("Warning", "Length should not exceed 12 digits", "OK");
             }
         }
         Lbl_Moblie.Text = sb.ToString();
         mobile          = Lbl_Moblie.Text;
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }
 private void Lbl_Name_TextChanged(object sender, TextChangedEventArgs e)
 {
     try
     {
         var sb = new StringBuilder();
         if (Lbl_Name.Text.Length <= 50)
         {
             if (Regex.Match(Lbl_Name.Text, @"^[a-zA-Z_ \\s]*$").Success)
             {
                 foreach (char c in Lbl_Name.Text)
                 {
                     sb.Append(c);
                 }
             }
             else
             {
                 sb.Append(name);
                 if (Device.OS == TargetPlatform.iOS)
                 {
                     DependencyService.Get <IDisplayAlertPopup>().InvalidCharacter();
                 }
                 else
                 {
                     SplitView.Instace().DisplayAlert("Warning", "You have entered invalid character", "OK");
                 }
             }
         }
         else
         {
             sb.Append(name);
             if (Device.OS == TargetPlatform.iOS)
             {
                 DependencyService.Get <IDisplayAlertPopup>().ExceedLength();
             }
             else
             {
                 SplitView.Instace().DisplayAlert("Warning", "Length should not exceed 50 digits", "OK");
             }
         }
         Lbl_Name.Text = sb.ToString();
         name          = Lbl_Name.Text;
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }
        /// <summary>
        /// To set the height of popup height
        /// </summary>
        /// <param name="count"></param>
        /// <param name="groupedCount"></param>
        /// <returns></returns>
        private double GetHeight(int count, int groupedCount)
        {
            int    minHeight;
            double maxHeight;

            minHeight = count * GroupedListView.GroupedListViewCellHeight + groupedCount;
            if (Device.OS == TargetPlatform.iOS)
            {
                maxHeight = SplitView.Instace().Height * 0.7;
            }
            else
            {
                maxHeight = SplitView.Instace().Height * 0.5;
            }

            return(maxHeight < minHeight ? maxHeight : minHeight);
        }
        ///
        #endregion
        /// ------------------------------------------------------------------------------------------------

        /// ------------------------------------------------------------------------------------------------
        #region Private Functions and Methods
        ///
        private void OnSaveTapped(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(Lbl_Name.Text))
                {
                    if (!string.IsNullOrWhiteSpace(Lbl_Email.Text))
                    {
                        if (Regex.IsMatch(Lbl_Email.Text, @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z", RegexOptions.IgnoreCase))
                        {
                            SaveDetails();
                        }
                        else
                        {
                            if (Device.OS == TargetPlatform.iOS)
                            {
                                DependencyService.Get <IDisplayAlertPopup>().ValidMail();
                            }
                            else
                            {
                                SplitView.Instace().DisplayAlert("Wrong E-Mail Format", "Please Enter a vaild Mail-id", "OK");
                            }
                        }
                    }
                    else
                    {
                        SaveDetails();
                    }
                }
                else
                {
                    if (Device.OS == TargetPlatform.iOS)
                    {
                        DependencyService.Get <IDisplayAlertPopup>().Filldetails();
                    }
                    else
                    {
                        SplitView.Instace().DisplayAlert("Warning", "Please fill the name", "OK");
                    }
                }
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Beispiel #26
0
        public async void PostionSelected(double selectedLatitude, double selectedLongitude)
        {
            try
            {
                if (AppData.MainModel.Environment == OnSiteEnvironments.Sales)
                {
                    if (await SplitView.DisplayAlert("Demo Mode", "For security reasons in demo mode the address is not checked. When live you will be able to set to a validated addresses", "Ok", null))
                    {
                        await CloseView();

                        AppContext.AppContext.SelectedNewLatitude  = selectedLatitude;
                        AppContext.AppContext.SelectedNewLongitude = selectedLongitude;
                        await SplitView.Instace().PushRightContent(FullMapView.NewCaseAddView = new AddNewCaseView(selectedLatitude, selectedLatitude));

                        if (Device.OS == TargetPlatform.Android)
                        {
                            FullMapView.NewCaseAddView.UpdateLatLong(selectedLatitude, selectedLongitude);
                        }
                    }
                }
                else
                {
                    //API Call
                    await AppData.API.UtilityByCoordinates(selectedLatitude, selectedLongitude);

                    if (AddNewCaseView.UtilityAddressesByCoord == null)
                    {
                        return;
                    }
                    //Close Map Page
                    await CloseView();

                    AppContext.AppContext.SelectedNewLatitude  = selectedLatitude;
                    AppContext.AppContext.SelectedNewLongitude = selectedLongitude;
                    //Open Add Case View
                    await SplitView.Instace().PushRightContent(FullMapView.NewCaseAddView = new AddNewCaseView(selectedLatitude, selectedLongitude));

                    //if (Device.OS == TargetPlatform.Android)
                    //    AppContext.AppContext.LoadMapPin(selectedLatitude, selectedLongitude);
                }
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Beispiel #27
0
        public static async Task AssistTakePhoto()
        {
            string[] button = { "Camera", "Photo Library", "Cancel" };
            string   option = await SplitView.Instace().DisplayActionSheet("Select your option", null, null, button);

            if (option == "Photo Library")
            {
                await SelectPhoto();
            }
            else if (option == "Camera")
            {
                await TakePhoto();
            }
            else
            {
                AppContext.AppContext.ImageSource = null;
            }
        }
        private async void OnCancelTapped(object sender, EventArgs e)
        {
            try
            {
                await CloseView();

                if (Device.OS == TargetPlatform.Android)
                {
                    await SplitView.Instace().PushRightContent(FullMapView.NewCaseAddView = new AddNewCaseView());

                    //  AppContext.AppContext.LoadMapPin(AppContext.AppContext.SelectedNewLatitude, AppContext.AppContext.SelectedNewLongitude);
                }
                _cts.Cancel();
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Beispiel #29
0
        //private void CheckMatchaddress()
        //{
        //    try
        //    {
        //        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());
        //    }
        //}

        private async void BackImageTapped(object sender, EventArgs e)
        {
            try
            {
                View currentView;
                var  recordsLst = HubMasterView.CaseListView.MEntries[CaseListControl.SectionIndex]?.View.FindByName <ListView>("Lstvw_Inspections");
                if (recordsLst != null)
                {
                    recordsLst.SelectedItem = null;
                }
                do
                {
                    await SplitView.Instace().PopRightContent();

                    InspectionCellView.DeSelectItem();

                    if (Device.OS == TargetPlatform.Android)
                    {
                        if (AppData.PropertyModel.SelectedProperty.HasValidCoords)
                        {
                            SplitView.PropertySummary.FindByName <Grid>("Gl_CaseSummary")
                            .Children.Add((AndroidMapView)SplitView.MapView, 0, 0);
                            var googleMapPin = MapViewModel.GetCustomePin();
                            if (googleMapPin != null)
                            {
                                SplitView.MapView?.LoadPin(googleMapPin);
                            }

                            AndroidMapView.HideLocator();
                        }
                    }

                    //await SplitView.Instace().PushRightContent(new PropertySummary());
                    currentView = SplitView.Instace().GetCurrentView();
                } while (currentView.ToString() != "ServiceRequest.Views.PropertySummary");
                AppData.PropertyModel.SelectedRecord = null;
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Beispiel #30
0
        public async Task ReloadPropertyData()
        {
            try
            {
                await SplitView.Instace().Clear();

                //on loading property list record progress must stopp
                AppContext.AppContext.NewRecordInProgress = false;
                FullMapView.AddNewCasePointOnMapView      = null;
                //
                AppData.PropertyModel.UpdatePropertyList();
                Filter_List();
                SplitView.Instace().FilterCheckAvailable(true);                 // To Enable Filter Image
                SplitView.HubMaster.FindByName <Label>("LblSearchHint").IsVisible = false;
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }