Re: [MonoTouch] INotifyPropertyChanged

2012-08-06 Thread Nic Wise
iOS / Cocoa has the observer pattern baked in, I think. But the only ones
I've seen are mostly MVVM, eg

https://github.com/RobertKozak/MonoMobile.Views
http://slodge.blogspot.co.uk/2012/02/mvvmcross-mvvm-across-wp7-monodroid-and.html



On Sun, Aug 5, 2012 at 9:12 PM, Phil Cockfield p...@cockfield.net wrote:

 In the past, I've always made a lot of use of property change
 notifications on Models.  In .NET I've used the [*INotifyPropertyChanged*]
 interface and associated class from System.ComponentModel.

 Before I go blithely diving into adopting this pattern for iOS development
 - is this something other people do?  Or in iOS is that discouraged.  What
 are common ways for implementing property change observation patterns
 around models in this world.

 Thanks!
 --
 *Phil *Cockfield




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




-- 
Nic Wise
t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
Earnest: Self-employed? Track your business expenses and income.
http://earnestapp.com
Nearest Bus: find when the next bus is coming to your stop.
http://goo.gl/Vcz1p
London Bike App: Find the nearest Boris Bike, and get riding!
http://goo.gl/Icp2
___
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch


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

2012-08-06 Thread proindigo
Greetings of the day.

I have a situation which I'll try to describe in details in the next few
paragraphs.
In my ipad application, I have images for an assembly [like cranes,
crawlers, loaders, forklifts, backhoe, excavator etc] stored as byte arrays
in my sqlite database. On my view controller, I have a tableview enlisting
the different assemblies available. There are several buttons with different
functionalities one of which is a 'View Photographs' button. When I make a
selection from the tableview and click on this button, all the images of
that particular assembly are supposed to be presented in a sleek, stylish
pop up gallery with option for moving front and back [like we have the
lightbox and other such galleries in asp.net]. I don't want to navigate to
an entirely new view controller for the purpose of presenting the images.
Hence the idea of a pop up gallery. I hope you understand what I'm trying to
create.
Kindly see attached image for ease of understanding.
http://monotouch.2284126.n4.nabble.com/file/n4656388/pic.png 


Now I have figured out the part regarding fetching the byte arrays from
database and converting them back to uiimage type.

What I don't know is how to present the set of images in the form of a pop
up gallery that I mentioned above.
I am relatively new to IOS development. As such having problems implementing
this in my sample application. That's why I turned to the forums for
technical help. Kindly help me by proving some links to useful articles or
tutorials or better still some target specific code blocks. You can also PM
me if you would like to correspond with me through email.

Look forward eagerly to receiving some technical help on this matter in the
earnest.

Many Thanks in anticipation.





--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/How-to-show-an-imagegallery-in-IPAD-application-tp4656388.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] WebClient memory issues

2012-08-06 Thread Matthieu Laban
On Mon, Aug 6, 2012 at 5:37 AM, Sebastien Pouliot sebast...@xamarin.comwrote:

 Hello Matthieu,

 On Sun, Aug 5, 2012 at 2:34 PM, Matthieu Laban
 m...@flyingdevelopmentstudio.com wrote:
  Hello Guys,
 
  My quest for leaks continues... I'm downloading files from our server,
 and
  the size of the files can vary between 1 and 20 MB.
  The issue is that after the file is downloaded, the app's dirty size
 goes up
  ~20MB and never goes down even if I dispose the WebClient, remove all
 event
  listeners and call GC.Collect().

 The easiest way to reduce your dirty memory [1] is to reduce your
 allocations [2].

 [1] http://stackoverflow.com/q/5176074/220643
 [2] http://stackoverflow.com/q/6471435/220643


Yup, we've already been reducing allocations a lot. Thanks for the links :)


  How can I make sure some of that memory is
  reclaimed. We're tight on memory on the iPod Touch and we'd love to get
 some
  of it back :)

 I suggest a small change of design to minimize your memory requirements:

 1. Avoid keeping data in memory.

 1.1. The ZIPped data is likely not useful to keep around, i.e. it
 won't be used until decompressed (into one or several files), but even
 if it was...


I'd love to but I never even access the byte[] that has been downloaded in
this case.

1.2. The 20MB download may take quite some time (e.g. cellular) and
 you do not want to hold on to large memory blocks for long times (e.g.
 be nice to other running applications);


After watching the talk at WWDC 2012 on memory, that's the thing I'm trying
to do now, avoid spikes of memory allocations.



 2. Keep using WebClient as it is simpler than HttpWebRequest - but
 instead of using DownloadData use DownloadFile [1] to a temporary
 location. That will download your ZIP file in chunks of 32KB, lowering
 your app memory requirements, and the file can be decompressed later
 (e.g. using streams to avoid loading it into memory) and then deleted.

 Speaking of streams an alternative would be use a OpenRead to get a
 Stream and process data, in small chunks, as it comes in. You get more
 control this way (if you need it) but you'll likely end up duplicating
 DownloadFile.

 [1]
 https://github.com/mono/mono/blob/mono-2-10/mcs/class/System/System.Net/WebClient.cs#L299


Thanks, I'll try these. I think I had tried one of those in the past but
the progress event was never fired, so I had to switch to a different
method.


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


Re: [MonoTouch] WebClient memory issues

2012-08-06 Thread Matthieu Laban
Using DownloadFile instead of DownloadData did solve my problem. Memory
usage is staying low and I don't see many allocations being done during the
download.

Thanks again for your help,
Matt

On Mon, Aug 6, 2012 at 8:55 AM, Matthieu Laban 
m...@flyingdevelopmentstudio.com wrote:



 On Mon, Aug 6, 2012 at 5:37 AM, Sebastien Pouliot 
 sebast...@xamarin.comwrote:

 Hello Matthieu,

 On Sun, Aug 5, 2012 at 2:34 PM, Matthieu Laban
 m...@flyingdevelopmentstudio.com wrote:
  Hello Guys,
 
  My quest for leaks continues... I'm downloading files from our server,
 and
  the size of the files can vary between 1 and 20 MB.
  The issue is that after the file is downloaded, the app's dirty size
 goes up
  ~20MB and never goes down even if I dispose the WebClient, remove all
 event
  listeners and call GC.Collect().

 The easiest way to reduce your dirty memory [1] is to reduce your
 allocations [2].

 [1] http://stackoverflow.com/q/5176074/220643
 [2] http://stackoverflow.com/q/6471435/220643


 Yup, we've already been reducing allocations a lot. Thanks for the links :)


  How can I make sure some of that memory is
  reclaimed. We're tight on memory on the iPod Touch and we'd love to get
 some
  of it back :)

 I suggest a small change of design to minimize your memory requirements:

 1. Avoid keeping data in memory.

 1.1. The ZIPped data is likely not useful to keep around, i.e. it
 won't be used until decompressed (into one or several files), but even
 if it was...


 I'd love to but I never even access the byte[] that has been downloaded in
 this case.

 1.2. The 20MB download may take quite some time (e.g. cellular) and
 you do not want to hold on to large memory blocks for long times (e.g.
 be nice to other running applications);


 After watching the talk at WWDC 2012 on memory, that's the thing I'm
 trying to do now, avoid spikes of memory allocations.



 2. Keep using WebClient as it is simpler than HttpWebRequest - but
 instead of using DownloadData use DownloadFile [1] to a temporary
 location. That will download your ZIP file in chunks of 32KB, lowering
 your app memory requirements, and the file can be decompressed later
 (e.g. using streams to avoid loading it into memory) and then deleted.

 Speaking of streams an alternative would be use a OpenRead to get a
 Stream and process data, in small chunks, as it comes in. You get more
 control this way (if you need it) but you'll likely end up duplicating
 DownloadFile.

 [1]
 https://github.com/mono/mono/blob/mono-2-10/mcs/class/System/System.Net/WebClient.cs#L299


 Thanks, I'll try these. I think I had tried one of those in the past but
 the progress event was never fired, so I had to switch to a different
 method.


 --
 Matt

___
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-06 Thread Alex Soto
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


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

2012-08-06 Thread Shawn Castrianni
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


Re: [MonoTouch] MT.Dialog: Selected Event while in Edit Mode

2012-08-06 Thread Phil Cockfield
Cool.  Thanks Nic.




On Mon, Aug 6, 2012 at 9:50 PM, Nic Wise n...@fastchicken.co.nz wrote:

 I suspect it's a custom cell. I'm not 100% sure how they'd do it without
 custom-drawing everything (ie, not using a grouped tableview type), but it
 looks like a one-off :)

 If you have an image, you may need to EnableInteraction (or something
 similar) in order for it to receive taps. Same with UILabels.


 On Sun, Aug 5, 2012 at 9:01 PM, Phil Cockfield p...@cockfield.net wrote:

 Hey *Nic*,

 No, what I mean is when a *Contact* is in edit mode.

 If you put a Contact into Edit mode, then scroll down to the bottom
 you'll see (for example) the *( + ) add field* cell.

 Both the ( + ) icon AND the cell (add field) is tappable.  Not so in
 MT.Dialog.  The *selected* method is never getting called from the *DVC*.

 Any ideas?




 On Sun, Aug 5, 2012 at 11:08 PM, Nic Wise n...@fastchicken.co.nz wrote:

 I always thought the contact editing was 2 forms. You had one for
 display, and one for editing - rather than it being the editing mode of the
 same form.

 Could be wrong tho :)

  On Sun, Aug 5, 2012 at 10:36 AM, Phil Cockfield p...@cockfield.netwrote:

  In *MT.Dialog* I would like to react when a cell (Element) is
 selected WHILE the table is in edit mode.

 It appears that the DVC is never invoking the Selected method while in
 the edit state ( eg. TableView.*SetEditing*( true, true ); )

 The reason I want to do this is to achieve the same effect as in the
 iOS Contacts app with + Add New Address or + Add Field (with the
 Plus/Insert icon visible).

 It will be confusing for the user to only hit the ( + ) icon, when the
 whole cell look like a hit target.

 Anyway to do this?  Thanks!

 --
 *Phil *Cockfield




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




 --
 Nic Wise
 t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
 b. http://www.fastchicken.co.nz/

 mobileAgent (for FreeAgent): get your accounts in your pocket.
 http://goo.gl/IuBU
 Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
 Earnest: Self-employed? Track your business expenses and income.
 http://earnestapp.com
 Nearest Bus: find when the next bus is coming to your stop.
 http://goo.gl/Vcz1p
 London Bike App: Find the nearest Boris Bike, and get riding!
 http://goo.gl/Icp2




 --
 *Phil *Cockfield






 --
 Nic Wise
 t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
 b. http://www.fastchicken.co.nz/

 mobileAgent (for FreeAgent): get your accounts in your pocket.
 http://goo.gl/IuBU
 Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
 Earnest: Self-employed? Track your business expenses and income.
 http://earnestapp.com
 Nearest Bus: find when the next bus is coming to your stop.
 http://goo.gl/Vcz1p
 London Bike App: Find the nearest Boris Bike, and get riding!
 http://goo.gl/Icp2




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