Exemplo n.º 1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Perform any additional setup after loading the view, typically from a nib.
            NavigationItem.LeftBarButtonItem = EditButtonItem;

            ThreadPool.QueueUserWorkItem(state =>
            {
                var lst = new iportogruaroLibraryShared.mainCategorys().getMainCategorys(true);

                InvokeOnMainThread(delegate {
                    TableView.Source = dataSource = new DataSource(this, lst);
                    TableView.ReloadData();
                }
                                   );
            });
        }
Exemplo n.º 2
0
        public void loadpos(bool onlyimages)
        {
            if (onlyimages == false)
            {
                new iportogruaroLibraryShared.Mainiportogruaropos().refreshData();



                new iportogruaroLibraryShared.mainEventos().refreshData();

                new iportogruaroLibraryShared.mainNews().refreshData();                   //20130717
            }
            GC.Collect();
            //return;
            ThreadPool.QueueUserWorkItem(state =>
            {
                Console.WriteLine("<<<<<<< IMAGES >>>>>>>>");

                var lst = new iportogruaroLibraryShared.mainCategorys().getAllCategorys(true);


                foreach (iportogruarocategories c in lst)
                {
                    var img = ImageHotel(c.icon_image.Replace("/", "").Replace("-", "").Replace(".", "").Replace(",", "") + ".png", c.icon_image);// ;;    UIImage.LoadFromData (imageData);//   .Add(new BasicTableImageItem(){ Image = new UIImageView (   UIImage.LoadFromData (imageData)).Image , RoomType  =  controller.RoomType});
                    if (img != null)
                    {
                        img.Dispose();
                        img = null;
                    }
                }
                lst = null;
                GC.Collect();
                var lstpos = new iportogruaroLibraryShared.Mainiportogruaropos().getAllPost();

                foreach (iportogruaropos c in lstpos)
                {
                    var img = ImageHotelPos(c.icon.Replace("/", "").Replace("-", "").Replace(".", "").Replace(",", "") + ".png", c.icon);

                    if (img != null)
                    {
                        img.Dispose();
                        img = null;
                    }

                    img = ImageHotel(c.photo.Replace("/", "").Replace("-", "").Replace(".", "").Replace(",", "") + "detail_.png", c.photo);

                    if (img != null)
                    {
                        img.Dispose();
                        img = null;
                    }

                    /*
                     * img = ImageHotel(c.icon.Replace("/","").Replace("-","").Replace(".","").Replace(",","")+".png", c.icon);
                     *
                     * if (img != null)
                     * {
                     *      img.Dispose();
                     *      img = null;
                     * }
                     */
                    foreach (galeriaImagenes g in c.galerias)
                    {
                        var img2 = ImageHotel(g.urlString.Replace("/", "").Replace("-", "").Replace(".", "").Replace(",", "") + ".png", g.urlString);
                        if (img2 != null)
                        {
                            img2.Dispose();
                            img2 = null;
                        }
                    }
                }

                lstpos = null;
                Console.WriteLine("<<<<<<< END  IMAGES >>>>>>>>");
                //dowload and save the image

                GC.Collect();
            });
        }
Exemplo n.º 3
0
        public void showSearchBox()
        {
            DialogViewController searchBoxDialog;

            searchBoxEntry = new EntryElement("Cerca", "Digita parola:", "");

            searchBoxDialog = new DialogViewController(new RootElement("iportogruaro")
            {
                new Section(sectionHeaderTitle("Digita parola:"))
                {
                    searchBoxEntry
                },
            });

            //flightNumerEntry.KeyboardType = UIKeyboardType.Default;

            searchBoxDialog.TableView.BackgroundView  = null;
            searchBoxDialog.TableView.BackgroundColor = UIColor.White;
            UINavigationController nav = new UINavigationController(searchBoxDialog);

            nav.NavigationBar.TintColor = headerColor;

            this.PresentViewController(nav, true, null);
            searchBoxEntry.ReturnKeyType = UIReturnKeyType.Search;
            searchBoxEntry.ShouldReturn += delegate {
                starthud();

                ThreadPool.QueueUserWorkItem(state =>
                {
                    string key = "";
                    InvokeOnMainThread(delegate {
                        key = searchBoxEntry.Value;
                    });
                    var lst = new iportogruaroLibraryShared.mainCategorys().getMainCategorysSearch(key);
                    if (lst != null && lst.Count > 0)
                    {
                        InvokeOnMainThread(delegate {
                            nav.DismissViewController(false, null);
                            this.NavigationController.PushViewController(new UiCategoryList(true)
                            {
                                lstSearch = lst
                            }, true);
                            stophud();
                        }
                                           );
                    }
                });

                stophud();

                return(true);
            };

            searchBoxDialog.NavigationItem.RightBarButtonItem = new UIBarButtonItem("Cerca", UIBarButtonItemStyle.Plain, (s, e) => {
                starthud();

                ThreadPool.QueueUserWorkItem(state =>
                {
                    string key = "";
                    InvokeOnMainThread(delegate {
                        key = searchBoxEntry.Value;
                    });
                    var lst = new iportogruaroLibraryShared.mainCategorys().getMainCategorysSearch(key);
                    if (lst != null && lst.Count > 0)
                    {
                        InvokeOnMainThread(delegate {
                            nav.DismissViewController(false, null);
                            this.NavigationController.PushViewController(new UiCategoryList(true)
                            {
                                lstSearch = lst
                            }, true);
                            stophud();
                        }
                                           );
                    }
                });

                stophud();
            });

            searchBoxDialog.NavigationItem.LeftBarButtonItem = new UIBarButtonItem("Annulla", UIBarButtonItemStyle.Plain, (s, e) => {
                nav.DismissViewController(true, null);
            });
        }
Exemplo n.º 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();
            //}
        }
Exemplo n.º 5
0
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);
            CurrentPage = 1;
            try{
                var ad = (AppDelegate)UIApplication.SharedApplication.Delegate;
                ad.GetLocation();

                int pulltoRefresh = NSUserDefaults.StandardUserDefaults.IntForKey("pulltoRefresh");

                if (pulltoRefresh == 1)
                {
                    NSUserDefaults.StandardUserDefaults.SetInt(0, "pulltoRefresh");
                    base.starthud();



                    reloading = true;
                    ThreadPool.QueueUserWorkItem(state =>
                    {
                        var lst = new iportogruaroLibraryShared.mainCategorys().getMainCategorys(true);



                        InvokeOnMainThread(delegate {
                            tableCategory.Source = new sourceMainCategory(this, lst);
                            tableCategory.ReloadData();
                            reloading = false;
                            base.stophud();
                        }
                                           );
                    });
                }
                else
                {
                    bool islandCape = false;
                    if (!UserInterfaceIdiomIsPhone)
                    {
                        int iniheight = 110;
                        int iniweight = 320;
                        switch (InterfaceOrientation)
                        {
                        case UIInterfaceOrientation.LandscapeLeft:
                        case UIInterfaceOrientation.LandscapeRight:
                            //iniheight = 240;
                            iniheight  = 290;
                            iniweight  = 1024;
                            islandCape = true;
                            break;

                        default:
                            iniweight = 1024;
                            iniheight = 290;
                            break;
                        }

                        setScroll(iniweight, iniheight);
                        loadMainCategoryOrientation(islandCape);
                    }
                }
            }
            catch (System.Exception ex) {
                Console.WriteLine(ex.ToString());
            }
        }
Exemplo n.º 6
0
        public void loadMainCategory()
        {
            if (tableCategory != null)
            {
                foreach (UIView v in tableCategory)
                {
                    v.RemoveFromSuperview();
                    v.Dispose();
                }

                tableCategory.RemoveFromSuperview();
                tableCategory.Dispose();
                tableCategory = null;
            }
            tableCategory = new UITableView(new RectangleF(0, 0, 0, 1), UITableViewStyle.Plain);

            /*
             * if (UserInterfaceIdiomIsPhone)
             * {
             * if (!IsTall)
             * {
             *      switch (heightscroll) {
             *      case 150:
             *              tableCategory = new UITableView(new RectangleF (0,   heightscroll + 2, widthscroll, 120),UITableViewStyle.Plain);
             *              break;
             *      default:
             *              tableCategory = new UITableView(new RectangleF (0,   heightscroll +2 , widthscroll, 310),UITableViewStyle.Plain);
             *              break;
             *      }
             *
             * }
             * else
             * {
             *      switch (heightscroll) {
             *      case 150:
             *              tableCategory = new UITableView(new RectangleF (0,   heightscroll + 2, widthscroll, 100),UITableViewStyle.Plain);
             *              break;
             * case 100:
             * tableCategory = new UITableView(new RectangleF (0,   heightscroll + 2, widthscroll, 165),UITableViewStyle.Plain);
             * break;
             *      default:
             *              tableCategory = new UITableView(new RectangleF (0,   heightscroll + 2, widthscroll, 400),UITableViewStyle.Plain);
             *              break;
             *      }
             *      //tableCategory = new UITableView(new RectangleF (0,  heightscroll, widthscroll, 300),UITableViewStyle.Plain);
             * }
             * }
             * else
             * {
             *
             *      switch (InterfaceOrientation) {
             *              case UIInterfaceOrientation.LandscapeLeft:
             *              case UIInterfaceOrientation.LandscapeRight:
             *              switch (heightscroll) {
             *                      case 240:
             *                      tableCategory = new UITableView(new RectangleF (0,   heightscroll + 2, widthscroll, 200),UITableViewStyle.Plain);
             *                      break;
             *                      default:
             *                      tableCategory = new UITableView(new RectangleF (0,   heightscroll, widthscroll, 300),UITableViewStyle.Plain);
             *                      break;
             *              }
             *              break;
             *              default:
             *              switch (heightscroll) {
             *                      case 240:
             *                      tableCategory = new UITableView(new RectangleF (0,   heightscroll, widthscroll, 500-40),UITableViewStyle.Plain);
             *                      break;
             *                      default:
             *                      tableCategory = new UITableView(new RectangleF (0,   heightscroll, widthscroll, 700-40),UITableViewStyle.Plain);
             *                      break;
             *              }
             *              break;
             *      }
             *
             * }
             */
            setLoadingViewStyle(tableCategory);
            tableCategory.BackgroundView  = null;           //new UIImageView (UIImage.FromFile ("images/bg-flightscreen.png"));
            tableCategory.BackgroundColor = UIColor.White;
            tableCategory.SeparatorStyle  = UITableViewCellSeparatorStyle.None;



            this.View.AddSubview(tableCategory);
            base.starthud();
            reloading = true;
            ThreadPool.QueueUserWorkItem(state =>
            {
                var lst = new iportogruaroLibraryShared.mainCategorys().getMainCategorys(true);

                new iportogruaroLibraryShared.Mainiportogruaropos().getAllPost(true);

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

                InvokeOnMainThread(delegate {
                    try
                    {
                        tableCategory.Source = new sourceMainCategory(this, lst);
                        tableCategory.ReloadData();
                        reloading = false;
                        base.stophud();
                    }
                    catch (System.Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                        reloading = false;
                        base.stophud();
                    }
                }
                                   );
            });

            if (UserInterfaceIdiomIsPhone)
            {
                loadMainCategoryOrientation(false);
            }
        }