If you are in the technology field, or within the listening range of modern media, you've heard of the Apple iPad. The fact that it runs an updated version of the Apple iPhone OS is a big plus if you are looking to do development on the platform. I've already received a bunch of emails about this, so I wanted to share what you can do to do develop on the platform right now.
First, make sure you mac is running Mac OS 10.6.2. Next, go get the Apple iPhone SDK 3.2 from the apple developer site. This is beta, so expect updates to it. Now, go get MonoDevelop Version 2.2.1 for the Mac. Finally, go get a copy of MonoTouch 1.4.7 (or most recent version). Once everything is installed, go into MonoDevelop and go to Help -> Updates and check for updates on the experimental channel. You should find MonoTouch 1.9 alpha. Download and install it. Now, you should have everything you need. From here, you can create an iPhone application with .NET. This is the same as it is with the shipping versions. If you look at creating a new solution, you can create an iPad Solution. Starting and debugging an application brings up the iPad simulator. Very nice indeed.
http://www.red-gate.com/products/ants_performance_profiler/care_about_performance_ebook.htm
My buddy Paul Glavich has written a book on how to optimize performance in an .NET application. Well done Paul!!!!!!!!
In this complete guide to performance profiling, Paul Glavich and Chris
Farrell explain why performance testing is a good idea and walk you through
everything you need to know to set up a test environment. This comprehensive
guide to getting started is an essential handbook to any programmer looking to
set up a .NET testing environment and get the best results out of it. Download
your free copy now.
If you didn't know it, the iPhone has two twenty second rules that developers need to pay attention to:
The iPhone has a startup timer. If an application takes longer than 20 seconds to start up, it is killed by the iPhone OS.
The iPhone OS will kill any application that is unresponsive for longer than 20 seconds. To work around this, you will need to perform some type of asynchronous operation.
The lesson learned on this is that asynchronous processing is a good thing to learn and understand.
Want to know more about developing with the iPhone? Check out my Wrox Blox eBook on developing applications with MonoTouch for the iPhone/iPod touch for .NET/C# developers .
I bought this book a few weeks ago. I've been reading it and trying to absorb the features in the iPhone's version of Safari. I'm impressed. This book contains a huge amount of information about Safari on the iPhone. So, why is this important when you can have apps on the iPhone? Have you tried to get an app onto the iPhone? Its not an immediate process by any stretch of the imagination. With a web application, you can deploy applications immediately to the iPhone without having to go through Apple's AppStore process. Its a great read and is very educational.
There are times when the user needs to be presented with some information or question. MonoTouch has a UIAlertView object. The UIAlertView is instantiated with a set of parameters. On the object instance, the .Show() method is called. For .NET developers, this is similar in concept to the .NET MessageBox. For JavaScript developers, this is similar to the window.alert() and window.confirm() methods.
var av = new UIAlertView("Badness happened",
"The scheme '" + prot + "' is not supported on this device.",
null,
"Ok thanks", null);
av.Show();
Want to know more about developing with the iPhone? Check out my Wrox Blox eBook on developing applications with MonoTouch for the iPhone/iPod touch for .NET/C# developers .
The NSUrl class is what allows an application to open other applications within the iPhone OS while passing parameters. The calling sequence is fairly simple. There are two steps to making this call: 1. When the NSUrl class is instantiated, a string representing the URL scheme is called. Note that different applications will have different schemes and use different protocols. 2. The static method UIApplication.SharedApplication.OpenUrl(ns) is called, where ns is the NSUrl class. When the static method is called, if it is not possible to open a URL, a false is returned. If it is possible to open the URL that is passed, the URL is opened and a true is returned.
Some code to do this looks like:
NSUrl ns = new NSUrl(prot + first + sec.Trim());
if (!UIApplication.SharedApplication.OpenUrl(ns))
{
var av = new UIAlertView("Badness happened"
, "The scheme '" + prot + "' is not supported on this device.",
null, "Ok thanks", null);
av.Show();
}
Ok, this all sounds cool, now lets look at the format of the url schemes that you can pass into NSUrl. For a list of them, check out: http://wiki.akosma.com/IPhone_URL_Schemes
Want to know more about developing with the iPhone? Check out my Wrox Blox eBook on developing applications with MonoTouch for the iPhone/iPod touch for .NET/C# developers .
The UIPicker is visually different than the drop down listbox that most .NET developers are familiar, however, it is designed to perform the same type of function. It allows users to select from a fixed set of data isntead of typing in data in a text box. Programming with it is fairly simple. Inherit from the UIPickerViewModel class and then bind the data.
Here's the class:
using System;
using MonoTouch;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
namespace OpenUrl
{
public class ProtocolData : UIPickerViewModel
{
public static string[] protocols = new string[]
{
"http://", "tel:","http://maps.google.com/maps?q=", "sms:",
"mailto:"
};
public string[] protocolNames = new string[]
{
"Web", "Phone Call", "Google Maps", "SMS", "Email"
};
AppDelegate ad;
public ProtocolData(AppDelegate pad){
ad = pad;
}
public override int GetComponentCount(UIPickerView uipv)
{
return(1);
}
public override int GetRowsInComponent( UIPickerView uipv, int comp)
{
//each component has its own count.
int rows = protocols.Length;
return(rows);
}
public override string GetTitle(UIPickerView uipv, int row, int comp)
{
//each component would get its own title.
string output = protocolNames[row];
return(output);
}
public override void Selected(UIPickerView uipv, int row, int comp)
{
ad.SelectedRow = row;
}
public override float GetComponentWidth(UIPickerView uipv, int comp){
return(300f);
}
public override float GetRowHeight(UIPickerView uipv, int comp){
return(40f);
}
}
}
And then you bind data doing something like this:
ProtocolData protocolDataSource = new ProtocolData(this);
ProtocolSelection.Model = protocolDataSource;
And there you go, you now have a UIPicker with a list of data. Want to know more about developing with the iPhone? Check out my Wrox Blox eBook on developing applications with MonoTouch for the iPhone/iPod touch for .NET/C# developers .
Honestly, I thought that it was really cool when the Novell guys put a soft debugger into Mono/MonoTouch so that it is possible to debug an application running on the iPhone Simulator or on the actual device. Basically, its a set of code inside of MonoTouch that will talk back to the debugging device. According to the document, it works in the simulator, an iPhone attached to your macintosh, or over wifi if you are ont eh same network. Thanks guys!
Want to know more about developing with the iPhone? Check out my Wrox Blox eBook on developing applications with MonoTouch for the iPhone/iPod touch for .NET/C# developers .
I wrote the following code to put a point on a map on the iPhone. It works pretty well. Basically, I draw a map, then I inherit from the MKAnnotation object and create a new constructor, go out to geocoder and get a lat lon to senter the map on, and finally, I put a point in the center of the map. I've got to thank Craig Dunn for the inspiration of inheriting from the MKAnnotation object.
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.MapKit;
using MonoTouch.CoreLocation;
namespace Json
{
public class Application
{
static void Main (string[] args)
{
UIApplication.Main (args);
}
}
// The name AppDelegate is referenced in the MainWindow.xib file.
public partial class AppDelegate : UIApplicationDelegate
{
// This method is invoked when the application has loaded its
// UI and is ready to run
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// If you have defined a view, add it here:
// window.AddSubview (navigationController.View);
window.MakeKeyAndVisible ();
MapVw.ZoomEnabled = true;
MapVw.UserInteractionEnabled = true;
MapVw.ScrollEnabled = true;
MapVw.ShowsUserLocation = true;
btnMap.TouchDown += BtnMapTouchDown;
LocationTF.EditingDidEnd += delegate(object sender, EventArgs e) {
UITextField utf = sender as UITextField;
Console.WriteLine("EditingDidEnd is finished.");
utf.ResignFirstResponder();
};
LocationTF.Ended += delegate(object sender, EventArgs e) {
};
LocationTF.EditingDidEndOnExit += delegate(object sender, EventArgs
e) {
};
return true;
}
void BtnMapTouchDown (object sender, EventArgs e)
{
GeoCode gCode = new GeoCode();
string location = LocationTF.Text;
double lat = 0.0, lon = 0.0, radius = 0.0;
Location.ResignFirstResponder();
gCode.GetLatLon(location, ref lat, ref lon, ref radius);
Console.WriteLine("Lat: " + lat.ToString() + " Lon: " + lon.ToString());
MapVw.Region = new MKCoordinateRegion(new CLLocationCoordinate2D(lat, lon),
new MKCoordinateSpan(.5, .5));
MapVw.ZoomEnabled = true;
MapVw.UserInteractionEnabled = true;
MapVw.ScrollEnabled = true;
btnMap.TouchDown += BtnMapTouchDown;
gCode = null;
}
// This method is required in iPhoneOS 3.0
public override void OnActivated (UIApplication application)
{
}
}
}
The MKAnnotuation object is inherited like this:
using System;
using MonoTouch.UIKit;
using MonoTouch.MapKit;
using MonoTouch.CoreLocation;
namespace Json
{
// concept borrowed from Craig Dunn’s blog.
public class ObjAnnotation : MKAnnotation {
private CLLocationCoordinate2D _coordinate;
private string _title, _subtitle;
//getters must be overridden to return necessary data.
public override CLLocationCoordinate2D Coordinate {
get { return _coordinate; }
}
//title and subtitle are readonly, thus no setter.
public override string Title {
get { return _title; }
}
public override string Subtitle {
get { return _subtitle; }
}
/// <summary>
/// Need this constructor to set the fields, since the public
/// interface of this class is all READ-ONLY
/// <summary>
public ObjAnnotation (CLLocationCoordinate2D Coordinate,
string Title, string SubTitle) : base()
{
_coordinate=Coordinate;
_title=Title;
_subtitle=SubTitle;
}
}
}
The result is this:
Want to know more about developing with the iPhone? Check out my Wrox Blox eBook on developing applications with MonoTouch for the iPhone/iPod touch for .NET/C# developers .
I've worked up the following talks for 2010.
If you are interested, get ahold of me. Contacting me through this blog, LinkedIn , and Twitter are the best.
iPhone Development for .NET/C# Developers.
The iPhone is the smartphone leader in mindshare and the amount of money spent on applications. This lead in money spent on applications is expected to grow over the next several years. Objective-C is the native language for iPhone development. .NET developers, who work in the largest general area of development frameworks, have looked at iPhone developers with a great deal of envy. But with the release of MonoTouch, .NET/C# developers can apply their knowledge to iPhone development. This talk with show .NET developers how they can write applictions that run natively on the iPhone. In this talk, the attendee will be able to immediately being writing and exploring code on the .NET
Intro to Windows Azure.
Windows Azure is Microsoft's entry into the cloud computing marketplace. We'll look at getting an application up and running with azure, data storage in azure, exposing web services over azure, and finally an overview of a running application in Azure. Attendees will be able to start writing applications for Windows Azure immediately after attending the session.
Introduction to ASP.NET 4 AJAX Client Templates
With the initial release of ASP.NET AJAX, Microsoft released an AJAX solution that allows developers to call from the web browser back to the server and retrieve data. With ASP.NET 4 Microsoft will provide an improved set of features including an easy and simple way to beind data, use client templates to easy bind data to on the client, provide client side events that can be processed, and an improved set of client side controls. Attendees will be able to immediately able to use the the features of ASP.NET 4 AJAX in their applications after attending this session.
Introduction to the ASP.NET AJAX UpdatePanel
This session is a deep dive into the ASP.NET AJAX UpdatePanel. The UpdatePanel provides for a mechanism to add client side Ajax capabilities through a server side control. We'll look at: Quick Intro to the UpdatePanel. How to debug with it. The UpdatePanel provides client side Ajax functionality. We'll look at how to debug with it and see that the UpdatePanel allows for the server side debugging functionality that mostdevelopers are used to. Its client side programmability features. The UpdatePanel provides a client side interface into its features. We'll look at the events provided and how they allow developers to add to their applications to improve the user experience. Error Handling. By default, errors are generated as JavaScript alerts, we'll look at the options for handling errors so that user's aren't forced into the annoying JavaScript alert popup. The data format that the UpdatePanel uses. When does AJAX not use XML or JSON for data transfer? When it the UpdatePanel is used. We'll look at the Update Panel's data transfer format. History with the UpdatePanel. One of the most frustrating things from a user's standpoint is that hitting back on Ajax application takes them out of the application. We'll look at what a developer must do so that a user hitting back does not exit from the application, but merely goes back to the previous state of the application.
Introduction to ASP.NET AJAX
With the introduction of ASP.NET AJAX, Microsoft has release support for AJAX applications using their stack of products. We'll look at: • What is AJAX. • The Script Manager and options on adding web services and client side scripts. • Javascript Intellisense increase developer productivity by providing a set of hints regarding the methods that may be called as well as how to add this functionality to scripts that the developer authorizes themself. • How to call a Web Service and process the result. • How to debug. • The UpdatePanel. • Integration with ASP.NET Services (Membership, Roles, and Profiles).
Opening a Windows Azure application with Web Services and then consuming these services in Silverlight - This is a two person talk with Wally McClure and David Silverlight.
We'll look at opening up a Windows Azure application through a set of web services for third parties to develop clients that interface with your application. Items discussed include: Windows Azure in general. Why you want to open your application. The mechanics of opening an applications. Some of the choices that I ran into with regards to the web services. Then we will switch and open up a silverlight application that interfaces with this application. In it, we'll look at the challenges of using web services for a third party within a silverlight application.
More Posts
Next page »