Re: [mono-android] Nothing being passed back from a webservice

2012-03-02 Thread Stuart Lodge
At a guess, it's to do with timing.

You could be returning your list f from your function before the Async
network call has occurred.

To get around this, change your method from:

   private List DoThis()

to:

   private void DoThisAndCallMeBack(Action> callback)

And then modify the return statements to callback calls:

List f = new List();
   if (checkForNetwork(true) != true)
   {
   f.Add("No network available");
callback(f);
   return;
   }

   List tableData = new List();
   POHWS.webservice.Service1 Service3 = new
POHWS.webservice.Service1();

   try
   {
   Service3.BeginGetUpcoming(**track, delegate(IAsyncResult
iar)
   {
   tableData = Service3.EndGetUpcoming(iar).**ToList();
   Android.App.Application.**
SynchronizationContext.Post(**delegate
   {
   if (tableData.Count == 0)
   {
   tableData[0].PostTime = "No data from the
webservice";
   }

   f.Add(tableData[0].PostTime);
   Console.WriteLine("f[0] = {0}", f[0]);
   callback (f);
   }, null);
   }, null);
   }
   catch (Exception oe)
   {
   f.Add(oe.ToString());
   callback(f);
   }

You might also need to marshall the callback calls on to the UI thread

Hope that works and helps

Stuart

On 2 March 2012 02:29, Paul Johnson  wrote:

> Hi,
>
> This is probably down to me being a klutz, but can anyone spot why nothing
> is being returned? The Console.WriteLine is showing that something is being
> added to the list. I'm guessing a scope problem...
>
> (calling routine)
> case 1:
>List race = new List();
>currentview.**SetBackgroundDrawable(**
> Resources.GetDrawable(**Resource.Drawable.Back_**BobMoore));
>text.Text = Resources.GetString(Resource.**
> String.ComingSoon);
>webservice_user getRace = new webservice_user();
>race = getRace.getUpcomingRaces("**
> fairmeadowsUpcoming");
>races = race.ToArray();
>break;
>
> (webservice)
> List f = new List();
>if (checkForNetwork(true) != true)
>{
>f.Add("No network available");
>return f;
>}
>else
>{
>List tableData = new List();
>POHWS.webservice.Service1 Service3 = new
> POHWS.webservice.Service1();
>
>try
>{
>Service3.BeginGetUpcoming(**track,
> delegate(IAsyncResult iar)
>{
>tableData = Service3.EndGetUpcoming(iar).**
> ToList();
>Android.App.Application.**
> SynchronizationContext.Post(**delegate
>{
>if (tableData.Count == 0)
>{
>tableData[0].PostTime = "No data from the
> webservice";
>}
>
>f.Add(tableData[0].PostTime);
>Console.WriteLine("f[0] = {0}", f[0]);
>}, null);
>}, null);
>}
>catch (Exception oe)
>{
>f.Add(oe.ToString());
>return f;
>}
>return f;
>}
>
> Not sure, it could also be the 
> Android.App.Application.**SynchronizationContext.Post
> code.
>
> Any help here would be appreciated. Thanks
>
> Paul
> __**_
> Monodroid mailing list
> Monodroid@lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/**mailman/listinfo/monodroid
>
>
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


[mono-android] Multiple proj configurations

2012-03-02 Thread tsukrov
Hi!

I would like to have different project configuration for different
architectures.
This way I could build the proj separately for x86/arm/whatever...

Is it possible?
I could not manage to save this setting for the conf.

--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Multiple-proj-configurations-tp5530720p5530720.html
Sent from the Mono for Android mailing list archive at Nabble.com.
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


Re: [mono-android] Nothing being passed back from a webservice

2012-03-02 Thread nodoid
Hi,

That's getting me a good bit further, but there is still something not quite
right. The new code looks like this

private string rTrack;

public ListgetUpcomingRaces(string track)
{
Listf = new List();
rTrack = track;
f = getUpcomingRacesCallBack(cb);
return f;
}

private List
getUpcomingRacesCallBack(Action> callback)
{
List f = new List();
if (checkForNetwork(true) != true)
{
f.Add("No network available");
callback(f);
}
else
{
List tableData = new
List();
POHWS.webservice.Service1 Service3 = new
POHWS.webservice.Service1();

try
{
Service3.BeginGetUpcomingRacesList(rTrack,
delegate(IAsyncResult iar)
{
tableData =
Service3.EndGetUpcomingRacesList(iar).ToList();
   
Android.App.Application.SynchronizationContext.Post(delegate
{
if (tableData.Count == 0)
{
tableData[0].PostTime = "No Upcoming Races
Found within the next 7 days";
}
else
{
for (int i = 0; i < tableData.Count; ++i)
f.Add(tableData[i].PostTime);
}
callback(f);
//return f;
}, null);
callback(f);
}, null);
}
catch (Exception oe)
{
f.Add(oe.ToString());
callback(f);
//return f;
}
}
return f;
}

I have tried this code and it returns nothing (much as before). Now, if I
change the 2nd method to a void, how can I then propogate List to
return it to the caller?

Thanks

Paul

--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Nothing-being-passed-back-from-a-webservice-tp5529892p5531003.html
Sent from the Mono for Android mailing list archive at Nabble.com.
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


Re: [mono-android] Problem Connection Sqlserver in Release Mode

2012-03-02 Thread manavmenace
Just wanted to know, how that problem got solved, We are also facing the same
problem.
Also, is there some other way for database conection, like Client Server
architechture.

--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Problem-Connection-Sqlserver-in-Release-Mode-tp4912877p5530220.html
Sent from the Mono for Android mailing list archive at Nabble.com.
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


Re: [mono-android] Nothing being passed back from a webservice

2012-03-02 Thread Stuart Lodge
Passing in an Action is an asynchronous programming trick - I think
this is "functional programming" (and someone will hopefully correct me if
I'm wrong.

Basically you would declare your method like:
   private void
getUpcomingRaces(Action> callback) { ... }

Then you would call it with:

private void SomeMethod()
{
getUpcomingRaces((list) => {
Console.WriteLine("list received of size " + list.Count);
foreach (var line in list)
{
Console.WriteLine(line);
}
});
}

Or you could pass in a method group instead of an anonymous method if you
prefer - e.g.:

private void SomeMethod()
{
getUpcomingRaces(ListProcessor);
}

private void ListProcessor(List list)
{
Console.WriteLine("list received of size " + list.Count);
foreach (var line in list)
{
Console.WriteLine(line);
}
}





On 2 March 2012 13:43, nodoid  wrote:

> Hi,
>
> That's getting me a good bit further, but there is still something not
> quite
> right. The new code looks like this
>
>private string rTrack;
>
>public ListgetUpcomingRaces(string track)
> {
>Listf = new List();
> rTrack = track;
>f = getUpcomingRacesCallBack(cb);
>return f;
>}
>
>private List
> getUpcomingRacesCallBack(Action> callback)
> {
>List f = new List();
>if (checkForNetwork(true) != true)
>{
>f.Add("No network available");
>callback(f);
>}
> else
>{
>List tableData = new
> List();
> POHWS.webservice.Service1 Service3 = new
> POHWS.webservice.Service1();
>
>try
>{
> Service3.BeginGetUpcomingRacesList(rTrack,
> delegate(IAsyncResult iar)
>{
>tableData =
> Service3.EndGetUpcomingRacesList(iar).ToList();
>
> Android.App.Application.SynchronizationContext.Post(delegate
>{
>if (tableData.Count == 0)
>{
> tableData[0].PostTime = "No Upcoming Races
> Found within the next 7 days";
>}
>else
>{
>for (int i = 0; i < tableData.Count; ++i)
>f.Add(tableData[i].PostTime);
>}
>callback(f);
>//return f;
>}, null);
>callback(f);
> }, null);
>}
>catch (Exception oe)
>{
>f.Add(oe.ToString());
>callback(f);
> //return f;
>}
>}
>return f;
>}
>
> I have tried this code and it returns nothing (much as before). Now, if I
> change the 2nd method to a void, how can I then propogate List to
> return it to the caller?
>
> Thanks
>
> Paul
>
> --
> View this message in context:
> http://mono-for-android.1047100.n5.nabble.com/Nothing-being-passed-back-from-a-webservice-tp5529892p5531003.html
> Sent from the Mono for Android mailing list archive at Nabble.com.
> ___
> Monodroid mailing list
> Monodroid@lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
>
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


[mono-android] Android compatibility pack

2012-03-02 Thread Piotr Kryger
Hi,

I would like to use fragments API in my app. The problem is, my app should
also support Android 2.2/2.3.
In java you can use Android Compatibility Pack to access fragments even on
Android 1.6.
In M4A , AFAIK, it won't be possible since there is no way to inherit java
types defined in third party jar (or maybe there is a way?).

So, the question is, when can I expect better support for third party jars?
Is there a chance M4A binding for compatibility pack will be shipped in
near future, as it happened  recently with google maps jar?

Thanks,
Piotr
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


Re: [mono-android] Android compatibility pack

2012-03-02 Thread Jonathan Pryor
On Mar 2, 2012, at 4:44 PM, Piotr Kryger wrote:
> In M4A , AFAIK, it won't be possible since there is no way to inherit java 
> types defined in third party jar (or maybe there is a way?).

There is a way, it's just very painful. Proper docs haven't been published, but 
there is a sample that shows manual binding:


https://github.com/xamarin/monodroid-samples/blob/master/SanityTests/Adder.java

https://github.com/xamarin/monodroid-samples/blob/master/SanityTests/ManagedAdder.cs

The upcoming 4.2 series will include tooling to automate much of the binding 
drudgery; if possible, I'd suggest waiting. The 4.2 release will also contain 
bindings for the compatibility libraries.

 - Jon

___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


[mono-android] UI threading problem

2012-03-02 Thread nodoid
Hi,

This could possibly be down to my current state of needing sleep but then
again, it could be something else. I've searched for examples on how to fix
the problem below, but can't seem to find what I need and it's starting to
drive me potty!

Essentially, I have a race condition whereby the webservice is finishing way
after return has been given to the UI, so the UI is not displaying anything
at all.

Here's the code. The webservice does actually get the correct data which is
the pain of it all! The generateNewScreen method comes as a result of
clicking some text on a ListView area

(calling routine)
private void generateNewScreen(int t)
{
string[] races = new string[] { };
View currentview =
FindViewById(Resource.Id.relLayout);
TextView text =
FindViewById(Resource.Id.textTitle);
ListView listView =
FindViewById(Resource.Id.listView);
ImageView image =
FindViewById(Resource.Id.imgBack);
image.Visibility = ViewStates.Visible;
   
Console.WriteLine("t = {0}, addFactor = {1}", t,
addFactor);
switch (addFactor)
{
case 0:
switch (t)
{
case 0: races =
listviewInfo(Resource.Array.RaceTracks,
Resource.Drawable.Back_RaceHorsePlace, Resource.String.Tracks);
addFactor = 10;
break;
case 1: List
race = new List();
   
currentview.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.Back_BobMoore));
text.Text =
Resources.GetString(Resource.String.ComingSoon);
webservice_user
getRace = new webservice_user();
race =
getRace.getUpcomingRaces("RP");
races =
race.ToArray();
addFactor = 20;
break;
}
if (t < 6 || t == 7)
listView.Adapter = new
ArrayAdapter(this, Resource.Layout.listview_layout, races);
break;
}
 
(webservice)
private string rTrack;
 
public List getUpcomingRaces(string track)
{
List f = new List();
rTrack = track;
getUpcomingRacesCallBack((list) =>
{
f = list;
});
return f;
}
 
private void getUpcomingRacesCallBack(Action>
callback)
{
List f = new List();
if (checkForNetwork(true) != true)
{
f.Add("No network available");
callback(f);
}
else
{
List tableData = new
List();
POHWS.webservice.Service1 Service3 = new
POHWS.webservice.Service1();
try
{
Service3.BeginGetUpcomingRacesList(rTrack,
delegate(IAsyncResult iar)
{
tableData =
Service3.EndGetUpcomingRacesList(iar).ToList();
   
Android.App.Application.SynchronizationContext.Post(delegate
{
if (tableData.Count == 0)
{
f.Add("No Upcoming Races Found within
the next 7 days");
callback(f);
}
else
{
for (int i = 0; i < tableData.Count;
++i)
f.Add(tableData[i].PostTime);
callback(f);
}
}, null);
}, null);
}
catch (Exception oe)
{
f.Add(oe.ToString());
callback(f);
}
}
}

Is it possible

Re: [mono-android] Error Emulator OpenTk

2012-03-02 Thread johnHolmes
No problem, I've found a workaround.

Another topic. I'm not sure it's a real issue, but sometimes when the
AndroidGameView renders graphics stuff, like textures, but for some reason
there is a drop of FPS (app is running slow for a bit), I can cleary notice
some sort of flikering. All textures appears messed up. Is it normal? Am I
doing something wrong? There's a way to fix it? I'm having the same behavior
with the iPhoneOSGameView either on simulator or devices (iPhone, iPad).

--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Error-Emulator-OpenTk-tp5432528p5531685.html
Sent from the Mono for Android mailing list archive at Nabble.com.
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid


[mono-android] Version 4.0.4, Compatibility.v4.dll, and Fragments

2012-03-02 Thread JeffWeber
I notice version 4.0.4 has Mono.Android.Compatibility.v4.dll in it's list of
API Changes.

Does this contain support for Fragments for pre Honeycomb versions of
android?

I installed the 4.0.5 beta, but cannot find the compatibility stuff
anywhere. 

-Jeff Weber



--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Version-4-0-4-Compatibility-v4-dll-and-Fragments-tp5532063p5532063.html
Sent from the Mono for Android mailing list archive at Nabble.com.
___
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid