public void syncProgressMessage()
        {
            try
            {
                AppDelegate.dataSync.notifiy -= syncProgressHandler;

                UIAlertView alert = new UIAlertView("Alert", "Sync is in progress", null, NSBundle.MainBundle.LocalizedString("OK", "OK"));
                alert.Show();

                if (this.NavigationController != null)
                {
                    if (this.NavigationController.ViewControllers[this.NavigationController.ViewControllers.Count() - 2] != null)
                    {
                        DashBoardViewController dashBoardViewController = (DashBoardViewController)(this.NavigationController.ViewControllers[this.NavigationController.ViewControllers.Count() - 2]);
                        int syncCount = syn.getPendingSyncCount();
                        dashBoardViewController.updateSyncCount(syncCount);
                    }

                    if (this.NavigationController.ViewControllers.Contains(this))
                    {
                        this.NavigationController.PopViewController(true);
                    }
                }
            }
            catch (Exception ex) {
                Debug.WriteLine("Exception occured method PdfViewer due to : " + ex.Message);
            }
        }
Пример #2
0
        /// <summary>
        /// home touch up inside method.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        void BtnHome_TouchUpInside(object sender, EventArgs e)
        {
            DashBoardViewController dashBoardViewController = this.Storyboard.InstantiateViewController("DashBoardViewController") as DashBoardViewController;

            ClearMemory();
            this.NavigationController.PushViewController(dashBoardViewController, false);
        }
Пример #3
0
        /// <summary>
        /// Saves the Reports
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        void BtnFinalizeSave_TouchUpInside(object sender, EventArgs e)
        {
            if (InspectionResult != null)
            {
                InspectionTransactionService inspectionTransactionService = new InspectionTransactionService(AppDelegate.DatabaseContext);
                if (InspectionResult != null && !string.IsNullOrEmpty(InspectionResult.pass))
                {
                    InspectionResult.IsFinalise = 1;
                }
                inspectionTransactionService.UpdateInspectionTransaction(InspectionResult);
                SaveAllReports();
            }
//			btnLogOut.Enabled = false;

            btnSync.Enabled = false;
            AppDelegate.stopAutoSync();
            UIApplication.SharedApplication.IdleTimerDisabled = true;

            syncData(false);

            AppDelegate.startAutoSync();

            ClearMemory();
            DashBoardViewController dashBoardViewController = this.Storyboard.InstantiateViewController("DashBoardViewController") as DashBoardViewController;

            this.NavigationController.PushViewController(dashBoardViewController, false);
        }
Пример #4
0
 public void UpdateCell(UITableView itemTableView, NSIndexPath indexPath, ReportView reports, UIViewController appDetailsTableController, DashBoardViewController dashViewCntlr)
 {
     try
     {
         ResetUIView();
         reportView = reports;
         if (reports != null)
         {
             appIDLabel.Text        = reports.AppID;
             inspectionIDLabel.Text = reports.InspectionType;
         }
         appDetailsController = appDetailsTableController;
         dashViewController   = dashViewCntlr;
     }
     catch (Exception ex) {
         Debug.WriteLine("Exception occured method UpdateCell due to : " + ex.Message);
     }
 }
Пример #5
0
        /// <summary>
        /// On authentication completion, user moves to Dashboard
        /// </summary>
        /// <param name="authenticatedUser">Authenticated user.</param>
        private void MoveToDashBoard(Model.AuthenticatedUser authenticatedUser)
        {
            if (authenticatedUser.Result.code == 0 || authenticatedUser.Result.code == 1)
            {
                AppDelegate.startAutoSync();
                DashBoardViewController dashBoardViewController = this.Storyboard.InstantiateViewController("DashBoardViewController") as DashBoardViewController;
                dashBoardViewController.IsIntiatedFromAppDelegate = true;
                dashBoardViewController.IsFirstLogin = authenticatedUser.IsFirstTimeLoggedIn;
                DashBoardViewController.Token        = authenticatedUser.UserDetails.Token;
                DashBoardViewController.UserName     = string.Concat(authenticatedUser.UserDetails.FirstName, " ", authenticatedUser.UserDetails.LastName);

                this.NavigationController.PushViewController(dashBoardViewController, true);
            }
            else if (authenticatedUser.UserDetails != null && !authenticatedUser.IsTokenActive)
            {
                UIAlertView alert = new UIAlertView(@"Alert", @"Invalid Token", null, NSBundle.MainBundle.LocalizedString("OK", "OK"));
                alert.Show();
            }
        }
Пример #6
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            try
            {
                UIApplication.SharedApplication.IdleTimerDisabled = false;


                databaseContext = CreateDB();
                app             = this;
                dataSync        = new Sync(databaseContext);
                //Your View Controller Identifiers defined in Interface Builder
                String firstViewControllerIdentifier  = @"LoginViewController";
                String secondViewControllerIdentifier = @"DashBoardViewController";

                //check if the key exists and its value
                LoginBAL loginBal = new LoginBAL(AppDelegate.DatabaseContext);
                Model.AuthenticatedUser authenticatedUser = loginBal.GetUserDetailsFromDatabase(AppDelegate.DatabaseContext);
                AppDelegate.user = authenticatedUser;


                bool isUserDetailsAvailableInDB = false;
                if (authenticatedUser != null && authenticatedUser.UserDetails != null && !string.IsNullOrEmpty(authenticatedUser.UserDetails.Token))
                {
                    authenticatedUser.IsTokenActive = CheckIfTokenIsActive(authenticatedUser.UserDetails.ExpiryDate);
                    isUserDetailsAvailableInDB      = true;
                }

                //check which view controller identifier should be used
                String viewControllerIdentifier = (isUserDetailsAvailableInDB && authenticatedUser.IsTokenActive)? secondViewControllerIdentifier : firstViewControllerIdentifier;

                //IF THE STORYBOARD EXISTS IN YOUR INFO.PLIST FILE AND YOU USE A SINGLE STORYBOARD
                UIStoryboard storyboard = Window.RootViewController.Storyboard;

                if (isUserDetailsAvailableInDB && authenticatedUser.IsTokenActive)
                {
                    startAutoSync();
                    viewControllerIdentifier = secondViewControllerIdentifier;
                    DashBoardViewController dashBoardViewController = storyboard.InstantiateViewController("DashBoardViewController") as DashBoardViewController;
                    dashBoardViewController.IsFirstLogin = authenticatedUser.IsFirstTimeLoggedIn;
                    DashBoardViewController.Token        = authenticatedUser.UserDetails.Token;
                    DashBoardViewController.UserName     = string.Concat(authenticatedUser.UserDetails.FirstName, " ", authenticatedUser.UserDetails.LastName);
                }
                else if (isUserDetailsAvailableInDB && !authenticatedUser.IsTokenActive)
                {
                    viewControllerIdentifier = firstViewControllerIdentifier;
                    deleteSession();
                    UIAlertView alert = new UIAlertView(@"Alert", @"Token Expired", null, NSBundle.MainBundle.LocalizedString("OK", "OK"));
                    alert.Show();
                }
                else
                {
                    viewControllerIdentifier = firstViewControllerIdentifier;
                    deleteSession();
                }
                //instantiate the view controller
                UIViewController presentedViewController = storyboard.InstantiateViewController(viewControllerIdentifier);
                if (presentedViewController is DashBoardViewController)
                {
                    (presentedViewController as DashBoardViewController).IsIntiatedFromAppDelegate = true;
                }
                //UIApplication.SharedApplication.IdleTimerDisabled = true;
                UINavigationController navController = (UINavigationController)Window.RootViewController;
                navController.PushViewController(presentedViewController, false);

                return(true);
            }
            catch (Exception ex)
            {
                return(true);
            }
        }