Exemplo n.º 1
0
 /// ------------------------------------------------------------------------------------------------
 #region Public Constructor
 /// ------------------------------------------------------------------------------------------------
 ///
 /// <summary>
 /// Initializes a new instance of the <see cref="T:ActionView{T}"/> class.
 /// </summary>
 public ActionView(PopupLayouts parentPopup)
 {
     try
     {
         if (parentPopup == null)
         {
             return;
         }
         InitializeComponent();
         // Tap Search
         var tapSearch = new TapGestureRecognizer();
         tapSearch.Tapped += (s, e) =>
         {
             parentPopup.DismisPopup();
             //await Task.Delay(250);
             SplitView.CenterPopupContent.ShowPopupCenter(new SearchView(), 0.5);
         };
         // Tap Sync
         var tapSync = new TapGestureRecognizer();
         tapSync.Tapped += (s, e) =>
         {
             parentPopup.DismisPopup();
             SplitView.HubMaster.SyncCheck();
         };
         Gl_Search.GestureRecognizers.Add(tapSearch);
         Gl_Sync.GestureRecognizers.Add(tapSync);
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }
        ///
        #endregion
        /// ------------------------------------------------------------------------------------------------

        /// ------------------------------------------------------------------------------------------------
        #region Constructor
        /// ------------------------------------------------------------------------------------------------
        ///
        public AddVisitPopupView(PopupLayouts parentPopup, bool isFromMap = false)
        {
            try
            {
                InitializeComponent();

                if (isFromMap)
                {
                    NewSrUi();
                }
                else
                {
                    if (parentPopup == null)
                    {
                        return;
                    }
                    //Add new image
                    var tapAddImage = new TapGestureRecognizer();
                    tapAddImage.Tapped += (sender, e) =>
                    {
                        parentPopup.DismisPopup();
                        OnCameraCapture();
                    };
                    Gl_Add.GestureRecognizers.Add(tapAddImage);
                    //Add audio
                    var tapAddAudio = new TapGestureRecognizer();
                    tapAddAudio.Tapped += async(sender, e) =>
                    {
                        parentPopup.DismisPopup();
                        var isMicrophoneAvailable = DependencyService.Get <IRecorder>().IsMicrophoneAvailable();
                        if (isMicrophoneAvailable)
                        {
                            //if (Device.OS.Equals(TargetPlatform.WinPhone) || Device.OS.Equals(TargetPlatform.Windows))
                            //{
                            //    await Task.Delay(600);
                            //}
                            SplitView.CenterPopupContent.ShowPopupCenter(new AddNewAudioView(), 0.5);
                        }
                        else
                        {
                            await SplitView.DisplayAlert("No Microphone",
                                                         "The Microphone is not available for this device. Please check in the device settings to see if the Microphone has been disabled.",
                                                         "OK", null);
                        }
                    };
                    Gl_AddAudio.GestureRecognizers.Add(tapAddAudio);
                }
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Exemplo n.º 3
0
 /// ------------------------------------------------------------------------------------------------
 #region Public Constructor
 /// ------------------------------------------------------------------------------------------------
 ///
 public EnvironmentsView(PopupLayouts parentPopup)
 {
     try
     {
         InitializeComponent();
         // Demo Environment Tapped.
         TapGestureRecognizer tapDemo = new TapGestureRecognizer();
         tapDemo.Tapped += (s, e) =>
         {
             parentPopup.DismisPopup();
             AppData.Environment = OnSiteEnvironments.Sales;
         };
         Gl_Demo.GestureRecognizers.Add(tapDemo);
         // Test Environment Tapped.
         TapGestureRecognizer tapTest = new TapGestureRecognizer();
         tapTest.Tapped += (s, e) =>
         {
             parentPopup.DismisPopup();
             AppData.Environment = OnSiteEnvironments.Staging;
         };
         Gl_Test.GestureRecognizers.Add(tapTest);
         // Dev Environment Tapped.
         TapGestureRecognizer tapDev = new TapGestureRecognizer();
         tapDev.Tapped += (s, e) =>
         {
             parentPopup.DismisPopup();
             AppData.Environment = OnSiteEnvironments.Dev;
         };
         Gl_Dev.GestureRecognizers.Add(tapDev);
         // Live Environment Tapped.
         TapGestureRecognizer tapLive = new TapGestureRecognizer();
         tapLive.Tapped += (s, e) =>
         {
             parentPopup.DismisPopup();
             AppData.Environment = OnSiteEnvironments.Production;
         };
         Gl_Live.GestureRecognizers.Add(tapLive);
         // QA Environment Tapped.
         TapGestureRecognizer tapQa = new TapGestureRecognizer();
         tapQa.Tapped += (s, e) =>
         {
             parentPopup.DismisPopup();
             AppData.Environment = OnSiteEnvironments.QA;
         };
         Gl_QA.GestureRecognizers.Add(tapQa);
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }
Exemplo n.º 4
0
        /// ------------------------------------------------------------------------------------------------

        /// ------------------------------------------------------------------------------------------------
        #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());
            }
        }
        /// ------------------------------------------------------------------------------------------------

        /// ------------------------------------------------------------------------------------------------
        #region Private functions
        /// <summary>
        /// Item tapped in visits 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           items = (GroupedListModel)e.Item;
                    SRiRecordMeta record;
                    record = AppData.PropertyModel.SelectedRecord.Record;
                    var entityKey = Guid.NewGuid().ToString();
                    AppData.PropertyModel.SelectedVisit = new SelectedVisit(new SRiVisitMeta()
                    {
                        Organisation = record.Organisation,
                        EntityMeta   = new SRiEntityMeta("entitykey", entityKey),
                        Received     = "2",
                        ID           = entityKey,
                        Version      = "",
                        Visit        = new SRiVisit()
                        {
                            EntityKey        = entityKey,
                            KeyVal           = OnSiteSettings.NewTempKey,
                            UVersion         = "",
                            InspectionKeyVal = record.Record.Inspections[0].KeyVal,
                            MDKeyVal         = record.Record.Inspections[0].MdKeyVal,
                            MDSubSys         = record.Record.Inspections[0].MdSubSys,
                            IdoxID           = AppData.MainModel.CurrentUser.IdoxId,
                            RecordEntityKey  = record.Record.EntityKey,
                            VisitType        = items.Code,
                            //Officer= AppData.MainModel.Environment!=OnSiteEnvironments.Sales? AppData.MainModel.CurrentUser.OfficerCode(record.Organisation):"Demo",
                        }
                    }, AppData.PropertyModel.SelectedRecord.NewVisitMapping(0), true);
                    AppData.PropertyModel.SelectedVisit.Visit.EntityMeta.StringFields.Add("str_idoxid", AppData.MainModel.CurrentUser.IdoxId);
                    AppData.PropertyModel.SelectedVisit.Visit.Visit.Status = SyncStatus.New;
                    //await SplitView.Instace().Navigation.PushModalAsync(new VisitActionPage(),true);
                    //App.Current.MainPage = new VisitActionPage();
                    PageNavigation.PushMainPage(new VisitActionPage());
                    _isExecute = true;
                }
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Exemplo n.º 6
0
        /// ------------------------------------------------------------------------------------------------
        #region Public Constructor
        /// ------------------------------------------------------------------------------------------------
        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="T:ActionView{T}"/> class.
        /// </summary>
        /// ------------------------------------------------------------------------------------------------
        ///
        public AddView(PopupLayouts parentPopup)
        {
            InitializeComponent();
            if (parentPopup == null)
            {
                return;
            }
            //Add new image
            var tapAddImage = new TapGestureRecognizer();

            tapAddImage.Tapped += (sender, e) =>
            {
                parentPopup.DismisPopup();
                OnCameraCapture();
            };
            Gl_Add.GestureRecognizers.Add(tapAddImage);
        }
Exemplo n.º 7
0
        /// ------------------------------------------------------------------------------------------------

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

        private void TapGestures()
        {
            try
            {
                //Logout Tapped

                Tap_LogOut = new TapGestureRecognizer();
                Boxvw_LogOut.GestureRecognizers.Add(Tap_LogOut);
                Lbl_LogOut.GestureRecognizers.Add(Tap_LogOut);
                Tap_LogOut.Tapped += async(s, args) =>
                {
                    if (AppData.Environment.ToString() != "Sales")
                    {
                        parentPopup.DismisPopup();
                        if (Reachability.InternetConnectionStatus() !=
                            ReachabilityNetworkStatus.NotReachable)
                        {
                            if (await SplitView.DisplayAlert("Log Out", "Do you want to Log Out ?", "YES", "NO"))
                            {
                                //On Logout or ReAuthentication when new request is in progress the new request operation must cancel
                                AppContext.AppContext.NewRecordInProgress = false;
                                LoginPage.LogOut();
                                Application.Current.MainPage = new LoginPage();
                            }
                        }
                        else
                        {
                            await
                            SplitView.Instace()
                            .DisplayAlert("No Network Connection",
                                          "Please ensure the device has a network connection before logging out entirely, re-authentication or authenticating a new user requires network access.",
                                          "OK");
                        }
                    }
                    else
                    {
                        parentPopup.DismisPopup();
                        if (await SplitView.DisplayAlert("Log Out", "Do you want to Log Out ?", "YES", "NO"))
                        {
                            //On Logout when new request is on progress the new request operation must cancel
                            AppContext.AppContext.NewRecordInProgress = false;
                            LoginPage.LogOut();
                            Application.Current.MainPage = new LoginPage();
                        }
                    }

                    //parentPopup.DismisPopup();
                };
                //Help Tapped
                Tap_Help = new TapGestureRecognizer();
                Boxvw_Help.GestureRecognizers.Add(Tap_Help);
                Lbl_Help.GestureRecognizers.Add(Tap_Help);
                Tap_Help.Tapped += async(s, args) =>
                {
                    if (_isExecute)
                    {
                        _isExecute = false;
                        parentPopup.DismisPopup();
                        if (!SplitView.Instace().Navigation.ModalStack.Contains(AppContext.AppContext.HelpPageInstance))
                        {
                            await SplitView.Instace().Navigation.PushModalAsync(AppContext.AppContext.HelpPageInstance = new HelpPage(), true);
                        }
                        _isExecute = true;
                    }
                };

                //About Tapped
                Tap_About = new TapGestureRecognizer();
                Boxvw_About.GestureRecognizers.Add(Tap_About);
                Lbl_About.GestureRecognizers.Add(Tap_About);
                Tap_About.Tapped += (s, args) =>
                {
                    parentPopup.DismisPopup();
                    SplitView.Instace().Navigation.PushModalAsync(new AboutPage(), true);
                };
                Tap_ClrContent = new TapGestureRecognizer();
                Boxvw_ClrContent.GestureRecognizers.Add(Tap_ClrContent);
                Lbl_ClrContent.GestureRecognizers.Add(Tap_ClrContent);
                Tap_ClrContent.Tapped += async(s, args) =>
                {
                    parentPopup.DismisPopup();
                    if (AppContext.AppContext.NewRecordInProgress)
                    {
                        SplitView.DisplayAlert("New Record creation is in progress", "Please save or cancel new sevice record to proceed", "OK", null);
                        return;
                    }
                    else
                    {
                        if (await SplitView.DisplayAlert("Clear Content",
                                                         "Are you sure you want to remove all content from the app?\r\nAll unsaved changes will be lost.", "Yes", "No"))
                        {
                            AppData.PropertyModel.Clear();
                            SplitView.Instace().FilterCheckAvailable(false);
                            AppData.PropertyModel.Sort   = SortMode.Date;
                            AppData.PropertyModel.Filter = FilterMode.All;
                        }
                    }
                };
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }