[MonoTouch] Converting a UTType to a Mime Type

2012-07-10 Thread Felix Collins
Hi,
I need to convert a UTType to its equivalent mime type. There are loads of
obj c examples but they use methods on the UTType class.  The
Monotouch.MobileCoreServices.UTType does not seem to have these methods. Is
this an oversight? How have other dealt with this problem? Should I log a
bug for this?

Cheers,
Felix

http://developer.apple.com/library/mac/#documentation/MobileCoreServices/Reference/UTTypeRef/Reference/reference.html



--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Converting-a-UTType-to-a-Mime-Type-tp4655921.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] detecting a failed webview load

2012-07-10 Thread vulcanCCIT
I forgot that I have to explicitly call the failed event.  I thought the
try/catch would of caught this...

I added this and it works:

webView.LoadError += delegate {
var alert = new UIAlertView ("Error", "Webcam 
failed to load, check your
internet connection", null, "Ok");
alert.Show();
};

--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/detecting-a-failed-webview-load-tp4655917p4655920.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] Side Navigation (a la "Path" and "Facebook")

2012-07-10 Thread Greg Munn
Nic,

I started on the SlidingViewController but it didn't have what I wanted -- use 
this one instead which I should have *finished* in the next day or two.

https://github.com/sgmunn/MonoKit/blob/master/Test/Class2.cs

the class will have the same name, it'll just be in its proper spot.

Cheers,
Greg


On 11/07/2012, at 12:30 AM, Nic Wise wrote:

> oooh, that one looks good.
> 
> Direct link, for the moment:
> 
> https://github.com/sgmunn/MonoKit/blob/master/MonoKit.iOS/UI/ViewControllers/SlidingViewController.cs
> 
> (Unless you finish it before I have time to put it in my app, if I
> make changes, I'll pull-request them back in)
> 
> 
> On Tue, Jul 10, 2012 at 2:35 PM, Greg Munn  wrote:
>> I also found ViewDeck, https://github.com/Inferis/ViewDeck, which is a bit 
>> more involved but has a few more features (including a bounce) when pulling 
>> the view too far.  I've had a crack at porting it and so far it has come 
>> along quite nicely.
>> 
>> my port is https://github.com/sgmunn/MonoKit  -- search for Class2.cs  
>> (still in progress :).
>> 
>> Cheers,
>> Greg
>> 
>> 
>> On 05/07/2012, at 7:03 PM, Nic Wise wrote:
>> 
>>> Thanks Greg. I might try to port that over - looks like a nice 
>>> implementation.
>>> 
>>> On Thu, Jul 5, 2012 at 12:12 AM, Greg Munn  wrote:
 This one is written in Obj-C and flies out from the bottom, but you could 
 adapt it easily enough.
 
 https://github.com/iridia/IRSlidingSplitViewController
 
 
 On 04/07/2012, at 11:59 PM, Nic Wise wrote:
 
> (there is a 40k limit in posts, so... this is now plaintext)
> 
> 
> James Clancey has done a basic version of it:
> 
> https://github.com/Clancey/FlyOutNavigation
> 
> I've not seen anything else, tho. But on the surface, it shouldn't be
> too hard. Two views, one under the other. Trigger something (button)
> and animate the top view away. Trigger something (gesture?) and
> animate it back in.
> 
> I did a basic one, with a huge UIImageView as the background, and you
> hit something, and it just scrolled over the show the left side.
> 
> so, assuming you have a 320x2 x 480 image (non-retina) as the
> background view (BaseView), the button (trigger) just calls
> SetInitialPage(0, true) for the left side, and 0,true for the right
> side.
> 
> BaseView = new UIView(new RectangleF(new PointF(0,0),
> Resources.Background.Size)); //Resources.Background is the big image!
> baseView.BackgroundColor = Resources.MoleskineBackgroundColor; //it's
> a color, but it's a pattern
> View.AddSubview(baseView);
> 
> //just add it into the View's view... this is all just in a 
> UIViewController
> 
> public void TogglePage()
>  {
>  page = (page == 1) ? 0 : 1;
> 
>  SetInitialPage(page);
>  sideButton.SetTitle((page == 1) ? "<<" : ">>",
> UIControlState.Normal);
>  }
> 
> 
>  public override void SetInitialPage(int page, bool animate = true)
>  {
>  if (animate)
>  {
>  UIView.BeginAnimations("pagescroll");
>  UIView.SetAnimationDuration(0.75f);
>  UIView.SetAnimationCurve(UIViewAnimationCurve.EaseInOut);
>  }
> 
>  if (page == 0)
>  {
>  var baseViewBounds = BaseView.Bounds;
>  baseViewBounds.X = 0;
>  BaseView.Bounds = baseViewBounds;
> 
>  } else {
>  var baseViewBounds = BaseView.Bounds;
>  baseViewBounds.X = BaseView.Bounds.Width - 320;
>  BaseView.Bounds = baseViewBounds;
>  }
> 
>  if (animate)
>  {
>  UIView.CommitAnimations();
>  }
>  base.SetInitialPage(page, animate);
>  }
> ___
> 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/
>>> 
>>> 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
>>> 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
>>> London Bike App: Find the nearest Boris Bike, and get riding! 
>>> http://goo.gl/Icp2
>> 
> 
> 
> 
> -- 
> Nic Wise
> t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
> b. http://www.fastchicken.co.nz/
> 
> Earnest: Self-employed? Track your business expenses and income.
> http://earnestapp.com
> Nearest Bus: find when the next bus i

Re: [MonoTouch] detecting a failed webview load

2012-07-10 Thread Jason Awbrey
UIWebView has a didFailLoadWithError handler - have you tried that?

On Tue, Jul 10, 2012 at 5:56 PM, vulcanCCIT
wrote:

> I am trying to properly catch a failed webview load if you loose network
> connectivity.  I thought a timeout would work but it does not seem to help.
> Perhaps I need to use the Reachability class? prior to the
> webView.LoadRequest() ? I am using that in other parts of my code but I
> thought this try/catch would work:
>
>
> private void OnRefreshSelected (Object o, EventArgs args)
> {
> try {
> this.Title = "Loading...";
>
> UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
> webView.LoadRequest (new NSUrlRequest (new
> NSUrl (_camURL),
> NSUrlRequestCachePolicy.ReloadIgnoringLocalCacheData, 30));
>
> webView.LoadFinished += delegate {
>
> UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
> this.Title = _boardName;
> };
> }
> catch(Exception ex)
> {
> var alert = new UIAlertView ("Error",
> ex.ToString(), null, "Ok");
> alert.Show();
> }
> }
>
>
> --
> View this message in context:
> http://monotouch.2284126.n4.nabble.com/detecting-a-failed-webview-load-tp4655917.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] detecting a failed webview load

2012-07-10 Thread vulcanCCIT
I am trying to properly catch a failed webview load if you loose network
connectivity.  I thought a timeout would work but it does not seem to help. 
Perhaps I need to use the Reachability class? prior to the
webView.LoadRequest() ? I am using that in other parts of my code but I
thought this try/catch would work:


private void OnRefreshSelected (Object o, EventArgs args)
{
try {
this.Title = "Loading...";

UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
webView.LoadRequest (new NSUrlRequest (new 
NSUrl (_camURL),
NSUrlRequestCachePolicy.ReloadIgnoringLocalCacheData, 30));

webView.LoadFinished += delegate {

UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
this.Title = _boardName;
};
}
catch(Exception ex)
{
var alert = new UIAlertView ("Error", 
ex.ToString(), null, "Ok");
alert.Show();
}
}


--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/detecting-a-failed-webview-load-tp4655917.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] UIDatePicker - AM/PM : Getting it exactly the wrong way around.

2012-07-10 Thread Nic Wise
I was trying to use NSTimeZone, but I think what he has will work a lot
better. Mine is MESSY

On Tue, Jul 10, 2012 at 8:30 PM, Phil Cockfield  wrote:

> Thanks Nic - good to know it actually is a TimeZone issue.
>  Being exactly 12 hours off made it look suspicious :)
>
> There must be some other trick, beyond what Mikkel was showing with the *
> ToLocalTime*() methods to have it convert correctly.
>
> Mikkel suggested this:
>
> picker.Date = date.ToLocalTime();
> date = DateTime.SpecifyKind(picker.Date, DateTimeKind.Local).ToLocalTime();
>
>
> Were there other time localization calls you were making for TripWallet?
>
>
>
> On Wed, Jul 11, 2012 at 12:44 AM, Nic Wise  wrote:
>
>> The dates that come out of pickers are GMT. You are GMT+12 :)
>>
>> (I had the same problem developing TripWallet - I was in NZ then, too)
>>
>> On Tue, Jul 10, 2012 at 10:55 AM, Phil Cockfield 
>> wrote:
>> > I'm using a UIDatePicker control in a pretty standard way (I think).
>>  That
>> > is, I'm not setting much configuration at all at initialization:
>> >
>> > Control = new UIDatePicker(RectangleF.Empty){ AutoresizingMask =
>> > UIViewAutoresizing.FlexibleWidth };
>> >
>> >
>> > The problem is, when I read the selected Date value out of it, the AM/PM
>> > values are exactly the wrong way around.  Eg. 1PM is being returned as
>> 1AM
>> > and vice versa.
>> >
>> > Here's a GIST of the entire code I've got (for context):
>> >
>> > https://gist.github.com/3082372
>> >
>> >
>> > Is this some kind of time-zone wierdness.  I'm in NZ.  Doesn't seem like
>> > it's time-zones though, because it's an exact reversal of the AM/PM
>> values,
>> > not a shift in the time.
>> >
>> > 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/
>>
>> 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
>> 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
>> 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/

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
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
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] ALAssetsLibrary - AddAssetsGroupAlbum Block Returns Invalid ALAssetsGroup Object

2012-07-10 Thread Jim Crismale
Is there a best practice code example demonstrating how to use the
ALAssetsLibrary, specifically with adding new asset groups and adding photos
to them?


I've seen a few samples out there, but none of them seem to handle the async
nature of these methods properly and I am running into difficulty with what
should be an extremely simple task.


In the code example below, 50% of the time the newly added group has one or
more null property values, preventing the image from being added to the new
group. According to Apple's docs, you are supposed to do "work" with the
object received in the block but I can't see how you can when it is in an
invalid state.


I set up an observer to detect when the "ALAssetsLibraryChangedNotification"
gets fired to reload (as suggested on SO) and determined that there were
many times this notification did not get fired between the time of the call
and the addition of the new object which was returned in an invalid state.


I've tried re-enumerating after adding with sleep timers and pulling the
object out that way, but apparently it still wasn't "ready" with all of it's
property values yet.




There has to be an easy way to do this. Appreciate any help!




--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/ALAssetsLibrary-AddAssetsGroupAlbum-Block-Returns-Invalid-ALAssetsGroup-Object-tp4655909.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] MVC philosophy when it comes to deriving from [Element]

2012-07-10 Thread Phil Cockfield
But now I think this through further - saying an *Element* is "just a view"
and "it needs to have a Controller along side it" doesn't totally work
because you can't insert a controller into a *Section.*

And you may want to encapsulate facets of behavioral-to-model logic within
an Element, or Section so as not to have the root Controller become wildly
complex being responsible for to many different things.

These really are different kinds of things, right?  Perhaps akin to a
*View-Model
*(??)

Please humor this line of questioning.  Backing out of a factoring and
code-organization based on a faulty understanding of how to structure
things gets more and more of a PITA with every new Element I make and use!
:)

Thanks guys!!!



On Wed, Jul 11, 2012 at 7:41 AM, Phil Cockfield  wrote:

> As I start to create custom cells by deriving from *Element* I need to be
> careful I don't start messing up the clean MVC separation works in iOS.
>
> Is this a true and fair way to think of things:
>
>
>- A derived [*Element*] should contain behavioral methods that are
>responsible "only" for on screen manipulation of the visuals of the
>Element's parts.  It is conceptually the "View" of MVC.
>
>- A "model" per se should never be directly passed into a derived [*
>Element*], rather
>
>- The relationship between a model, and the way the Element displays
>is (via it's behavioral method mentioned above) should ALWAYS be managed
>through a *UIViewController* (or *DialogViewController* as the case
>may be).
>
>
> That seems clear, and logical to me at the moment.  Is it this clear cut
> and simple - or do you guys start to blur things (passing models into
> Elements)...and if so, is that OK/recommended?
>
> It's tempting to just ram some controller-like "model binding" behavior
> into the derived element.  Is that evil?
>
> Thanks!
>
> --
> *Phil *Cockfield
>
>
>
>
___
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch


Re: [MonoTouch] Implementing IImageUpdated in custom MTD Element

2012-07-10 Thread dickies
Thanks a lot Craig!

--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Implementing-IImageUpdated-in-custom-MTD-Element-tp4655755p4655914.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] MVC philosophy when it comes to deriving from [Element]

2012-07-10 Thread Phil Cockfield
As I start to create custom cells by deriving from *Element* I need to be
careful I don't start messing up the clean MVC separation works in iOS.

Is this a true and fair way to think of things:


   - A derived [*Element*] should contain behavioral methods that are
   responsible "only" for on screen manipulation of the visuals of the
   Element's parts.  It is conceptually the "View" of MVC.

   - A "model" per se should never be directly passed into a derived [*
   Element*], rather

   - The relationship between a model, and the way the Element displays is
   (via it's behavioral method mentioned above) should ALWAYS be managed
   through a *UIViewController* (or *DialogViewController* as the case may
   be).


That seems clear, and logical to me at the moment.  Is it this clear cut
and simple - or do you guys start to blur things (passing models into
Elements)...and if so, is that OK/recommended?

It's tempting to just ram some controller-like "model binding" behavior
into the derived element.  Is that evil?

Thanks!

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


Re: [MonoTouch] OwnerDrawnElement vs. UIViewElement

2012-07-10 Thread Phil Cockfield
Ah - cool.  Thanks for the pointer to the recent sample!



On Wed, Jul 11, 2012 at 12:43 AM, Nic Wise  wrote:

> That should work. I tend to make a normal cell and inject things into the
> ContentView, but I suspect yours is cleaner and the "better" way. My "way"
> dates back 12-24 months, so better tricks may have come up since then.
>
> The MWC app might be a good place to look:
> https://github.com/xamarin/mobile-samples/tree/master/MWC/MWC.iOS/UI/CustomElements
>
>
> .. as it's fairly recent.
>
>
> On Tue, Jul 10, 2012 at 11:08 AM, Phil Cockfield wrote:
>
>> Thanks *Nic*,
>>
>> So something like this(?):
>>
>> https://gist.github.com/3082446
>>
>>
>> If you're going of *Element*, you don't have a *UIView *to play with,
>> right?  I'm not sure if going all the way to Element is too low-level for
>> me - but if I want complete rendering control, I think I need to.
>>
>> In the gist I have to create my own *TableViewCell*.  Is this in the
>> weeks, or the right way to do things?  I suspect that this could be more
>> efficient, given the warnings about cell's not being recycled when using
>> the *UIViewElement.*
>>
>> From the docs:
>>
>> *UIViewElement
>> *
>> Can we used to host a standard UIView as an element, in this case no cell
>> reuse will take place.
>>
>>
>>
>>
>>
>> On Tue, Jul 10, 2012 at 7:12 PM, Nic Wise  wrote:
>>
>>> Yup, thats what I do: inherit off Element (or something a little further
>>> down the stack) and add my own stuff into the view
>>>
>>> yell for code. :)
>>>
>>> On Tue, Jul 10, 2012 at 6:31 AM, Phil Cockfield wrote:
>>>
 I just found this by Miguel:


 http://stackoverflow.com/questions/4028356/monotouch-dialogs-ownerdrawnelement-highlight-not-working

 The OwnerDrawnElement was a contribution from the community, and it is
 not as sophisticated as it should be. I would not depend on it for anything
 beyond the trivially basic.

 I strongly recommend that you create your own Element, if you want to
 reuse some of the code for OwnerDrawElement, you could copy and paste that.


 So perhaps I should be just deriving from *Element* and overriding *
 GetCell*.  Is that too low-level?
 What's the best practice here?

 Thanks!



 On Tue, Jul 10, 2012 at 2:27 PM, Phil Cockfield wrote:

> When wanting to get in and totally control cell style rendering, is
> there a preferred approach between these two options:
>
> - OwnerDrawnElement
> - UIViewElement
>
> For [UIViewElement] the docs say : "Can we used to host a standard
> UIView as an element, in this case no cell reuse will take place."
>
> That sounds bad.  What I'm not experienced enough to know.  What are
> people preferring to do when they want to render custom stuff?
> UIViewElement sounds easier.  Is it like doing a bargain with the
> devil?
>
> Thanks.
> --
> Phil Cockfield
>



 --
 *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/
>>>
>>> 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
>>> 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
>>> 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/
>
> 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
> 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
> 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


Re: [MonoTouch] UIDatePicker - AM/PM : Getting it exactly the wrong way around.

2012-07-10 Thread Phil Cockfield
Thanks Nic - good to know it actually is a TimeZone issue.
 Being exactly 12 hours off made it look suspicious :)

There must be some other trick, beyond what Mikkel was showing with the *
ToLocalTime*() methods to have it convert correctly.

Mikkel suggested this:

picker.Date = date.ToLocalTime();
date = DateTime.SpecifyKind(picker.Date, DateTimeKind.Local).ToLocalTime();


Were there other time localization calls you were making for TripWallet?


On Wed, Jul 11, 2012 at 12:44 AM, Nic Wise  wrote:

> The dates that come out of pickers are GMT. You are GMT+12 :)
>
> (I had the same problem developing TripWallet - I was in NZ then, too)
>
> On Tue, Jul 10, 2012 at 10:55 AM, Phil Cockfield 
> wrote:
> > I'm using a UIDatePicker control in a pretty standard way (I think).
>  That
> > is, I'm not setting much configuration at all at initialization:
> >
> > Control = new UIDatePicker(RectangleF.Empty){ AutoresizingMask =
> > UIViewAutoresizing.FlexibleWidth };
> >
> >
> > The problem is, when I read the selected Date value out of it, the AM/PM
> > values are exactly the wrong way around.  Eg. 1PM is being returned as
> 1AM
> > and vice versa.
> >
> > Here's a GIST of the entire code I've got (for context):
> >
> > https://gist.github.com/3082372
> >
> >
> > Is this some kind of time-zone wierdness.  I'm in NZ.  Doesn't seem like
> > it's time-zones though, because it's an exact reversal of the AM/PM
> values,
> > not a shift in the time.
> >
> > 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/
>
> 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
> 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
> 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


Re: [MonoTouch] IPhone Application Critical Scenario Help Required ---

2012-07-10 Thread Alex White
I am only a little way in front of you in terms of MT knowledge, but I have a 
lot of experience of other programming platforms, if anyone can spot a better 
way please correct me, what I would do is this.

Create a class that inherits uiview,

plan for reuse from the start, so plan for having the screen in 
landscape/portrait and for both the iPhone and iPad screen sizes,

create a view this is the total size of the control with the + and - buttons 
with the indicator in the middle, so the view will be a rectangle almost the 
height of the screen and say 50px wide, inside this view add the + button to 
the top of the view, the - button to the bottom of the view and using the code 
in the link in the previous email build the percentage bar in the middle, the 
key thing is that the variable for percentage for the view needs to be at the 
class level.

Something to consider is if the percentage is under say 20% colour it red, then 
yellow for 21%-80%, then green for >80% just a thought.

hopefully that should get you started, sorry I have no code to show you, 
hopefully someone else can provide a link to a working example.

ATB

Alex



On 10 Jul 2012, at 17:51, proindigo wrote:

> Yes you are correct. I will have to incorporate two buttons + and - for
> increasing and decreasing the level. My first question is, should I use a
> blank label or is there any other control in the library available that is
> more suited to this task? 
> 
> Let's assume for the sake of discussion that I use a blank label,
> representing a vertical bar. How to establish a mathematical logic so that
> when user clicks the + or - buttons, there is  increment or decrements [ie
> gets filled by green color] by a fixed amount, say 1/25th of the total
> height of the label. Can you provide me with an outline of some code block
> relating to this specific scenario. It would be immensely helpful to me. 
> 
> Meanwhile I am going to take a look at the link you forwarded me and
> consider the options.
> 
> Look forward to your reply.
> 
> Thanks.
> 
> --
> View this message in context: 
> http://monotouch.2284126.n4.nabble.com/IPhone-Application-Critical-Scenario-Help-Required-tp4655874p4655902.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] Binding an interface that conforms to multiple protocols

2012-07-10 Thread tkacem
Hi Nic,

Thanks for your reply. The interface definition is as follows:

*@interface GDExtended : NSObject 

- (void) handleEvent:(GDAppEvent *)anEvent;
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;

@end*


*@implementation GDExtended

- (id)init
{
self = [super init];
if (self) {
// Initialization code here.
}

return self;
}

- (void) handleEvent:(GDAppEvent *)anEvent
{

}

- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
return YES;
}

@end
*

I am trying to wrap this in c# knowing that c# does not allow multiple
implementation. I wrote the wrapper for this interface in c# (I need the
GDiOSDelegate in order to create the event handler method which should
communicate with components from UIApplicationDelegate class).
The problem is that when I inherit GDExtended in a sample monotouch
application that uses the created Dll, I get an error that my class does not
implement UIApplicationDelegate.

Your prompt attention to this message is highly appreciated.
Thanks,
Thabet

--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Binding-an-interface-that-conforms-to-multiple-protocols-tp4655661p4655901.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] IPhone Application Critical Scenario Help Required ---

2012-07-10 Thread proindigo
Yes you are correct. I will have to incorporate two buttons + and - for
increasing and decreasing the level. My first question is, should I use a
blank label or is there any other control in the library available that is
more suited to this task? 

Let's assume for the sake of discussion that I use a blank label,
representing a vertical bar. How to establish a mathematical logic so that
when user clicks the + or - buttons, there is  increment or decrements [ie
gets filled by green color] by a fixed amount, say 1/25th of the total
height of the label. Can you provide me with an outline of some code block
relating to this specific scenario. It would be immensely helpful to me. 

Meanwhile I am going to take a look at the link you forwarded me and
consider the options.

Look forward to your reply.

Thanks.

--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/IPhone-Application-Critical-Scenario-Help-Required-tp4655874p4655902.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] Try/Catch ok?

2012-07-10 Thread vulcanCCIT
Thank you! I love monotouch!!

From: jawbrey [via MonoTouch] [mailto:ml-node+s2284126n4655907...@n4.nabble.com]
Sent: Tuesday, July 10, 2012 10:23 AM
To: Condron, Chuck
Subject: Re: Try/Catch ok?

I assume they are left out mostly for the sake of brevity/simplicity
On Tue, Jul 10, 2012 at 12:21 PM, vulcanCCIT <[hidden 
email]> wrote:
Awesome, thank you!!  It surprises me that I have not seen this in the examples…

From: jawbrey [via MonoTouch] [mailto:[hidden 
email][hidden 
email]]
Sent: Tuesday, July 10, 2012 10:20 AM
To: Condron, Chuck
Subject: Re: Try/Catch ok?

sure it's OK
On Tue, Jul 10, 2012 at 12:18 PM, vulcanCCIT <[hidden 
email]> wrote:
As I study Monotouch and look at examples, so far I have not see any of the
book examples, Xamarin, or other internet examples use any Try/Catch blocks.
Is there a reason not to use those?  Or is this just obmitted for brevity?
I have ported over an app from objective C to Monotouch and I need to add
some error checking.

Thank you all!

--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Try-Catch-ok-tp4655904.html
Sent from the MonoTouch mailing list archive at Nabble.com.
___
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch


___
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch

If you reply to this email, your message will be added to the discussion below:
http://monotouch.2284126.n4.nabble.com/Try-Catch-ok-tp4655904p4655905.html
To unsubscribe from Try/Catch ok?, click here.
NAML


View this message in context: RE: Try/Catch 
ok?

Sent from the MonoTouch mailing list 
archive at Nabble.com.

___
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch


___
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch


If you reply to this email, your message will be added to the discussion below:
http://monotouch.2284126.n4.nabble.com/Try-Catch-ok-tp4655904p4655907.html
To unsubscribe from Try/Catch ok?, click 
here.
NAML


--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Try-Catch-ok-tp4655904p4655908.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] Try/Catch ok?

2012-07-10 Thread Jason Awbrey
I assume they are left out mostly for the sake of brevity/simplicity

On Tue, Jul 10, 2012 at 12:21 PM, vulcanCCIT
wrote:

>  Awesome, thank you!!  It surprises me that I have not seen this in the
> examples…
>
> ** **
>
> *From:* jawbrey [via MonoTouch] [mailto:ml-node+[hidden 
> email]]
>
> *Sent:* Tuesday, July 10, 2012 10:20 AM
> *To:* Condron, Chuck
> *Subject:* Re: Try/Catch ok?
>
> ** **
>
> sure it's OK
>
> On Tue, Jul 10, 2012 at 12:18 PM, vulcanCCIT <[hidden 
> email]>
> wrote:
>
> As I study Monotouch and look at examples, so far I have not see any of the
> book examples, Xamarin, or other internet examples use any Try/Catch
> blocks.
> Is there a reason not to use those?  Or is this just obmitted for brevity?
> I have ported over an app from objective C to Monotouch and I need to add
> some error checking.
>
> Thank you all!
>
> --
> View this message in context:
> http://monotouch.2284126.n4.nabble.com/Try-Catch-ok-tp4655904.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> ___
> MonoTouch mailing list
> [hidden email] 
> http://lists.ximian.com/mailman/listinfo/monotouch
>
>
>
> ___
> MonoTouch mailing list
> [hidden email] 
> http://lists.ximian.com/mailman/listinfo/monotouch
>
> 
>  --
>
> *If you reply to this email, your message will be added to the discussion
> below:*
>
> http://monotouch.2284126.n4.nabble.com/Try-Catch-ok-tp4655904p4655905.html
> 
>
> To unsubscribe from Try/Catch ok?, click here.
> NAML
> 
>
> --
> View this message in context: RE: Try/Catch 
> ok?
>
> Sent from the MonoTouch mailing list 
> archiveat 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] Try/Catch ok?

2012-07-10 Thread vulcanCCIT
Awesome, thank you!!  It surprises me that I have not seen this in the examples…

From: jawbrey [via MonoTouch] [mailto:ml-node+s2284126n4655905...@n4.nabble.com]
Sent: Tuesday, July 10, 2012 10:20 AM
To: Condron, Chuck
Subject: Re: Try/Catch ok?

sure it's OK
On Tue, Jul 10, 2012 at 12:18 PM, vulcanCCIT <[hidden 
email]> wrote:
As I study Monotouch and look at examples, so far I have not see any of the
book examples, Xamarin, or other internet examples use any Try/Catch blocks.
Is there a reason not to use those?  Or is this just obmitted for brevity?
I have ported over an app from objective C to Monotouch and I need to add
some error checking.

Thank you all!

--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Try-Catch-ok-tp4655904.html
Sent from the MonoTouch mailing list archive at Nabble.com.
___
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch


___
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch


If you reply to this email, your message will be added to the discussion below:
http://monotouch.2284126.n4.nabble.com/Try-Catch-ok-tp4655904p4655905.html
To unsubscribe from Try/Catch ok?, click 
here.
NAML


--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Try-Catch-ok-tp4655904p4655906.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] Try/Catch ok?

2012-07-10 Thread Jason Awbrey
sure it's OK

On Tue, Jul 10, 2012 at 12:18 PM, vulcanCCIT
wrote:

> As I study Monotouch and look at examples, so far I have not see any of the
> book examples, Xamarin, or other internet examples use any Try/Catch
> blocks.
> Is there a reason not to use those?  Or is this just obmitted for brevity?
> I have ported over an app from objective C to Monotouch and I need to add
> some error checking.
>
> Thank you all!
>
> --
> View this message in context:
> http://monotouch.2284126.n4.nabble.com/Try-Catch-ok-tp4655904.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] Try/Catch ok?

2012-07-10 Thread vulcanCCIT
As I study Monotouch and look at examples, so far I have not see any of the
book examples, Xamarin, or other internet examples use any Try/Catch blocks. 
Is there a reason not to use those?  Or is this just obmitted for brevity? 
I have ported over an app from objective C to Monotouch and I need to add
some error checking.  

Thank you all!

--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Try-Catch-ok-tp4655904.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] Hardware accelerated crypto in MT 5.3?

2012-07-10 Thread Alan
The algorithm is well defined so all implementations compliant to the
standard are 100% interchangeable. You can check which implementation
is actually being used by calling GetType () on the return value of
SHA256.Create (). If it's SHA256Managed, then you're using the normal
one. If it's anything else, you're using a special version.

Alan
On 10 July 2012 13:39, René Ruppert  wrote:
> "On iOS this could default to the native implementation" - I really would
> like to know if it WILL.
> Are they compatible? Meaning: If I used SHA256Managed so far and now switch,
> can data still be decrypted?
>
> René
>
> 2012/7/10 Alan 
>>
>> Hey,
>>
>> Don't use 'new SHA256Managed', use 'SHA256.Create ()'. This way the
>> mono runtime will be able to select the 'best' SHA256 implementation
>> to use. On iOS this could default to the native implementation, on
>> desktop this will default to SHA256Managed.
>>
>> Alan
>>
>> On 10 July 2012 12:28, René Ruppert  wrote:
>> > Hi,
>> >
>> > from the docs of 5.3:
>> >
>> > Common Crypto
>> >
>> > MonoTouch will now use the iOS CommonCrypto libraries to provide some of
>> > the
>> > functionality exposed by its APIs. This replaces our managed
>> > implementations
>> > with the native versions. It is now used for for digest (hash) and
>> > symmetric
>> > ciphers, leveraging the hardware acceleration for SHA-1 and AES under
>> > the
>> > right circumstances.
>> >
>> >
>> > I'm using code like the one below for hashing and encryption. How can I
>> > take
>> > advantage of HW crypto? Or will it automatically become faster?
>> >
>> > /// 
>> >
>> > /// Calculates the SHA256 hash value of the data b.
>> >
>> > /// 
>> >
>> > /// 
>> >
>> > /// The data of which the hash value is
>> > calculated.
>> >
>> > /// The SHA256 hash value of b.
>> >
>> > public static byte[] CalculateHash ( byte[] b )
>> >
>> > {
>> >
>> > SHA256Managed oSha = new SHA256Managed ();
>> >
>> > byte[] aHash = oSha.ComputeHash ( b );
>> >
>> > return aHash;
>> >
>> > }
>> >
>> > /// 
>> >
>> > /// Computes SHA256 hash from a string
>> >
>> > /// 
>> >
>> > /// 
>> >
>> > /// 
>> >
>> > public static string ComputeSHA256HashUnicode ( string sData )
>> >
>> > {
>> >
>> > byte[] aData, aHash;
>> >
>> >
>> > UnicodeEncoding oEncoding = new UnicodeEncoding ();
>> >
>> > aData = oEncoding.GetBytes ( sData );
>> >
>> > aHash = CalculateHash(aData);
>> >
>> > string sResult = oEncoding.GetString ( aHash );
>> >
>> > return sResult;
>> >
>> > }
>> >
>> >
>> >
>> > public static void Crypt ( Stream oFileIn, Stream oFileOut,
>> > ICryptoTransform
>> > oTrans )
>> >
>> > {
>> >
>> > // Declare local variables
>> >
>> > byte[] buf = new byte[ 4096]; // Read buffer
>> >
>> > int iLen; // Current buffer length
>> >
>> > long lReadLen = 0; // Total number of bytes written.
>> >
>> > long lTotLen = oFileIn.Length; // Total length of the input file.
>> >
>> >
>> > // Move to the beginning of the file
>> >
>> > if ( oFileIn.Position > 0 && oFileIn.CanSeek )
>> >
>> > oFileIn.Seek ( 0, SeekOrigin.Begin );
>> >
>> >
>> > // Create the cryptographic stream
>> >
>> > CryptoStream encStream = new CryptoStream (oFileOut, oTrans,
>> > CryptoStreamMode.Write);
>> >
>> >
>> > // Read from the input file, then encrypt/decrypt and write to the
>> > output
>> > file.
>> >
>> > while ( lReadLen < lTotLen )
>> >
>> > {
>> >
>> > iLen = oFileIn.Read ( buf, 0, buf.Length );
>> >
>> > encStream.Write ( buf, 0, iLen );
>> >
>> > lReadLen += iLen;
>> >
>> > }
>> >
>> > // Clean up
>> >
>> > encStream.Close ();
>> >
>> > }
>> >
>> >
>> >
>> > René
>> >
>> >
>> > ___
>> > 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] Side Navigation (a la "Path" and "Facebook")

2012-07-10 Thread Nic Wise
oooh, that one looks good.

Direct link, for the moment:

https://github.com/sgmunn/MonoKit/blob/master/MonoKit.iOS/UI/ViewControllers/SlidingViewController.cs

(Unless you finish it before I have time to put it in my app, if I
make changes, I'll pull-request them back in)


On Tue, Jul 10, 2012 at 2:35 PM, Greg Munn  wrote:
> I also found ViewDeck, https://github.com/Inferis/ViewDeck, which is a bit 
> more involved but has a few more features (including a bounce) when pulling 
> the view too far.  I've had a crack at porting it and so far it has come 
> along quite nicely.
>
> my port is https://github.com/sgmunn/MonoKit  -- search for Class2.cs  (still 
> in progress :).
>
> Cheers,
> Greg
>
>
> On 05/07/2012, at 7:03 PM, Nic Wise wrote:
>
>> Thanks Greg. I might try to port that over - looks like a nice 
>> implementation.
>>
>> On Thu, Jul 5, 2012 at 12:12 AM, Greg Munn  wrote:
>>> This one is written in Obj-C and flies out from the bottom, but you could 
>>> adapt it easily enough.
>>>
>>> https://github.com/iridia/IRSlidingSplitViewController
>>>
>>>
>>> On 04/07/2012, at 11:59 PM, Nic Wise wrote:
>>>
 (there is a 40k limit in posts, so... this is now plaintext)


 James Clancey has done a basic version of it:

 https://github.com/Clancey/FlyOutNavigation

 I've not seen anything else, tho. But on the surface, it shouldn't be
 too hard. Two views, one under the other. Trigger something (button)
 and animate the top view away. Trigger something (gesture?) and
 animate it back in.

 I did a basic one, with a huge UIImageView as the background, and you
 hit something, and it just scrolled over the show the left side.

 so, assuming you have a 320x2 x 480 image (non-retina) as the
 background view (BaseView), the button (trigger) just calls
 SetInitialPage(0, true) for the left side, and 0,true for the right
 side.

 BaseView = new UIView(new RectangleF(new PointF(0,0),
 Resources.Background.Size)); //Resources.Background is the big image!
 baseView.BackgroundColor = Resources.MoleskineBackgroundColor; //it's
 a color, but it's a pattern
 View.AddSubview(baseView);

 //just add it into the View's view... this is all just in a 
 UIViewController

 public void TogglePage()
   {
   page = (page == 1) ? 0 : 1;

   SetInitialPage(page);
   sideButton.SetTitle((page == 1) ? "<<" : ">>",
 UIControlState.Normal);
   }


   public override void SetInitialPage(int page, bool animate = true)
   {
   if (animate)
   {
   UIView.BeginAnimations("pagescroll");
   UIView.SetAnimationDuration(0.75f);
   UIView.SetAnimationCurve(UIViewAnimationCurve.EaseInOut);
   }

   if (page == 0)
   {
   var baseViewBounds = BaseView.Bounds;
   baseViewBounds.X = 0;
   BaseView.Bounds = baseViewBounds;

   } else {
   var baseViewBounds = BaseView.Bounds;
   baseViewBounds.X = BaseView.Bounds.Width - 320;
   BaseView.Bounds = baseViewBounds;
   }

   if (animate)
   {
   UIView.CommitAnimations();
   }
   base.SetInitialPage(page, animate);
   }
 ___
 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/
>>
>> 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
>> 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
>> London Bike App: Find the nearest Boris Bike, and get riding! 
>> http://goo.gl/Icp2
>



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

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
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
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


Re: [MonoTouch] Side Navigation (a la "Path" and "Facebook")

2012-07-10 Thread Greg Munn
I also found ViewDeck, https://github.com/Inferis/ViewDeck, which is a bit more 
involved but has a few more features (including a bounce) when pulling the view 
too far.  I've had a crack at porting it and so far it has come along quite 
nicely.  

my port is https://github.com/sgmunn/MonoKit  -- search for Class2.cs  (still 
in progress :).

Cheers,
Greg


On 05/07/2012, at 7:03 PM, Nic Wise wrote:

> Thanks Greg. I might try to port that over - looks like a nice implementation.
> 
> On Thu, Jul 5, 2012 at 12:12 AM, Greg Munn  wrote:
>> This one is written in Obj-C and flies out from the bottom, but you could 
>> adapt it easily enough.
>> 
>> https://github.com/iridia/IRSlidingSplitViewController
>> 
>> 
>> On 04/07/2012, at 11:59 PM, Nic Wise wrote:
>> 
>>> (there is a 40k limit in posts, so... this is now plaintext)
>>> 
>>> 
>>> James Clancey has done a basic version of it:
>>> 
>>> https://github.com/Clancey/FlyOutNavigation
>>> 
>>> I've not seen anything else, tho. But on the surface, it shouldn't be
>>> too hard. Two views, one under the other. Trigger something (button)
>>> and animate the top view away. Trigger something (gesture?) and
>>> animate it back in.
>>> 
>>> I did a basic one, with a huge UIImageView as the background, and you
>>> hit something, and it just scrolled over the show the left side.
>>> 
>>> so, assuming you have a 320x2 x 480 image (non-retina) as the
>>> background view (BaseView), the button (trigger) just calls
>>> SetInitialPage(0, true) for the left side, and 0,true for the right
>>> side.
>>> 
>>> BaseView = new UIView(new RectangleF(new PointF(0,0),
>>> Resources.Background.Size)); //Resources.Background is the big image!
>>> baseView.BackgroundColor = Resources.MoleskineBackgroundColor; //it's
>>> a color, but it's a pattern
>>> View.AddSubview(baseView);
>>> 
>>> //just add it into the View's view... this is all just in a UIViewController
>>> 
>>> public void TogglePage()
>>>   {
>>>   page = (page == 1) ? 0 : 1;
>>> 
>>>   SetInitialPage(page);
>>>   sideButton.SetTitle((page == 1) ? "<<" : ">>",
>>> UIControlState.Normal);
>>>   }
>>> 
>>> 
>>>   public override void SetInitialPage(int page, bool animate = true)
>>>   {
>>>   if (animate)
>>>   {
>>>   UIView.BeginAnimations("pagescroll");
>>>   UIView.SetAnimationDuration(0.75f);
>>>   UIView.SetAnimationCurve(UIViewAnimationCurve.EaseInOut);
>>>   }
>>> 
>>>   if (page == 0)
>>>   {
>>>   var baseViewBounds = BaseView.Bounds;
>>>   baseViewBounds.X = 0;
>>>   BaseView.Bounds = baseViewBounds;
>>> 
>>>   } else {
>>>   var baseViewBounds = BaseView.Bounds;
>>>   baseViewBounds.X = BaseView.Bounds.Width - 320;
>>>   BaseView.Bounds = baseViewBounds;
>>>   }
>>> 
>>>   if (animate)
>>>   {
>>>   UIView.CommitAnimations();
>>>   }
>>>   base.SetInitialPage(page, animate);
>>>   }
>>> ___
>>> 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/
> 
> 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
> 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
> 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


Re: [MonoTouch] UIDatePicker - AM/PM : Getting it exactly the wrong way around.

2012-07-10 Thread Nic Wise
The dates that come out of pickers are GMT. You are GMT+12 :)

(I had the same problem developing TripWallet - I was in NZ then, too)

On Tue, Jul 10, 2012 at 10:55 AM, Phil Cockfield  wrote:
> I'm using a UIDatePicker control in a pretty standard way (I think).  That
> is, I'm not setting much configuration at all at initialization:
>
> Control = new UIDatePicker(RectangleF.Empty){ AutoresizingMask =
> UIViewAutoresizing.FlexibleWidth };
>
>
> The problem is, when I read the selected Date value out of it, the AM/PM
> values are exactly the wrong way around.  Eg. 1PM is being returned as 1AM
> and vice versa.
>
> Here's a GIST of the entire code I've got (for context):
>
> https://gist.github.com/3082372
>
>
> Is this some kind of time-zone wierdness.  I'm in NZ.  Doesn't seem like
> it's time-zones though, because it's an exact reversal of the AM/PM values,
> not a shift in the time.
>
> 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/

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
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
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


Re: [MonoTouch] OwnerDrawnElement vs. UIViewElement

2012-07-10 Thread Nic Wise
That should work. I tend to make a normal cell and inject things into the
ContentView, but I suspect yours is cleaner and the "better" way. My "way"
dates back 12-24 months, so better tricks may have come up since then.

The MWC app might be a good place to look:
https://github.com/xamarin/mobile-samples/tree/master/MWC/MWC.iOS/UI/CustomElements


.. as it's fairly recent.

On Tue, Jul 10, 2012 at 11:08 AM, Phil Cockfield  wrote:

> Thanks *Nic*,
>
> So something like this(?):
>
> https://gist.github.com/3082446
>
>
> If you're going of *Element*, you don't have a *UIView *to play with,
> right?  I'm not sure if going all the way to Element is too low-level for
> me - but if I want complete rendering control, I think I need to.
>
> In the gist I have to create my own *TableViewCell*.  Is this in the
> weeks, or the right way to do things?  I suspect that this could be more
> efficient, given the warnings about cell's not being recycled when using
> the *UIViewElement.*
>
> From the docs:
>
> *UIViewElement
> *
> Can we used to host a standard UIView as an element, in this case no cell
> reuse will take place.
>
>
>
>
>
> On Tue, Jul 10, 2012 at 7:12 PM, Nic Wise  wrote:
>
>> Yup, thats what I do: inherit off Element (or something a little further
>> down the stack) and add my own stuff into the view
>>
>> yell for code. :)
>>
>> On Tue, Jul 10, 2012 at 6:31 AM, Phil Cockfield wrote:
>>
>>> I just found this by Miguel:
>>>
>>>
>>> http://stackoverflow.com/questions/4028356/monotouch-dialogs-ownerdrawnelement-highlight-not-working
>>>
>>> The OwnerDrawnElement was a contribution from the community, and it is
>>> not as sophisticated as it should be. I would not depend on it for anything
>>> beyond the trivially basic.
>>>
>>> I strongly recommend that you create your own Element, if you want to
>>> reuse some of the code for OwnerDrawElement, you could copy and paste that.
>>>
>>>
>>> So perhaps I should be just deriving from *Element* and overriding *
>>> GetCell*.  Is that too low-level?
>>> What's the best practice here?
>>>
>>> Thanks!
>>>
>>>
>>>
>>> On Tue, Jul 10, 2012 at 2:27 PM, Phil Cockfield wrote:
>>>
 When wanting to get in and totally control cell style rendering, is
 there a preferred approach between these two options:

 - OwnerDrawnElement
 - UIViewElement

 For [UIViewElement] the docs say : "Can we used to host a standard
 UIView as an element, in this case no cell reuse will take place."

 That sounds bad.  What I'm not experienced enough to know.  What are
 people preferring to do when they want to render custom stuff?
 UIViewElement sounds easier.  Is it like doing a bargain with the
 devil?

 Thanks.
 --
 Phil Cockfield

>>>
>>>
>>>
>>> --
>>> *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/
>>
>> 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
>> 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
>> 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/

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
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
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


Re: [MonoTouch] StringElement Button - As Stateful Button

2012-07-10 Thread Nic Wise
StringElement's Selected explicitly calls

tableView.DeselectRow (indexPath, true);

which will turn the blue off :) So don't. :)

On Tue, Jul 10, 2012 at 12:01 PM, Phil Cockfield  wrote:

> I'm trying to something along the lines of the screen in the *Calendar*app 
> where you set the
> *Starts* and *Ends* times.
>
> I have two *StringElement*'s that Im' using as the *Starts* and 
> *Ends*buttons, and when one or the other is selected I am showing a 
> UIDatePicker.
>
>   Root = new RootElement("Schedule"){
> new Section(""){
>   (startElement = new StringElement("Starts")),
>   (endElement = new StringElement("Ends"))
> }
>   };
>
> What I can't see how to do is to make either* startElement* or *endElement
> * a "stateful" button.  That is to say, when it is selected, it retains
> it's blue background, expressing that this is the value that is being
> edited by the *DatePicker*.
>
> Is this possible with* StringElement*?  Equally, I can't see anything
> obvious to do this on the *StyledStringElement*.
>
> Thanks everyone.
> --
> *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/

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
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
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


Re: [MonoTouch] Hardware accelerated crypto in MT 5.3?

2012-07-10 Thread René Ruppert
"On iOS this could default to the native implementation" - I really would
like to know if it WILL.
Are they compatible? Meaning: If I used SHA256Managed so far and now
switch, can data still be decrypted?

René

2012/7/10 Alan 

> Hey,
>
> Don't use 'new SHA256Managed', use 'SHA256.Create ()'. This way the
> mono runtime will be able to select the 'best' SHA256 implementation
> to use. On iOS this could default to the native implementation, on
> desktop this will default to SHA256Managed.
>
> Alan
>
> On 10 July 2012 12:28, René Ruppert  wrote:
> > Hi,
> >
> > from the docs of 5.3:
> >
> > Common Crypto
> >
> > MonoTouch will now use the iOS CommonCrypto libraries to provide some of
> the
> > functionality exposed by its APIs. This replaces our managed
> implementations
> > with the native versions. It is now used for for digest (hash) and
> symmetric
> > ciphers, leveraging the hardware acceleration for SHA-1 and AES under the
> > right circumstances.
> >
> >
> > I'm using code like the one below for hashing and encryption. How can I
> take
> > advantage of HW crypto? Or will it automatically become faster?
> >
> > /// 
> >
> > /// Calculates the SHA256 hash value of the data b.
> >
> > /// 
> >
> > /// 
> >
> > /// The data of which the hash value is
> > calculated.
> >
> > /// The SHA256 hash value of b.
> >
> > public static byte[] CalculateHash ( byte[] b )
> >
> > {
> >
> > SHA256Managed oSha = new SHA256Managed ();
> >
> > byte[] aHash = oSha.ComputeHash ( b );
> >
> > return aHash;
> >
> > }
> >
> > /// 
> >
> > /// Computes SHA256 hash from a string
> >
> > /// 
> >
> > /// 
> >
> > /// 
> >
> > public static string ComputeSHA256HashUnicode ( string sData )
> >
> > {
> >
> > byte[] aData, aHash;
> >
> >
> > UnicodeEncoding oEncoding = new UnicodeEncoding ();
> >
> > aData = oEncoding.GetBytes ( sData );
> >
> > aHash = CalculateHash(aData);
> >
> > string sResult = oEncoding.GetString ( aHash );
> >
> > return sResult;
> >
> > }
> >
> >
> >
> > public static void Crypt ( Stream oFileIn, Stream oFileOut,
> ICryptoTransform
> > oTrans )
> >
> > {
> >
> > // Declare local variables
> >
> > byte[] buf = new byte[ 4096]; // Read buffer
> >
> > int iLen; // Current buffer length
> >
> > long lReadLen = 0; // Total number of bytes written.
> >
> > long lTotLen = oFileIn.Length; // Total length of the input file.
> >
> >
> > // Move to the beginning of the file
> >
> > if ( oFileIn.Position > 0 && oFileIn.CanSeek )
> >
> > oFileIn.Seek ( 0, SeekOrigin.Begin );
> >
> >
> > // Create the cryptographic stream
> >
> > CryptoStream encStream = new CryptoStream (oFileOut, oTrans,
> > CryptoStreamMode.Write);
> >
> >
> > // Read from the input file, then encrypt/decrypt and write to the output
> > file.
> >
> > while ( lReadLen < lTotLen )
> >
> > {
> >
> > iLen = oFileIn.Read ( buf, 0, buf.Length );
> >
> > encStream.Write ( buf, 0, iLen );
> >
> > lReadLen += iLen;
> >
> > }
> >
> > // Clean up
> >
> > encStream.Close ();
> >
> > }
> >
> >
> >
> > René
> >
> >
> > ___
> > 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] Side Navigation (a la "Path" and "Facebook")

2012-07-10 Thread Nic Wise
hrmmm, sounds interesting :) Not played with transforms much

On Mon, Jul 9, 2012 at 6:00 PM, rnendel11  wrote:
> A deviation for this comes to mind, instead of a "strip" of the, let's say,
> left-hand part of the original UI, why not animate a scale transform on the
> primary view, thereby automatically showing an already positioned and
> present navigation "pane" that is "under" the main UI all the time.
>
> Be super easy actually
>
> 1. Load navigation view
> 2. Load main view
> 3. On trigger (to show navigation)
> UIView.Animate(duration, delay, option,
>delegate
> {
> mainView.Transform = CGAffineTransform.MakeScale(.25f, 1f);
> },
> delegate
> {
> // do something after the animation completes
> }
>
> Note the .25 and 1 on the scale, leave the vertical unscaled but scale the
> horizontal instead - for example - you could also just apply a translation
> transform to move the view to the side in the exact same manner as above.
>
> Not sure if its relevant, just something that came to mind browsing the post
> :-)
>
> --
> View this message in context: 
> http://monotouch.2284126.n4.nabble.com/Side-Navigation-a-la-Path-and-Facebook-tp4655753p4655875.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



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

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
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
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


Re: [MonoTouch] Hardware accelerated crypto in MT 5.3?

2012-07-10 Thread Alan
Hey,

Don't use 'new SHA256Managed', use 'SHA256.Create ()'. This way the
mono runtime will be able to select the 'best' SHA256 implementation
to use. On iOS this could default to the native implementation, on
desktop this will default to SHA256Managed.

Alan

On 10 July 2012 12:28, René Ruppert  wrote:
> Hi,
>
> from the docs of 5.3:
>
> Common Crypto
>
> MonoTouch will now use the iOS CommonCrypto libraries to provide some of the
> functionality exposed by its APIs. This replaces our managed implementations
> with the native versions. It is now used for for digest (hash) and symmetric
> ciphers, leveraging the hardware acceleration for SHA-1 and AES under the
> right circumstances.
>
>
> I'm using code like the one below for hashing and encryption. How can I take
> advantage of HW crypto? Or will it automatically become faster?
>
> /// 
>
> /// Calculates the SHA256 hash value of the data b.
>
> /// 
>
> /// 
>
> /// The data of which the hash value is
> calculated.
>
> /// The SHA256 hash value of b.
>
> public static byte[] CalculateHash ( byte[] b )
>
> {
>
> SHA256Managed oSha = new SHA256Managed ();
>
> byte[] aHash = oSha.ComputeHash ( b );
>
> return aHash;
>
> }
>
> /// 
>
> /// Computes SHA256 hash from a string
>
> /// 
>
> /// 
>
> /// 
>
> public static string ComputeSHA256HashUnicode ( string sData )
>
> {
>
> byte[] aData, aHash;
>
>
> UnicodeEncoding oEncoding = new UnicodeEncoding ();
>
> aData = oEncoding.GetBytes ( sData );
>
> aHash = CalculateHash(aData);
>
> string sResult = oEncoding.GetString ( aHash );
>
> return sResult;
>
> }
>
>
>
> public static void Crypt ( Stream oFileIn, Stream oFileOut, ICryptoTransform
> oTrans )
>
> {
>
> // Declare local variables
>
> byte[] buf = new byte[ 4096]; // Read buffer
>
> int iLen; // Current buffer length
>
> long lReadLen = 0; // Total number of bytes written.
>
> long lTotLen = oFileIn.Length; // Total length of the input file.
>
>
> // Move to the beginning of the file
>
> if ( oFileIn.Position > 0 && oFileIn.CanSeek )
>
> oFileIn.Seek ( 0, SeekOrigin.Begin );
>
>
> // Create the cryptographic stream
>
> CryptoStream encStream = new CryptoStream (oFileOut, oTrans,
> CryptoStreamMode.Write);
>
>
> // Read from the input file, then encrypt/decrypt and write to the output
> file.
>
> while ( lReadLen < lTotLen )
>
> {
>
> iLen = oFileIn.Read ( buf, 0, buf.Length );
>
> encStream.Write ( buf, 0, iLen );
>
> lReadLen += iLen;
>
> }
>
> // Clean up
>
> encStream.Close ();
>
> }
>
>
>
> René
>
>
> ___
> 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] Guid.Parse doesn't seem to exist with Reflection

2012-07-10 Thread eclipsed4utoo
Just thought I'd update this.  It seems the same issue occurs for 'double'
and 'decimal' types. I have added code to specifically handle these three
scenarios(Guid, double, decimal).  

Is this a bug or something?

--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Guid-Parse-doesn-t-seem-to-exist-with-Reflection-tp4655870p4655892.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] add tab bar to UIView

2012-07-10 Thread Brett Spurrier
You need to set the tabber frame.


On Tuesday, July 10, 2012, Vu Dang wrote:

> Hi,
>
> Is there a way to add a UITabBar to an UIView programmatically?  I would
> like to treat the UITabBarItems as a button rather than UIViewController?
>  I can use Xcode and added the UITabBar using xib UIdesign tool, but never
> get to work programmatically, the UITabBar is not showing after I add it to
> the UIView.subview.
>
> for example:
>
> // create item1
> UITabBarItem item1 = UITabBarItem();
> UITabBarItem item2 = UITabBarItem();
>
> var tabs = new UITabBarItem[] {item1, item2};
>
> // create UITabBar
> UITabBar tabBar = new UITabBar();
> tabBar.SetItems(tabs, true);
>
> uiView.AddSubview(tabBar);
>
> But tabBar didn't show.
>
> Thanks,
___
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch


[MonoTouch] Hardware accelerated crypto in MT 5.3?

2012-07-10 Thread René Ruppert
Hi,

from the docs of 5.3:

Common Crypto

MonoTouch will now use the iOS CommonCrypto libraries to provide some of
the functionality exposed by its APIs. This replaces our managed
implementations with the native versions. It is now used for for digest
(hash) and symmetric ciphers, leveraging the hardware acceleration for
SHA-1 and AES under the right circumstances.


I'm using code like the one below for hashing and encryption. How can I
take advantage of HW crypto? Or will it automatically become faster?

/// 

/// Calculates the SHA256 hash value of the data b.

/// 

/// 

/// The data of which the hash value is
calculated.

/// The SHA256 hash value of b.

public static byte[] CalculateHash ( byte[] b )

{

SHA256Managed oSha = new SHA256Managed ();

byte[] aHash = oSha.ComputeHash ( b );

 return aHash;

}

 /// 

/// Computes SHA256 hash from a string

/// 

/// 

/// 

public static string ComputeSHA256HashUnicode ( string sData )

{

byte[] aData, aHash;


 UnicodeEncoding oEncoding = new UnicodeEncoding ();

aData = oEncoding.GetBytes ( sData );

aHash = CalculateHash(aData);

string sResult = oEncoding.GetString ( aHash );

return sResult;

}


public static void Crypt ( Stream oFileIn, Stream oFileOut,
ICryptoTransform oTrans )

{

// Declare local variables

byte[] buf = new byte[ 4096]; // Read buffer

int iLen; // Current buffer length

long lReadLen = 0; // Total number of bytes written.

long lTotLen = oFileIn.Length; // Total length of the input file.


 // Move to the beginning of the file

if ( oFileIn.Position > 0 && oFileIn.CanSeek )

oFileIn.Seek ( 0, SeekOrigin.Begin );


 // Create the cryptographic stream

CryptoStream encStream = new CryptoStream (oFileOut, oTrans,
CryptoStreamMode.Write);


 // Read from the input file, then encrypt/decrypt and write to the output
file.

while ( lReadLen < lTotLen )

{

iLen = oFileIn.Read ( buf, 0, buf.Length );

encStream.Write ( buf, 0, iLen );

lReadLen += iLen;

}

 // Clean up

encStream.Close ();

}


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


[MonoTouch] StringElement Button - As Stateful Button

2012-07-10 Thread Phil Cockfield
I'm trying to something along the lines of the screen in the *Calendar* app
where you set the *Starts* and *Ends* times.

I have two *StringElement*'s that Im' using as the *Starts* and
*Ends*buttons, and when one or the other is selected I am showing a
UIDatePicker.

  Root = new RootElement("Schedule"){
new Section(""){
  (startElement = new StringElement("Starts")),
  (endElement = new StringElement("Ends"))
}
  };

What I can't see how to do is to make either* startElement* or
*endElement*a "stateful" button.  That is to say, when it is selected,
it retains it's
blue background, expressing that this is the value that is being edited by
the *DatePicker*.

Is this possible with* StringElement*?  Equally, I can't see anything
obvious to do this on the *StyledStringElement*.

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


Re: [MonoTouch] OwnerDrawnElement vs. UIViewElement

2012-07-10 Thread Phil Cockfield
Thanks *Nic*,

So something like this(?):

https://gist.github.com/3082446


If you're going of *Element*, you don't have a *UIView *to play with,
right?  I'm not sure if going all the way to Element is too low-level for
me - but if I want complete rendering control, I think I need to.

In the gist I have to create my own *TableViewCell*.  Is this in the weeks,
or the right way to do things?  I suspect that this could be more
efficient, given the warnings about cell's not being recycled when using
the *UIViewElement.*

>From the docs:

*UIViewElement
*Can we used to host a standard UIView as an element, in this case no cell
reuse will take place.





On Tue, Jul 10, 2012 at 7:12 PM, Nic Wise  wrote:

> Yup, thats what I do: inherit off Element (or something a little further
> down the stack) and add my own stuff into the view
>
> yell for code. :)
>
> On Tue, Jul 10, 2012 at 6:31 AM, Phil Cockfield wrote:
>
>> I just found this by Miguel:
>>
>>
>> http://stackoverflow.com/questions/4028356/monotouch-dialogs-ownerdrawnelement-highlight-not-working
>>
>> The OwnerDrawnElement was a contribution from the community, and it is
>> not as sophisticated as it should be. I would not depend on it for anything
>> beyond the trivially basic.
>>
>> I strongly recommend that you create your own Element, if you want to
>> reuse some of the code for OwnerDrawElement, you could copy and paste that.
>>
>>
>> So perhaps I should be just deriving from *Element* and overriding *
>> GetCell*.  Is that too low-level?
>> What's the best practice here?
>>
>> Thanks!
>>
>>
>>
>> On Tue, Jul 10, 2012 at 2:27 PM, Phil Cockfield wrote:
>>
>>> When wanting to get in and totally control cell style rendering, is
>>> there a preferred approach between these two options:
>>>
>>> - OwnerDrawnElement
>>> - UIViewElement
>>>
>>> For [UIViewElement] the docs say : "Can we used to host a standard
>>> UIView as an element, in this case no cell reuse will take place."
>>>
>>> That sounds bad.  What I'm not experienced enough to know.  What are
>>> people preferring to do when they want to render custom stuff?
>>> UIViewElement sounds easier.  Is it like doing a bargain with the
>>> devil?
>>>
>>> Thanks.
>>> --
>>> Phil Cockfield
>>>
>>
>>
>>
>> --
>> *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/
>
> 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
> 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
> 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


Re: [MonoTouch] UIDatePicker - AM/PM : Getting it exactly the wrong way around.

2012-07-10 Thread Mikkel Lønow
Hi,

I think the date picker handles date/time internally in some way, so I
use my date picker this way:

picker.Date = date.ToLocalTime();

date = DateTime.SpecifyKind(picker.Date, DateTimeKind.Local).ToLocalTime();

Does that help?

Mikkel

On Tue, Jul 10, 2012 at 11:55 AM, Phil Cockfield  wrote:

> I'm using a *UIDatePicker *control in a pretty standard way (I think).
>  That is, I'm not setting much configuration at all at initialization:
>
> Control = new UIDatePicker(RectangleF.Empty){ AutoresizingMask =
> UIViewAutoresizing.FlexibleWidth };
>
>
> The problem is, when I read the selected *Date* value out of it, the
> AM/PM values are exactly the wrong way around.  Eg. 1PM is being returned
> as 1AM and vice versa.
>
> Here's a GIST of the entire code I've got (for context):
>
> https://gist.github.com/3082372
>
>
> Is this some kind of time-zone wierdness.  I'm in NZ.  Doesn't seem like
> it's time-zones though, because it's an exact reversal of the AM/PM values,
> not a shift in the time.
>
> 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


[MonoTouch] UIDatePicker - AM/PM : Getting it exactly the wrong way around.

2012-07-10 Thread Phil Cockfield
I'm using a *UIDatePicker *control in a pretty standard way (I think).
 That is, I'm not setting much configuration at all at initialization:

Control = new UIDatePicker(RectangleF.Empty){ AutoresizingMask =
UIViewAutoresizing.FlexibleWidth };


The problem is, when I read the selected *Date* value out of it, the AM/PM
values are exactly the wrong way around.  Eg. 1PM is being returned as 1AM
and vice versa.

Here's a GIST of the entire code I've got (for context):

https://gist.github.com/3082372


Is this some kind of time-zone wierdness.  I'm in NZ.  Doesn't seem like
it's time-zones though, because it's an exact reversal of the AM/PM values,
not a shift in the time.

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


Re: [MonoTouch] IPhone Application Critical Scenario Help Required ---

2012-07-10 Thread Alex White
hi,

Am I reading you right, you want a button that as the user presses it the 
indicator grows?, firstly this has a problem, that is what happens if the user 
presses it for too long and wants to go back a bit, your design needs to 
incorporate this functionality, look at the built in progress indicators to see 
if they fit the bill.

this may help a bit

http://rlopezxl.com/2009/10/16/monotouch-drawing-custom-progress-bars/

as a general rule you create a class level variable for the percentage (use a 
double type variable and round when you need to) this can be manipulated via 
many buttons if desired.

If I was going to do a custom bar I would put a plus button at the top and a 
minus button at the bottom to move the value up and down.

ATB

Alex





On 9 Jul 2012, at 16:55, proindigo wrote:

> Hello and Greetings.
> 
> As part of my sample application that I am trying to develop, I am working
> on a module which I will describe in detail. It is a bit tricky and I need
> all the help in terms of code blocks and tutorials in order to implement
> this successfully. There's a module called Assessment where a user will be
> allowed to assess the quality of a product supplied to him [it could be
> anything ranging from building materials, to cloth to wooden furniture.]
> 
> The totality of the product will be represented by an empty vertical bar.
> The user will touch a small button placed at the foot of this bar and this
> will keep filling the initially empty bar with green color. The level upto
> which the bar will be filled with this green indicator will ultimately
> represent the quality of the product in percentage. And the reading will be
> shown on a label on the screen.
> 
> Something like this -->
> 
> http://monotouch.2284126.n4.nabble.com/file/n4655874/PIC.bmp 
> 
> Now I have no shame in admitting that this is beyond my scope right at this
> point of time, my experience in MonoTouch being just 37 days worth. I really
> need to get this done. Difficult as it is, it's a very interesting and
> absorbing part of my sample project. I hope I have been able to convey my
> requirement to you clearly. 
> 
> Looking forward to receive all the help from our forum members. /You may
> have to guide me through every step of the process, if need be. I'll be
> grateful if someone corresponds with me regularly and helps me do this
> module.
> 
> Many Thanks.
> 
> --
> View this message in context: 
> http://monotouch.2284126.n4.nabble.com/IPhone-Application-Critical-Scenario-Help-Required-tp4655874.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] Side Navigation (a la "Path" and "Facebook")

2012-07-10 Thread rnendel11
A deviation for this comes to mind, instead of a "strip" of the, let's say,
left-hand part of the original UI, why not animate a scale transform on the
primary view, thereby automatically showing an already positioned and
present navigation "pane" that is "under" the main UI all the time.

Be super easy actually

1. Load navigation view
2. Load main view
3. On trigger (to show navigation)
UIView.Animate(duration, delay, option,
   delegate
{
mainView.Transform = CGAffineTransform.MakeScale(.25f, 1f);
},
delegate
{
// do something after the animation completes
}

Note the .25 and 1 on the scale, leave the vertical unscaled but scale the
horizontal instead - for example - you could also just apply a translation
transform to move the view to the side in the exact same manner as above.

Not sure if its relevant, just something that came to mind browsing the post
:-)

--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Side-Navigation-a-la-Path-and-Facebook-tp4655753p4655875.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] IPhone Application Critical Scenario Help Required ---

2012-07-10 Thread proindigo
Hello and Greetings.

As part of my sample application that I am trying to develop, I am working
on a module which I will describe in detail. It is a bit tricky and I need
all the help in terms of code blocks and tutorials in order to implement
this successfully. There's a module called Assessment where a user will be
allowed to assess the quality of a product supplied to him [it could be
anything ranging from building materials, to cloth to wooden furniture.]

The totality of the product will be represented by an empty vertical bar.
The user will touch a small button placed at the foot of this bar and this
will keep filling the initially empty bar with green color. The level upto
which the bar will be filled with this green indicator will ultimately
represent the quality of the product in percentage. And the reading will be
shown on a label on the screen.

Something like this -->

http://monotouch.2284126.n4.nabble.com/file/n4655874/PIC.bmp 

Now I have no shame in admitting that this is beyond my scope right at this
point of time, my experience in MonoTouch being just 37 days worth. I really
need to get this done. Difficult as it is, it's a very interesting and
absorbing part of my sample project. I hope I have been able to convey my
requirement to you clearly. 

Looking forward to receive all the help from our forum members. /You may
have to guide me through every step of the process, if need be. I'll be
grateful if someone corresponds with me regularly and helps me do this
module.

Many Thanks.

--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/IPhone-Application-Critical-Scenario-Help-Required-tp4655874.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] Keyboard "up" (ie. "shown") notification

2012-07-10 Thread rnendel11
Thanks for the replies, will give that a try.  Much appreciated.

--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Keyboard-up-ie-shown-notification-tp4655843p4655873.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] Implementing UIPickerView with data from Database --

2012-07-10 Thread proindigo
Well I have reviewed my code blocks and removed off the needless parts. All I
am doing is, returning a list of class objects [the class containing the
properties I need] from my database handler function, written a custom class
extending the UIPickerViewModel class. 

So we have a class-->

namespace ASTONAPP
{
public class PickerFacilityTemplate
{
public PickerFacilityTemplate ()
{
}

public int AssessmentID{get; set;}
public int FacilityID{get; set;}
public string FacilityName{get; set;}
}
}

My database handler function

public List FetchFacility()
{
DataSet ds = new DataSet ();
string sql = "select * from ClientFacilityorder by 
FacilityName";
this.CreateDBConnection ();
SqliteDataAdapter sda = new SqliteDataAdapter (sql, 
sconn);
sda.Fill (ds);
List objfcl=new 
List();
for(int i=0; i 
lst)
{
this.Items=lst;
}

public event EventHandler ValueChanged;

public List Items;
{
get
{
return this._items;
}
set
{
this._items=value;
}
}

List _items = new 
List();

public PickerFacilityTemplate SelectedItem 
{
get 
{ 
return this._items[this._selectedIndex]; 

} 
}
public int _selectedIndex = 0;

public override int GetRowsInComponent (UIPickerView picker, int
component) 
{
return this._items.Count;
}

public override string GetTitle (UIPickerView picker, int row, 
int
component) 
{
return items[row].FacilityName.ToString();

}
public override int GetComponentCount (UIPickerView picker) 
{
return 1;
}

public override void Selected(UIPickerView picker, int row, int 
component)
{
this._selectedIndex = row;
if (this.ValueChanged != null) 
{
this.ValueChanged (this, new EventArgs ());
}
}

}
}

Now in the class file of the screen where I have the pickerview, I have
written,

PickerDataModelSource _pickerSource;

And in the ViewDidLoad method,

this._pickerSource=new PickerDataModelSource(objdbh.FetchFacility())
this.Picker.Model=this._pickerSource;  [Picker being the name of my control]

But this approach is giving several errors. 
Please help me. I am confused.

Look forward to your reply.


--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Implementing-UIPickerView-with-data-from-Database-tp4655796p4655869.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] add tab bar to UIView

2012-07-10 Thread Vu Dang
Hi,

Is there a way to add a UITabBar to an UIView programmatically?  I would like 
to treat the UITabBarItems as a button rather than UIViewController?  I can use 
Xcode and added the UITabBar using xib UIdesign tool, but never get to work 
programmatically, the UITabBar is not showing after I add it to the 
UIView.subview.

for example:

// create item1
UITabBarItem item1 = UITabBarItem();
UITabBarItem item2 = UITabBarItem();

var tabs = new UITabBarItem[] {item1, item2};

// create UITabBar
UITabBar tabBar = new UITabBar();
tabBar.SetItems(tabs, true);

uiView.AddSubview(tabBar);

But tabBar didn't show.

Thanks,

smime.p7s
Description: S/MIME cryptographic signature
___
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch


[MonoTouch] FYI: AppStore approvals are now quoting %age completed in 8 business days

2012-07-10 Thread HairyJohn
Hi all,
Just a heads up as Ive had issues recently getting updates out in the
expected 5 business day window as was quoted previously by Apple, they are
now quoting 8 business days. So much for getting my updates approved for
this coming Friday then...

Cheers
Hairy

--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/FYI-AppStore-approvals-are-now-quoting-age-completed-in-8-business-days-tp4655883.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] OwnerDrawnElement vs. UIViewElement

2012-07-10 Thread Nic Wise
Yup, thats what I do: inherit off Element (or something a little further
down the stack) and add my own stuff into the view

yell for code. :)

On Tue, Jul 10, 2012 at 6:31 AM, Phil Cockfield  wrote:

> I just found this by Miguel:
>
>
> http://stackoverflow.com/questions/4028356/monotouch-dialogs-ownerdrawnelement-highlight-not-working
>
> The OwnerDrawnElement was a contribution from the community, and it is not
> as sophisticated as it should be. I would not depend on it for anything
> beyond the trivially basic.
>
> I strongly recommend that you create your own Element, if you want to
> reuse some of the code for OwnerDrawElement, you could copy and paste that.
>
>
> So perhaps I should be just deriving from *Element* and overriding *
> GetCell*.  Is that too low-level?
> What's the best practice here?
>
> Thanks!
>
>
>
> On Tue, Jul 10, 2012 at 2:27 PM, Phil Cockfield wrote:
>
>> When wanting to get in and totally control cell style rendering, is
>> there a preferred approach between these two options:
>>
>> - OwnerDrawnElement
>> - UIViewElement
>>
>> For [UIViewElement] the docs say : "Can we used to host a standard
>> UIView as an element, in this case no cell reuse will take place."
>>
>> That sounds bad.  What I'm not experienced enough to know.  What are
>> people preferring to do when they want to render custom stuff?
>> UIViewElement sounds easier.  Is it like doing a bargain with the
>> devil?
>>
>> Thanks.
>> --
>> Phil Cockfield
>>
>
>
>
> --
> *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/

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
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
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