Comments (14)
Here's the GIFs, just noticed (it happens fast). the .Show()
is called when the GIF starts and the .Dismiss()
is called when you see the Loading... sign blinking.
Hope that helps.
from btprogresshud.
@tbergeron show has a default timeout of 1 second, which may be shorter if you are doing stuff on the main thread - the the 1 second is 750ms of your stuff, and 250 of showing the HUD
I have just made a quick change in this commit which should allow you to pass in a longer timer. However, you will need to call
ProgressHUD.Shared.Show(...)
not
BTProgressHUD.Show(...)
as it's only on the underlying class, not the static wrapper (does the same thing tho). You might want to make sure that API.GetPins(..)
is working using a thread, not the main UI thread :)
from btprogresshud.
Oh, and here's the checkin with that change
from btprogresshud.
Alright, awesome! I was using the component from the Xamarin Component Store but I guess it won't be updated there yet. Would you mind telling how to use your component without the component store?
Can I simply open your solution and build it down to a DLL that I'll use within my solution? That's what I'm going to try.
Thanks a lot!
from btprogresshud.
@tbergeron yup, thats al I do, Just grab the code down (git pull https://xxxx) and build it. It should - better! - work out of the box.
from btprogresshud.
That did the trick! Also about the API.GetPins, you are right I'm using the main UI thread. That's something I'm going to have to learn to do hehe
Here's one last question, in the following example: How could I show a loading sign WHILE the interface is loading. If I put the .Show()
before the .MakeKeyAndVisible()
the sign just won't appear but if I put it after it will. I guess that's something else that I would have to separate from the current thread.
public void LoadMainUI() {
ProgressHUD.Shared.Show("Loading...", -1, ProgressHUD.MaskType.Black, 0.75);
tabBarController = new UITabBarController();
tabBarController.ViewControllers = new UIViewController []
{
new HomeViewController(),
new ProfileViewController()
};
window.RootViewController = tabBarController;
window.MakeKeyAndVisible();
}
Any insight about that? Thanks a lot, you've been of great help!
from btprogresshud.
I've not had to do that. I tend to load the minimum of stuff up front, so the UI load time hasn't been an issue.
And getting things of the main thread is fairly easy. Either you could
var pins = await API.GetPins();
and make GetPins async (see here: https://gist.github.com/nicwise/7026601) or just use Task.StartNew(() => { you code, then call the callback}); in GetPins.
I'd prefer the async/await version, personally. It's VERY clean. I'd need to check the syntax, but it might be as easy as:
public async Task<List<Pin>> GetPins() { return Task.StartNew(() => { your code return new List<Pin>(); //with your data in, obviously }); }
then your method becomes
BTProgressHUD.Show("Loading..."); var pins = await API.GetPins(GetPinsCallback); TableViewController.TableView.Source = new PinTableSource(pins); BTProgressHUD.Dismiss();
Nice and simple :)
from btprogresshud.
You're the coolest man on earth! Thanks for this, I love to learn by reading code and that's actually pretty straight-forward. That's indeed pretty clean!
from btprogresshud.
I'm going to really miss async/await when I'm in ObjectiveC land....
from btprogresshud.
I'm sure of it! I guess you've been using MonoTouch/Xamarin for a while, any drawbacks or thing you miss when not using straight Objective-C? Just curious as I discovered major negatives with a similar experiment with Titanium. Nothing to worry about though Xamarin is just perfect so far it nails every little aspect I was worried about. Thanks again!
from btprogresshud.
I've been using C# since v1beta, so I'm very used to it. Thats the main thing I'll miss - all the bits of System.*, generics, Tasks, async/await etc. UIKit and Cocoa are pretty complete - and you're using them in X.iOS already - but some of the other stuff is way nicer in C#.
from btprogresshud.
I think the same, I've worked a few years for a C# only place and it was a blast. Now working with .NET classes again is a breeze. I also work with them in Unity3D so it's fun to use them almost everywhere lately 👍
While re-implementing my GetPins method with async, I did like you mentioned with StartNew so my new method looks like:
public async Task<List<Pin>> GetPins() {
return Task.Factory.StartNew(() => {
return new List<Pin>();
}
}
and I keep getting this even after cleaning:
I tried looking around online but every example I seem to encounter looks like mine. Any idea?
from btprogresshud.
Oh I was doing the opposite! I had to put the async
keyword on the method I wanted to use await
in! That's where I goofed. Everything is back working now.
from btprogresshud.
yeah, that got me the first few times
from btprogresshud.
Related Issues (20)
- Can't resolve the reference 'UIKit.UIColor UIKit.UIColor::get_SystemBackground()' HOT 6
- Add NuGet to Maui Project HOT 8
- .NET MAUI Support? HOT 1
- ForDefaultWindow() can return `null`
- Nu get package HOT 2
- Crash: Window.Level not normal HOT 1
- iOS 11 - Appearance Changes HOT 6
- Using a lot of Memory on App HOT 2
- Doesn't supports .net standard 2.0 HOT 1
- Xamarin Forms : Acr userdialog loading indicator not showing in Center HOT 8
- Crashes on iOS 12 or older devices HOT 6
- v 1.3.1 Crash - Xamarin - Targeting 13.2 IOS HOT 8
- reviving old xmaring project; type BTProgressHUD exists in Acr.UserDialogs HOT 2
- Crash on iOS 15 HOT 17
- Release 1.3.4 seems to break Acr.UserDialogs HOT 5
- Namespace change makes it inconvenient to use methods in BTProgressHUD static class HOT 3
- How to disable accessibility focus for indicator and label?
- Object reference not set to an instance of an object HOT 1
- iOS 15 still crashes intermittently HOT 3
- MacCatalyst Support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from btprogresshud.