mail-archives/monodroid/2011-December/007714.html

169 строки
7.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [mono-android] How to use OnProgressChanged in m4a?
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20How%20to%20use%20OnProgressChanged%20in%20m4a%3F&In-Reply-To=D6E03668-95BA-47D2-961F-D48B12A46576%40xamarin.com">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="007711.html">
<LINK REL="Next" HREF="007713.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[mono-android] How to use OnProgressChanged in m4a?</H1>
<B>Hernani Delindro</B>
<A HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20How%20to%20use%20OnProgressChanged%20in%20m4a%3F&In-Reply-To=D6E03668-95BA-47D2-961F-D48B12A46576%40xamarin.com"
TITLE="[mono-android] How to use OnProgressChanged in m4a?">vampirevorador at gmail.com
</A><BR>
<I>Fri Dec 9 15:54:28 EST 2011</I>
<P><UL>
<LI>Previous message: <A HREF="007711.html">[mono-android] How to use OnProgressChanged in m4a?
</A></li>
<LI>Next message: <A HREF="007713.html">[mono-android] webservices not working in release mode
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#7714">[ date ]</a>
<a href="thread.html#7714">[ thread ]</a>
<a href="subject.html#7714">[ subject ]</a>
<a href="author.html#7714">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Thanks for the help. That works :)
On Fri, Dec 9, 2011 at 7:24 PM, Jonathan Pryor-2 [via Mono for Android] &lt;
<A HREF="http://lists.ximian.com/mailman/listinfo/monodroid">ml-node+s1047100n5062788h5 at n5.nabble.com</A>&gt; wrote:
&gt;<i> On Dec 9, 2011, at 12:52 PM, Hernani Delindro wrote:
</I>&gt;<i>
</I>&gt;<i> &gt; Hello, I'm still new to Mono for Android, and C# in general, but I would
</I>&gt;<i> like
</I>&gt;<i> &gt; some help on how to &quot;translate&quot; the following code to m4a, because I'm
</I>&gt;<i> &gt; having trouble understanding with how listeners and callbacks are
</I>&gt;<i> &gt; implemented in m4a.
</I>&gt;<i> &gt;
</I>&gt;<i> &gt; webview.SetWebChromeClient(new WebChromeClient() {
</I>&gt;<i> &gt; public void OnProgressChanged(WebView view, int progress)
</I>&gt;<i> &gt; {
</I>&gt;<i> &gt; activity.SetTitle(&quot;Loading...&quot;);
</I>&gt;<i> &gt; activity.SetProgress(progress * 100);
</I>&gt;<i> &gt;
</I>&gt;<i> &gt; if(progress == 100)
</I>&gt;<i> &gt; activity.SetTitle(Resource.String.app_name);
</I>&gt;<i> &gt; }
</I>&gt;<i> &gt; });
</I>&gt;<i>
</I>&gt;<i> That is an anonymous inner class, which C# doesn't support. Instead, you
</I>&gt;<i> need to turn it into a &quot;normal&quot; class (either at top-level or a nested
</I>&gt;<i> type, doesn't really matter):
</I>&gt;<i>
</I>&gt;<i> class WebChromeClientDelegator : WebChromeClient {
</I>&gt;<i> public Action&lt;WebView, int&gt; ProgressChanged;
</I>&gt;<i>
</I>&gt;<i> public override void OnProgressChanged (WebView view, int
</I>&gt;<i> newProgress)
</I>&gt;<i> {
</I>&gt;<i> if (ProgressChanged != null)
</I>&gt;<i> ProgressChanged (view, newProgress);
</I>&gt;<i> }
</I>&gt;<i> }
</I>&gt;<i>
</I>&gt;<i> // ...
</I>&gt;<i> webview.SetWebChromeClient (new WebChromeClientDelegator () {
</I>&gt;<i> ProgressChanged = (view, progress) =&gt; {
</I>&gt;<i> activity.SetTitle (&quot;Loading...&quot;);
</I>&gt;<i> activity.SetProgress (progress * 100);
</I>&gt;<i> if (progress == 100)
</I>&gt;<i> activity.SetTitle
</I>&gt;<i> (Resource.String.app_name);
</I>&gt;<i> },
</I>&gt;<i> });
</I>&gt;<i>
</I>&gt;<i> - Jon
</I>&gt;<i>
</I>&gt;<i> _______________________________________________
</I>&gt;<i> Monodroid mailing list
</I>&gt;<i> [hidden email] &lt;<A HREF="http://user/SendEmail.jtp?type=node&amp;node=5062788&amp;i=0">http://user/SendEmail.jtp?type=node&amp;node=5062788&amp;i=0</A>&gt;
</I>&gt;<i>
</I>&gt;<i> UNSUBSCRIBE INFORMATION:
</I>&gt;<i> <A HREF="http://lists.ximian.com/mailman/listinfo/monodroid">http://lists.ximian.com/mailman/listinfo/monodroid</A>
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> ------------------------------
</I>&gt;<i> If you reply to this email, your message will be added to the discussion
</I>&gt;<i> below:
</I>&gt;<i>
</I>&gt;<i> <A HREF="http://mono-for-android.1047100.n5.nabble.com/How-to-use-OnProgressChanged-in-m4a-tp5062534p5062788.html">http://mono-for-android.1047100.n5.nabble.com/How-to-use-OnProgressChanged-in-m4a-tp5062534p5062788.html</A>
</I>&gt;<i> To unsubscribe from How to use OnProgressChanged in m4a?, click here&lt;<A HREF="http://mono-for-android.1047100.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&amp;node=5062534&amp;code=dmFtcGlyZXZvcmFkb3JAZ21haWwuY29tfDUwNjI1MzR8MTc1OTk0NzAwMg==">http://mono-for-android.1047100.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&amp;node=5062534&amp;code=dmFtcGlyZXZvcmFkb3JAZ21haWwuY29tfDUwNjI1MzR8MTc1OTk0NzAwMg==</A>&gt;
</I>&gt;<i> .
</I>&gt;<i> NAML&lt;<A HREF="http://mono-for-android.1047100.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&amp;id=instant_html%21nabble%3Aemail.naml&amp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.InstantMailNamespace&amp;breadcrumbs=instant+emails%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml">http://mono-for-android.1047100.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&amp;id=instant_html%21nabble%3Aemail.naml&amp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.InstantMailNamespace&amp;breadcrumbs=instant+emails%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml</A>&gt;
</I>&gt;<i>
</I>
--
View this message in context: <A HREF="http://mono-for-android.1047100.n5.nabble.com/How-to-use-OnProgressChanged-in-m4a-tp5062534p5063005.html">http://mono-for-android.1047100.n5.nabble.com/How-to-use-OnProgressChanged-in-m4a-tp5062534p5063005.html</A>
Sent from the Mono for Android mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <A HREF="http://lists.ximian.com/pipermail/monodroid/attachments/20111209/87e2232e/attachment.html">http://lists.ximian.com/pipermail/monodroid/attachments/20111209/87e2232e/attachment.html</A>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="007711.html">[mono-android] How to use OnProgressChanged in m4a?
</A></li>
<LI>Next message: <A HREF="007713.html">[mono-android] webservices not working in release mode
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#7714">[ date ]</a>
<a href="thread.html#7714">[ thread ]</a>
<a href="subject.html#7714">[ subject ]</a>
<a href="author.html#7714">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/monodroid">More information about the Monodroid
mailing list</a><br>
</body></html>