Esempio n. 1
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());
     }
 }
Esempio n. 2
0
 private void LoadMap()
 {
     try
     {
         if (Device.OS == TargetPlatform.Android)
         {
             //AppContext.AppContext.MapView = new AndroidMapView();
             Gl_RadiusPoint.Children.Add((AndroidMapView)SplitView.MapView, 0, 0);
             //
             LoadMapPin(SelectedLatitude, SelectedLongitude);
             //
             AndroidMapView.HideLocator();
         }
         else
         {
             pinMapView = new WindowsMapView();
             Gl_RadiusPoint.Children.Add((WindowsMapView)pinMapView, 0, 0);
             var t = Task.Run(async delegate
             {
                 await Task.Delay(TimeSpan.FromSeconds(0.5));
                 Device.BeginInvokeOnMainThread(() =>
                 {
                     //
                     LoadMapPin(SelectedLatitude, SelectedLongitude);
                     //
                 });
                 return(42);
             });
         }
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }
Esempio n. 3
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());
            }
        }
Esempio n. 4
0
        private async void OnCancelTapped(object sender, EventArgs e)
        {
            try
            {
                await CloseView();

                if (Device.OS == TargetPlatform.Android)
                {
                    AndroidMapView.ShowLocator();
                    var formsMap = (AndroidMapView)SplitView.MapView;
                    SplitView.Fullmapview.FindByName <Grid>("GlMapView").Children.Add(formsMap, 0, 0);
                    SplitView.MapView.LoadPins(AppContext.AppContext.LstGooglePin);
                }
                _cts.Cancel();
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
 public EditLocationMapView(IMapView mapview, GeoLocation.Position casePosition)
 {
     try
     {
         InitializeComponent();
         AppContext.AppContext.NewRecordInProgress = true;
         _mapview      = mapview;
         _casePosition = casePosition;
         Tapgestures();
         if (Device.OS == TargetPlatform.Android)
         {
             var formsMap = (AndroidMapView)SplitView.MapView;
             GlMapView.Children.Clear();
             GlMapView.Children.Add(formsMap, 0, 0);
             SplitView.MapView?.ClearPin();
             MoveMapPosition();
             AndroidMapView.HideLocator();
         }
         else
         {
             var formsMap = (WindowsMapView)mapview;
             GlMapView.Children.Add(formsMap, 0, 0);
         }
         if (Device.OS != TargetPlatform.Android)
         {
             var t = Task.Run(async delegate
             {
                 await Task.Delay(TimeSpan.FromSeconds(1));
                 MoveMapPosition();
                 return(42);
             });
         }
         _slowmethod = SlowConnectionAlert;
         _token      = CancellationToken.None;
         SlowConnection();
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }
Esempio n. 6
0
        //private async void OnMatchAddressTapped(object sender, EventArgs e)
        //{
        //    if (Reachability.InternetConnectionStatus() != ReachabilityNetworkStatus.NotReachable)
        //    {
        //        //API Call to Match Address
        //        await AppData.API.UtilityByAddresses(AppData.PropertyModel.SelectedProperty.Address.RawAddress);

        //        if (AddNewCaseView.UtilityAddressesByAdd == null) return;
        //        if (AddNewCaseView.UtilityAddressesByAdd.Results > 0)
        //        {
        //            //Open Exist Add Case View
        //            await SplitView.Instace().PushRightContent(UpdateNewCase = new AddNewCaseView());
        //        }
        //        else
        //            await SplitView.DisplayAlert("Invalid Address Selected", "No Data Retrieved. Please try another location", "Ok",null);
        //    }
        //}

        /// <summary>
        /// Loads the map content on the right side for the specific platform.
        /// </summary>
        /// <returns></returns>
        private void Update()
        {
            try
            {
                if (Device.OS == TargetPlatform.Android)
                {
                    // AppContext.AppContext.MapView = new AndroidMapView();
                    SplitView.MapView?.ClearPin();
                    if (AppData.PropertyModel.SelectedProperty.HasValidCoords)
                    {
                        Gl_CaseSummary.Children.Add((AndroidMapView)SplitView.MapView, 0, 0);
                        AndroidMapView.HideLocator();
                        var googleMapPin = MapViewModel.GetCustomePin();
                        if (googleMapPin != null)
                        {
                            SplitView.MapView?.LoadPin(googleMapPin);
                        }
                    }
                }
                else
                {
                    //AppContext.AppContext.MapView = new WindowsMapView();
                    if (AppData.PropertyModel.SelectedProperty.HasValidCoords)
                    {
                        var windowMapPin = MapViewModel.GetCurrentPin();
                        if (windowMapPin != null)
                        {
                            AppContext.AppContext.MapView?.MoveToRegion(
                                new Position(windowMapPin.Pin.Position.Latitude, windowMapPin.Pin.Position.Longitude), Distance.FromKilometers(0.3));
                        }
                    }
                    Gl_CaseSummary.Children.Add((WindowsMapView)AppContext.AppContext.MapView, 0, 0);
                }

                ShowDetails();
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Esempio n. 7
0
        private async void CloseView()
        {
            try
            {
                await SplitView.Instace().PopRightContent();

                //Dispose Map
                pinMapView?.DisposeMap();
                GC.Collect(0, GCCollectionMode.Forced);
                //
                FullMapView.NewCaseAddView = null;
                AppContext.AppContext.NewRecordInProgress = false;
                if (Device.OS == TargetPlatform.Android)
                {
                    AndroidMapView.ShowLocator();
                }
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }