Exemple #1
0
        private void loadData()
        {
            if (!InternetConnection.IsNetworkAvaialable(true))
            {
                return;
            }

            /*
             * ThreadPool.QueueUserWorkItem (state =>
             *
             *                {
             *
             *
             *
             * // new iportogruaroLibraryShared.mainCategorys().refreshData();
             * new iportogruaroLibraryShared.Mainiportogruaropos().refreshData();
             *      GC.Collect();
             * loadpos();
             * });
             */
        }
Exemple #2
0
        /*
         #region url Handle
         * public override bool HandleOpenURL (UIApplication application, NSUrl url)
         * {
         * return facebook.HandleOpenURL (url);
         * }
         * // Post 4.2 callback
         * public override bool OpenUrl (UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)
         * {
         * facebook.HandleOpenURL (url);
         * return true;
         * }
         #endregion
         */
        #region GPS
        public void GetLocation()
        {
            try{
                if (!InternetConnection.IsNetworkAvaialable(true))
                {
                    return;
                }
                Util.RequestLocation(newLocation => {
                    try
                    {
                        /*
                         *  var defaults = NSUserDefaults.StandardUserDefaults;
                         * if (defaults ["tripchiusername"] != null) {
                         * username = defaults ["tripchiusername"].ToString ();// as NSString;
                         * lat = NSUserDefaults.StandardUserDefaults.StringForKey ("Latitude");
                         * lon = NSUserDefaults.StandardUserDefaults.StringForKey ("Longitude");
                         * */
                        System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");

                        System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");

                        double lat = double.Parse(newLocation.Coordinate.Latitude.ToString().Replace(",", "."));
                        double lon = double.Parse(newLocation.Coordinate.Longitude.ToString().Replace(",", "."));
                        NSUserDefaults.StandardUserDefaults.SetString(lat.ToString(), "Latitude");
                        NSUserDefaults.StandardUserDefaults.SetString(lon.ToString(), "Longitude");
                        NSUserDefaults.StandardUserDefaults.Synchronize();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Errog GPS" + ex.ToString());                        //20130711
                    }
                }
                                     );
            }
            catch (Exception exs)
            {
                Console.WriteLine("Errog Main GPS" + exs.ToString());                //20130711
            }
        }
Exemple #3
0
        public void loadDataServer()
        {
            if (!InternetConnection.IsNetworkAvaialable(true))
            {
                using (var alert = new UIAlertView("iPortogruaro", "Spiacente nessun collegamento internet al momento", null, "OK", null)) {//Viajes Telcel//Aceptar
                    alert.Show();
                }

                return;
            }

            if (reloading)
            {
                return;
            }

            reloading = true;

            UIView.BeginAnimations("slideAnimation");

            UIView.SetAnimationDuration(2);
            UIView.SetAnimationCurve(UIViewAnimationCurve.EaseInOut);
            UIView.SetAnimationRepeatCount(2);
            UIView.SetAnimationRepeatAutoreverses(true);
            this.tblMain.ContentInset = UIEdgeInsets.Zero;
            UIView.CommitAnimations();

            /*
             *  [UIView beginAnimations:nil context:NULL];
             *  [UIView setAnimationDuration:.3];
             *  [tblMain setContentInset:UIEdgeInsetsMake(0.0f, 0.0f, 0.0f, 0.0f)];
             *  [refreshHeaderView setStatus:kPullToReloadStatus];
             *  [refreshHeaderView toggleActivityView:NO];
             *  [UIView commitAnimations];
             */
            if (modeSearch == true)
            {
                sourcePos      = new sourceSecondCategory(null, lstSearch);
                tblMain.Source = sourcePos;
                tblMain.ReloadData();
                setLoadingViewStyle(this.tblMain);
            }
            else
            {
                var indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White);
                this.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(indicator);
                indicator.StartAnimating();
                starthud();
                NSUserDefaults.StandardUserDefaults.SetInt(1, "pulltoRefresh");
                ThreadPool.QueueUserWorkItem(state =>
                {
                    lst = new Mainiportogruaropos().getPost(cat_id, false);

                    if (lst == null)
                    {
                        InvokeOnMainThread(delegate {
                            using (var alert = new UIAlertView("iPortogruaro", "Impossibile ricevere gli aggiornamenti dal server remoto", null, "OK", null))//Viajes Telcel//Aceptar
                            {
                                alert.Show();
                            }
                        }
                                           );
                    }

                    if (lst.Count <= 0)
                    {
                        InvokeOnMainThread(delegate {
                            using (var alert = new UIAlertView("iPortogruaro", "Impossibile ricevere gli aggiornamenti dal server remoto", null, "OK", null))//Viajes Telcel//Aceptar
                            {
                                alert.Show();
                            }
                        }
                                           );
                    }

                    if (lst[0].poi_id == "0")
                    {
                        InvokeOnMainThread(delegate {
                            using (var alert = new UIAlertView("iPortogruaro", "Impossibile ricevere gli aggiornamenti dal server remoto", null, "OK", null))//Viajes Telcel//Aceptar
                            {
                                alert.Show();
                            }
                        }
                                           );
                    }

                    InvokeOnMainThread(delegate {
                        tblMain.Source = new sourcePosItemsCustom(this, lst);
                        tblMain.ReloadData();
                        setLoadingViewStyle(this.tblMain);
                        this.NavigationItem.LeftBarButtonItem = null;
                        stophud();
                        reloading = false;
                    }
                                       );
                });
            }
            foreach (UIView vin in vLoading)
            {
                vin.RemoveFromSuperview();
                vin.Dispose();
            }
            vLoading.RemoveFromSuperview();
            vLoading.Dispose();
            vLoading = null;
            //startHud();
            //}
        }
Exemple #4
0
        public void loadDataServer()
        {
            if (!InternetConnection.IsNetworkAvaialable(true))
            {
                using (var alert = new UIAlertView("iPortogruaro", "Spiacente nessun collegamento internet al momento", null, "OK", null))//Viajes Telcel//Aceptar
                {
                    alert.Show();
                }
                reloading = false;
                return;
            }

            if (reloading)
            {
                return;
            }

            reloading = true;

            UIView.BeginAnimations("slideAnimation");

            UIView.SetAnimationDuration(2);
            UIView.SetAnimationCurve(UIViewAnimationCurve.EaseInOut);
            UIView.SetAnimationRepeatCount(2);
            UIView.SetAnimationRepeatAutoreverses(true);
            tableCategory.ContentInset = UIEdgeInsets.Zero;
            UIView.CommitAnimations();

            /*
             *  [UIView beginAnimations:nil context:NULL];
             *  [UIView setAnimationDuration:.3];
             *  [tblMain setContentInset:UIEdgeInsetsMake(0.0f, 0.0f, 0.0f, 0.0f)];
             *  [refreshHeaderView setStatus:kPullToReloadStatus];
             *  [refreshHeaderView toggleActivityView:NO];
             *  [UIView commitAnimations];
             */
            base.starthud();
            ThreadPool.QueueUserWorkItem(state =>
            {
                var lst = new iportogruaroLibraryShared.mainCategorys().getMainCategorys(false);

                var ad = (AppDelegate)UIApplication.SharedApplication.Delegate;
                ad.loadpos(false);


                if (lst == null)
                {
                    InvokeOnMainThread(delegate {
                        using (var alert = new UIAlertView("iPortogruaro", "Impossibile ricevere gli aggiornamenti dal server remoto", null, "OK", null))//Viajes Telcel//Aceptar
                        {
                            alert.Show();
                        }
                    }
                                       );
                    reloading = false;
                }

                if (lst.Count <= 0)
                {
                    InvokeOnMainThread(delegate {
                        using (var alert = new UIAlertView("iPortogruaro", "Impossibile ricevere gli aggiornamenti dal server remoto", null, "OK", null))//Viajes Telcel//Aceptar
                        {
                            alert.Show();
                        }
                    }
                                       );
                    reloading = false;
                }

                if (lst[0].cat_id == "0")
                {
                    InvokeOnMainThread(delegate {
                        using (var alert = new UIAlertView("iPortogruaro", "Impossibile ricevere gli aggiornamenti dal server remoto", null, "OK", null))//Viajes Telcel//Aceptar
                        {
                            alert.Show();
                        }
                    }
                                       );
                    reloading = false;
                }

                InvokeOnMainThread(delegate {
                    tableCategory.Source = new sourceMainCategory(this, lst);
                    tableCategory.ReloadData();
                    setLoadingViewStyle(tableCategory);
                    base.stophud();
                    reloading = false;
                }
                                   );
            });

            foreach (UIView vin in vLoading)
            {
                vin.RemoveFromSuperview();
                vin.Dispose();
            }
            vLoading.RemoveFromSuperview();
            vLoading.Dispose();
            vLoading = null;
            //startHud();
            //}
        }