コード例 #1
0
 protected void RefineSearchItems()
 {
     if (searchBar.Text == "")
     {
         TableView.Source = null;
         TableView.ReloadData();
         Console.WriteLine("Cancelled");
     }
     else
     {
         if (PublicationsViewController.NetworkAvailable())
         {
             _parser.SendSearchParameters(publications => InvokeOnMainThread(() => {
                 TableView.Source = new PublicationsViewSource(publications, NavigationController);
                 TableView.ReloadData();
             }), searchBar.Text, state => InvokeOnMainThread(() => {
                 var alert = new UIAlertView("Error".t(), "ErrorMessage".t(), null, "Ok", null);
                 //alert.Clicked += (sender, e) => UIApplication.SharedApplication.PerformSelector(new Selector("terminateWithSuccess"), null, 0f);
                 alert.Show();
             }));
         }
         else
         {
             _parser.LocalSearch(publications => InvokeOnMainThread(() => {
                 TableView.Source = new PublicationsViewSource(publications, NavigationController);
                 TableView.ReloadData();
             }), searchBar.Text);
         }
     }
 }
コード例 #2
0
        object SetUpDatabase()
        {
            var storage = SimpleStorage.EditGroup("preferences");
            var value   = storage.Get("companies_exist");

            if (value == null)
            {
                if (PublicationsViewController.NetworkAvailable())
                {
                    UpdateCompanies(storage);
                }
                else
                {
                    InvokeOnMainThread(() => {
                        var alert      = new UIAlertView("Network".t(), "NetworkMessage".t(), null, "Ok", null);
                        alert.Clicked += (sender, e) => UIApplication.SharedApplication.PerformSelector(new Selector("terminateWithSuccess"), null, 0f);
                        alert.Show();
                    });
                }
            }
            else
            {
                if (PublicationsViewController.NetworkAvailable())
                {
                    UpdateCompanies(storage);
                }
                else
                {
                    InvokeOnMainThread(() => {
                        aiSplash.StopAnimating();
                        OnReady.Invoke();
                    });
                }
            }
            return(null);
        }