Re: [MonoTouch] How to show an imagegallery in IPAD application --

2012-08-07 Thread proindigo
Well I have started to develop [or at least get started].
I have added a new view controller AssemblyImageViewer with a scrollview and
a pagecontrol added to it.
Now on touch event of the 'View Photograph' button on my parent screen [see
picture above] I am trying to open a pop up and show this new view
controller.

But it is throwing a null reference exception: Object reference not set to
an instance of an object.

Here is the code I am using:
I am declaring the UIPopoverController at class level as:
UIPopoverController popctrlr;
Then :
partial void ViewAssemblyPhotoClick (MonoTouch.UIKit.UIButton sender)
{
if(popctrlr==null||popctrlr.ContentViewController==null)
{
popctrlr=new UIPopoverController(new 
AssemblyImageViewer());
popctrlr.SetPopoverContentSize(new SizeF(600f, 
600f), true);

}
if(popctrlr.PopoverVisible)
{
popctrlr.Dismiss (true);
popctrlr.Dispose ();
return;
}
else
{
popctrlr.PresentFromRect 
(btnViewAssemblyPhoto.Frame, this.View,
UIPopoverArrowDirection.Any, true);- this line throwing the
exception
}
}

What mistake am I committing?



--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/How-to-show-an-imagegallery-in-IPAD-application-tp4656388p4656408.html
Sent from the MonoTouch mailing list archive at Nabble.com.
___
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch


Re: [MonoTouch] How to show an imagegallery in IPAD application --

2012-08-07 Thread proindigo
Well solved that bit. I accidentally wrote some wrong code while creating the
outlets. Sorry for that.

Pop up being opened fine now. As of now it is blank. I'd like to fill it
with images fetched from database for a particular selected assembly and
implement the pagination with the page control..

Thanks.



--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/How-to-show-an-imagegallery-in-IPAD-application-tp4656388p4656409.html
Sent from the MonoTouch mailing list archive at Nabble.com.
___
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch


Re: [MonoTouch] Ensure Invoked on Main Thread (Performant???)

2012-08-07 Thread Rolf Bjarne Kvinge
Hi,

There are likely more efficient ways to this.

One way would be to have a [ThreadStatic] variable which you set to true in
your Main method. That way it'll only be true for the main thread.

The only way to really tell what is faster though is to actually measure
the difference (and do you actually know that this code is called a lot in
your app? If not, it won't be a problem. Have in mind that anything
UI-related will likely drown this piece of code completely).

Best regards,
Rolf

On Tue, Aug 7, 2012 at 12:43 PM, Phil Cockfield p...@cockfield.net wrote:

 I've got some same code which is designed to make sure an Action is
 invoked on the UI thread.
 Here it is here:

 https://gist.github.com/3284433

 It uses this to determine if it's running on the UI thread.  Is code the
 most efficient way to do this?  It seems a bit baroque to be marshalling
 out over a *bool_objc_msgSend *type method.


   private static bool IsMainThread()

 {

   return Messaging.bool_objc_msgSend(GetClassHandle(NSThread), 
 newSelector(
 isMainThread).Handle);

 }


 Thanks!

 --
 *Phil *Cockfield




 ___
 MonoTouch mailing list
 MonoTouch@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/monotouch


___
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch


Re: [MonoTouch] How to show an imagegallery in IPAD application --

2012-08-07 Thread proindigo
OK. Having some issues constructing the code block that is supposed to return
a collection of images.

Here is what I am trying to do --


public UIImage[] ReturnAssemblyImages(int assemblyid)
{
this.CreateDBConnection ();
try
{
string strimg=select Photo from Photo where 
PhotoOfflineID in (select
PhotoID from AssemblyPhoto where AssemblyID=+assemblyid+);
SqliteDataAdapter sda=new 
SqliteDataAdapter(strimg, sconn);
DataSet ds=new DataSet();
sda.Fill (ds);
int imagescount=ds.Tables[0].Rows.Count;
UIImage[] imgarray=new UIImage[imagescount];
byte[] mybuffer=null;
for(int y=0; yds.Tables[0].Rows.Count; y++)
{

mybuffer=(byte[])(ds.Tables[0].Rows[y][Photo]);
UIImage img= UIImage.LoadFromData 
(NSData.FromArray (mybuffer));

}
}
catch(Exception exp)
{
throw exp;
}
this.CloseDBConnection ();
}

What I am trying to do is return a array of UIImage objects. So I
initialized the imgarray in my code. But when I try to add the new UIImage
img to the array, I find that the Add() method is not present. Obviously I
am going about it the wrong way or so it seems. Could you please help me
restructure the code properly? Some help needed on this in the earnest.

Thanks in advance.





--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/How-to-show-an-imagegallery-in-IPAD-application-tp4656388p4656413.html
Sent from the MonoTouch mailing list archive at Nabble.com.
___
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch


Re: [MonoTouch] How to show an imagegallery in IPAD application --

2012-08-07 Thread Jason Awbrey
try using a generic list like ListUIImage or ArrayListUIImage instead

On Tue, Aug 7, 2012 at 6:13 AM, proindigo pro_ind...@live.com wrote:

 OK. Having some issues constructing the code block that is supposed to
 return
 a collection of images.

 Here is what I am trying to do --


 public UIImage[] ReturnAssemblyImages(int assemblyid)
 {
 this.CreateDBConnection ();
 try
 {
 string strimg=select Photo from Photo
 where PhotoOfflineID in (select
 PhotoID from AssemblyPhoto where AssemblyID=+assemblyid+);
 SqliteDataAdapter sda=new
 SqliteDataAdapter(strimg, sconn);
 DataSet ds=new DataSet();
 sda.Fill (ds);
 int imagescount=ds.Tables[0].Rows.Count;
 UIImage[] imgarray=new
 UIImage[imagescount];
 byte[] mybuffer=null;
 for(int y=0; yds.Tables[0].Rows.Count;
 y++)
 {

 mybuffer=(byte[])(ds.Tables[0].Rows[y][Photo]);
 UIImage img= UIImage.LoadFromData
 (NSData.FromArray (mybuffer));

 }
 }
 catch(Exception exp)
 {
 throw exp;
 }
 this.CloseDBConnection ();
 }

 What I am trying to do is return a array of UIImage objects. So I
 initialized the imgarray in my code. But when I try to add the new UIImage
 img to the array, I find that the Add() method is not present. Obviously I
 am going about it the wrong way or so it seems. Could you please help me
 restructure the code properly? Some help needed on this in the earnest.

 Thanks in advance.





 --
 View this message in context:
 http://monotouch.2284126.n4.nabble.com/How-to-show-an-imagegallery-in-IPAD-application-tp4656388p4656413.html
 Sent from the MonoTouch mailing list archive at Nabble.com.
 ___
 MonoTouch mailing list
 MonoTouch@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/monotouch

___
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch


Re: [MonoTouch] How to write bindings for a framework?

2012-08-07 Thread Jeff Stedfast
You'll want to add them as BuildAction = BundleResource

You can add these files to either the binding project or the app project,
it doesn't really matter. Although, if you add it to the binding project,
you'll need the updated MSBuild targets from
http://files.xamarin.com/~jeff/BindingProjectBuildTargets.zip (extract this
in /Library/Frameworks/Mono.framework/External/).

I forgot you'd need this yesterday when I replied.

Hope that helps,

Jeff

On Mon, Aug 6, 2012 at 7:58 PM, Shawn Castrianni sh...@spcware.com wrote:

 that was also one of my questions. do we do this to the binding project
 that produces the dll or the top level application project that produces
 the iap?

 ___
 Shawn

 On Aug 6, 2012, at 6:53 PM, Alex Soto dxdr...@gmail.com wrote:

 Ok let me see if I understood correctly

 We manually create a folder named Resources in our MT binding project

 Then we add the xName.bundle to that folder and any resource files
 included on the framework

 Then We compile and everything gets added to the bindingfile.dll file and
 that it.

 Do we have to mark the files we add to Resources folder as Content or
 Resource??

 Thanks Jeff

 Alex

 El 06/08/2012, a las 04:08 p.m., Jeff Stedfast j...@xamarin.com
 escribió:

 Hi Shawn,

 I recently added feature which adds a Resources folder where you can add
 things like the ArcGIS.bundle files.

 I think it landed in MonoDevelop 3.0.4 (you'll have to create the
 Resources folder manually, though)

 Jeff

 On Mon, Aug 6, 2012 at 3:50 PM, spcware sh...@spcware.com wrote:

 I am not sure I follow your reply.  I was giving multiple options, yet you
 said it all sounded correct.

 Let me add some specifics.  I am trying to use the ESRI ArcGIS thirdparty
 framework.  I have already started writing the ApiDefinition.cs file to
 wrap
 the Objective-C code in C# bindings.  It is working well.  However, the
 ArcGIS ships as a framework and a Resources directory containing both a
 ArcGIS.bundle and Info.plist file.  In normal Objective-C xcode world,
 they
 state to add the ArcGIS.bundle file to the xcode project and add a
 dependency on the ArcGIS.framework.  I know that the code in the
 ArcGIS.framework uses resources from the ArcGIS.bundle when rendering its
 UI.  So the question is how to get those resources available to the
 wrapped
 ArcGIS.dll that I create?

 I tried added the ArcGIS.bundle (really a directory) to my top level ios
 Monotouch application project as a directory.  That helped a little in
 that
 my app can now see some of the resources, but not all.  The ESRI map
 component is supposed to have esri in the bottom left corner of the
 MapView which is just one of the images in the ArcGIS.bundle.  It is NOT
 finding this image, however, it is finding the GpsLocation.png image used
 to
 show the current device location on the map.  I am confused as to how some
 of the images in the ArcGIS.bundle can be found, yet some cannot.  Also,
 do
 I have to use the Info.plist file at all??



 --
 View this message in context:
 http://monotouch.2284126.n4.nabble.com/How-to-write-bindings-for-a-framework-tp4656293p4656400.html
 Sent from the MonoTouch mailing list archive at Nabble.com.
 ___
 MonoTouch mailing list
 MonoTouch@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/monotouch


 ___
 MonoTouch mailing list
 MonoTouch@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/monotouch


___
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch


[MonoTouch] Black Screen of death

2012-08-07 Thread jazzyjef2002
Hi,

Just got a very strage problem with one of my apps. 

Apps has been terminated, going thru AppDelegate.WillTerminate, which
basicaly only console.write that is has gone thru that function.

No crash, nothing. But when I restart it back, the only thing Im getting is
a BlackScreen (No loading screen in that app) and it stick there foreever...
It is like the 17 seconds of loading is not even killing it. Nothing works
except restarting the device. And Im unable to Debug it since Debug session
has been killed when terminated and as soon as I start it again, then it
start backk 100% of time!

It feels like something is remaining even if app has been terminated... And
this is random so doesnt occurs every time.

Any idea?


Thanks




--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Black-Screen-of-death-tp4656416.html
Sent from the MonoTouch mailing list archive at Nabble.com.
___
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch


Re: [MonoTouch] Black Screen of death

2012-08-07 Thread jazzyjef2002
Hi,

Reading Yes, Writing No.

Writing are only done on special events which occurs later in the code.

Thanks






--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Black-Screen-of-death-tp4656416p4656418.html
Sent from the MonoTouch mailing list archive at Nabble.com.
___
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch


Re: [MonoTouch] Ensure Invoked on Main Thread (Performant???)

2012-08-07 Thread Phil Cockfield
Awesome - thanks *Rolf*.



On Tue, Aug 7, 2012 at 10:56 PM, Rolf Bjarne Kvinge r...@xamarin.comwrote:

 Hi,

 There are likely more efficient ways to this.

 One way would be to have a [ThreadStatic] variable which you set to true
 in your Main method. That way it'll only be true for the main thread.

 The only way to really tell what is faster though is to actually measure
 the difference (and do you actually know that this code is called a lot in
 your app? If not, it won't be a problem. Have in mind that anything
 UI-related will likely drown this piece of code completely).

 Best regards,
 Rolf

 On Tue, Aug 7, 2012 at 12:43 PM, Phil Cockfield p...@cockfield.netwrote:

 I've got some same code which is designed to make sure an Action is
 invoked on the UI thread.
 Here it is here:

 https://gist.github.com/3284433

 It uses this to determine if it's running on the UI thread.  Is code the
 most efficient way to do this?  It seems a bit baroque to be marshalling
 out over a *bool_objc_msgSend *type method.


   private static bool IsMainThread()

 {

   return Messaging.bool_objc_msgSend(GetClassHandle(NSThread), 
 newSelector(
 isMainThread).Handle);

 }


 Thanks!

 --
 *Phil *Cockfield




 ___
 MonoTouch mailing list
 MonoTouch@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/monotouch





-- 
*Phil *Cockfield
___
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch


Re: [MonoTouch] Black Screen of death

2012-08-07 Thread jazzyjef2002
What is really really strange is that if Im looking within Instruments,

Process is not there anymore, and when I restart it (Going thru the black
screen) it does appear on the list of process...

Weird...





--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Black-Screen-of-death-tp4656416p4656420.html
Sent from the MonoTouch mailing list archive at Nabble.com.
___
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch


Re: [MonoTouch] Black Screen of death

2012-08-07 Thread jazzyjef2002
Still Priliminary, but so far it seems to work...

It seems it is related to compilation method.

I was trying to achieved a Arm6 +  Arm7 compilation, and it was creating
that black screen.

Since I switched it back to Arm7 only then it seems to work...

Will do further testing but so far it looks good...

Anyone got this issue?





--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Black-Screen-of-death-tp4656416p4656422.html
Sent from the MonoTouch mailing list archive at Nabble.com.
___
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch


[MonoTouch] mprof-report call graphs and counts seem weird

2012-08-07 Thread Felix Collins
Hi All, I'm trying to use mprof and mprof-report to profile my app for
execution time before I start optimising things or moving processing off the
main thread. I get an output like that shown below but it seems wrong. For
the output below I let the app start up and waited till my background web
service calls had finished then stopped profiling. So FinishedLaunching must
have only been called once but the report says eleven times!  GetQuestions
is only called once by my reckoning too. What gives?
Cheers,
Felix

 1567        0        138 System.Collections.Generic.List`1:.ctor
(System.Collections.Generic.IEnumerable`1T)
    16 calls from:
        MobileBullet.DomainObjectService:GetQuestions ()
        System.Linq.Enumerable:ToListTSource
(System.Collections.Generic.IEnumerable`1TSource)
        System.Collections.Generic.List`1:.ctor
(System.Collections.Generic.IEnumerable`1T)
        System.Collections.Generic.List`1:AddEnumerable
(System.Collections.Generic.IEnumerable`1T)
      
 System.Linq.Enumerable/CreateSelectIteratorc__Iterator1D`2:MoveNext ()
        System.Linq.Enumerable/CreateWhereIteratorc__Iterator2B`1:MoveNext
()
      
 System.Linq.Enumerable/CreateSelectManyIteratorc__Iterator21`3:MoveNext
()
        SQLite.TableQuery`1:GetEnumerator ()
        SQLite.SQLiteCommand:ExecuteQueryT ()
        System.Linq.Enumerable:ToListTSource
(System.Collections.Generic.IEnumerable`1TSource)
    11 calls from:
        (wrapper runtime-invoke)
Module:runtime_invoke_bool__this___object_object
(object,intptr,intptr,intptr)
        Touch.Container.AppDelegate:FinishedLaunching
(MonoTouch.UIKit.UIApplication,MonoTouch.Foundation.NSDictionary)
        Intranel.Mobile.AppBase`1:SetInstance
(Intranel.Mobile.AppBase`1TGlobalState)
        Touch.Container.VLBBTouchApp:SingletonInitialise ()
        MobileBullet.GlobalState:.ctor (int)
        MobileBullet.DomainObjectService:.ctor
(MobileBullet.SafeMobileBulletClient)
        MobileBullet.DomainObjectService:InitDomObjectTables ()
        SQLite.SQLiteConnection:CreateTableT ()
        SQLite.SQLiteConnection:CreateTable (System.Type)
        System.Linq.Enumerable:ToArrayTSource
(System.Collections.Generic.IEnumerable`1TSource)



--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/mprof-report-call-graphs-and-counts-seem-weird-tp4656423.html
Sent from the MonoTouch mailing list archive at Nabble.com.
___
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch