Monday, June 30, 2008

image And there you have it: 30 .NET Windows Mobile Applications in 30 Days!

I really liked yesterday’s application, Community Megaphone Reader. I think it was because it was a Windows Mobile mashup application. And we can look forward to many more of these types of applications to come our way.

 

image

Trippr

You’ve probably already figured out what this application does. That’s right it takes your current GPS position and pulls back pictures that are geotagged for the area you are in. So while you are riding down the road you can flickrscan for photos taken near you, possibly as close as the block you are on.

Really cool idea I think. I’ll probably hook this up to the dashboard of my car and just let it run while I drive around. It should be lots of fun to just see what I see.

The UI is basic sterile white, but I wanted the photos to be the star of the show so I went with the one uber true neutral color.

Control are very simple: Update, Menu, GPS, GPS Start, GPS Stop, About, and Exit. Update is the main feature. Any time it is pressed new photos are downloaded.

Again for this project we looked to the GPS Intermediate Driver Reference, it has served us well these 30 days and I really highly recommend it. If you need to do a Windows Mobile GPS application use this and you are almost done.

Another great API I found is the Flickr.Net API. If you need to connect to Flickr in .NET or .NET Compact Framework this is great. It does all the heavy lifting for you! I was up and running in minutes!

“The Flickr.Net API is a .Net Library for accessing the Flickr API. Written entirely in C# it can be accessed from with any .Net language in .Net Framework 1.1, .Net Framework 2.0, .Net Compact Framework 2.0 and Mono.”

Update Method

   1: if (gpsPosition == null || !gpsPosition.LatitudeValid || !gpsPosition.LongitudeValid)
   2:      return;
   3:  
   4:  double minimumLongitude = gpsPosition.Longitude - 1;
   5:  double minimumLatitude = gpsPosition.Latitude - 1;
   6:  double maximumLongitude = gpsPosition.Longitude + 1;
   7:  double maximumLatitude = gpsPosition.Latitude + 1;
   8:  
   9:  string apikey = "get_your_own_flickr_key";
  10:  Flickr flickr = new Flickr(apikey);
  11:  
  12:  PhotoSearchOptions options = new PhotoSearchOptions();
  13:  options.BoundaryBox = new BoundaryBox(minimumLongitude, minimumLatitude, maximumLongitude, maximumLatitude);
  14:  options.Extras |= PhotoSearchExtras.Geo;
  15:  options.PerPage = 10;
  16:  options.SortOrder = PhotoSearchSortOrder.InterestingnessAsc;
  17:  
  18:  Photos photos = flickr.PhotosSearch(options); 
  19:  StringBuilder stringBuilder = new StringBuilder();
  20:  
  21:  foreach(Photo photo in photos.PhotoCollection)
  22:      stringBuilder.AppendFormat(@"<img src=""{0}"" style=""border: 1px black solid; padding: 0px; margin: 1px"" />", photo.ThumbnailUrl);
  23:  
  24:  webBrowser.DocumentText = stringBuilder.ToString();

Possibilities:

Obviously this needs an auto-update feature and settings for those of use who will use it on the road. If I click on a picture I’d love to see a larger view of it as well. and a details listing telling me more about the photo would be great.

Download executable: trippr.cab

Download Source Code: trippr.zip

Thank You:

I appreciate everyone’s encouragement and feedback. This project would not have been a success without all of you. Keep an out there’s more to come in the future. Wink


Monday, June 30, 2008 22:24:00 (Eastern Standard Time, UTC-05:00)  #    Comments [0]  |  Trackback

imageWe only have one more day left in our 30 days of .NET [Windows Mobile Applications]. Where do we go from here?

I’m really happy with the 30 Days of .NET so I do think I will continue that in one format or another for some time. It’s been a blast. And everyone knows my passion for Windows Mobile programming so we keep finding way to work that in there as well.

I haven’t quite decided what I’ll do for next month but I’m sure it’ll only get better as we move forward.

There have been a lot of request for applications that haven’t made it on deck yet, and obviously they aren’t all going to get done tomorrow. But I think I’ll be able to throw in some Bonus Day of .NET or Return of Day of .NET and knock some of them out over time.

My goal is to take all the existing content and clean it up some and make more through and detailed learning materials to really help beginners take off with Windows Mobile.

Hope you’ll join me on the road ahead…


Monday, June 30, 2008 01:10:00 (Eastern Standard Time, UTC-05:00)  #    Comments [1]  |  Trackback

Wow, it’s hard to believe the month is almost over already. So far we have 29 applications done in 29 days! Thank you for all your encouragement.

If you missed the week one recap here it is: 30 Days of .NET [Windows Mobile Applications] - Week One.

If you missed the week two recap here it is: 30 Days of .NET [Windows Mobile Applications] - Week Two.

If you missed the week three recap here it is: 30 Days of .NET [Windows Mobile Applications] - Week Three.

What’s your favorite?

image image  image image
GPS Clock MobileInfo Mobile Flashlight SmartDial

Let see we have a time utility, and device information, call blocker, and lots more!

image image image image_thumb15[4]
GeoCash Repeatr CallBlocker What will be next?

Feedback:

Got an idea? Got some feedback? Share it? Thanks!


Monday, June 30, 2008 00:06:00 (Eastern Standard Time, UTC-05:00)  #    Comments [1]  |  Trackback

Only One Day Left…

Not too long ago Page Brooks and myself made the three and a half hour drive from Florence, SC to Greensboro, NC to attend the Ineta Carolina Community Leadership Summit '08. This was a great event and there we meet a lot of the local Ineta user group leaders. We also meet Andrew Duthie, aka DEvHammer. One issue that rose to the top of things we wanted to work on improving at the leadership summit was awareness of events that are occurring in the local regional area. That’s when Andrew told everyone about the project he has been working on: Community Megaphone.

I love have information at my fingertips, so I decided to write a tie-in application:

image

image

Community Megaphone Reader

Basically, this application connects to the Community Megaphone RSS feed and pulls down event data. Then it takes your current GPS position and calculates your distance from each event. Finally, it takes all the events and sorts then so you can find the event that is the closest to you. This is a great application for the traveling .NET geek. Where ever you are you can find great .NET events to attend.

The UI is paying homage to Andrew’s Community Megaphone site. I tried to match the basic colors to keep it familiar. The hyperlinks are active and will take you the event’s page on Community Megaphone. The menu only has a few options: Refresh, About, and Exit.

An application like this is really exciting, because it is tying the world of mobile together with the world wide web.

These types of mashup applications will contitue to take of for years.

LoadRss Method

   1: public static DataSet LoadRss(string requestUriString)
   2: {
   3:     HttpWebRequest feed = HttpWebRequest.Create(requestUriString) as HttpWebRequest;
   4:     StreamReader streamReader = new StreamReader(feed.GetResponse().GetResponseStream());
   5:  
   6:     string rssXml = streamReader.ReadToEnd();
   7:     rssXml = rssXml.Replace(@"<?xml version=""1.0"" encoding=""utf-8""?>", string.Empty);
   8:  
   9:     StringReader stringReader = new StringReader(rssXml);
  10:  
  11:     DataSet dataSet = new DataSet();
  12:     dataSet.ReadXml(stringReader);
  13:  
  14:     return dataSet;
  15: }

 

GetEvents Method

   1: public static List<Item> GetEvents(DataSet dataSet, GpsPosition gpsPosition)
   2: {
   3:     List<Item> items = new List<Item>();
   4:  
   5:     foreach (DataRow dataRow in dataSet.Tables["item"].Rows)
   6:     {
   7:         Item item = new Item();
   8:         item.Title = (string)dataRow["title"];
   9:         item.Description = (string)dataRow["description"];
  10:         item.Link = (string)dataRow["link"];
  11:         item.PublishDate = DateTime.Parse((string)dataRow["pubDate"]);
  12:         item.Latitude = Double.Parse((string)dataRow["lat"]);
  13:         item.Longitude = Double.Parse((string)dataRow["long"]);
  14:  
  15:         if(gpsPosition.LatitudeValid && gpsPosition.LongitudeValid)
  16:             item.Distance = GeoCodeCalc.CalcDistance(gpsPosition.Latitude, gpsPosition.Longitude, item.Latitude, item.Longitude);
  17:  
  18:         items.Add(item);
  19:     }
  20:  
  21:     items.Sort(delegate(Item item1, Item item2)
  22:     {
  23:         return item1.Distance.CompareTo(item2.Distance);
  24:     });
  25:  
  26:     return items;
  27: }

Display Events Method

   1: public static string DisplayEvents(List<Item> events)
   2: {
   3:     StringBuilder stringBuilder = new StringBuilder();
   4:  
   5:     foreach (Item item in events)
   6:     {
   7:         stringBuilder.Append(@"<span style=""color: #FFFFFF;font-weight:bold;"">");
   8:         stringBuilder.AppendFormat(@"<a href=""{0}"" style=""color: #DBB94F;"">{1}</a><br/><br/>", item.Link, item.Title);
   9:         stringBuilder.AppendFormat(@"{0}<br/><br/>", item.Description);
  10:         stringBuilder.AppendFormat(@"<b>Distance: <span style=""color: #DBB94F;"">{0} miles</span></b><br/>", item.Distance.ToString("0.00"));
  11:         // stringBuilder.AppendFormat(@"<b>{0}</b><br/>", item.PublishDate);
  12:         // stringBuilder.AppendFormat(@"{0}<br/>", item.Latitude);
  13:         // stringBuilder.AppendFormat(@"{0}<br/>", item.Longitude);
  14:         stringBuilder.AppendFormat(@"<br/><br/>");
  15:         stringBuilder.Append(@"</span>");
  16:     }
  17:  
  18:     return stringBuilder.ToString();
  19: }

Possibilities:

Andrew recently added iCalendar file support to Community Megaphone. This would be a great feature to add to a Windows Mobile application, and it is totally doable. The HTML could be a little more fancy maybe even use a few 16x16 fonts for a little personality.

Download executable: communityMegaphoneReader.cab

Download Source Code: communityMegaphoneReader.zip

Feedback:

Want more? What else would you like to see? Time’s running out only one more day. Be sure to get your ideas in soon!


Sunday, June 29, 2008 23:31:00 (Eastern Standard Time, UTC-05:00)  #    Comments [0]  |  Trackback
Saturday, June 28, 2008

Only 2 Days Left…

Today’s application is CallBlock. It is designed to watch incoming calls, and check and see if they match any on the block phone numbers list. If they do match then the phone is “blocked”.

 

image

CallBlock

The first thing you should notice is the flashy logo at the top of the form. I create this logo with an online 3D logo generator. The one simple touch adds a lot of professional polish to the application. I really like red and white so I didn’t change the background color this time. But I am starting to wish I had. It seems a little “blah” to me now.

Next we have our phone number input text box. The user enters the phone number here, and presses the Block menu item to add it to the block number list below. On the main menu we also have options to Unblock, and Unblock All. And we have our almost universal About and Exit menu items.

There are two main pieces to this application. One part is the State and Notification Broker code to give us an event to catch incoming phone calls.

I actually got myself painted into a corner, I assumed you could just programmatically ignore of phone call but it isn’t that simple. Fortunately, a good friend of mine, Lou Vega, came up with a very slick workaround for this. And that is the second part which is the keybd_event method that allows us to send keypresses to the OS to Ignore the phone call.

CallBlock Core Code

   1: const int KEYEVENTF_KEYDOWN = 0x0;
   2: const int KEYEVENTF_KEYUP = 0x2;
   3:  
   4: [DllImport("coredll.dll", EntryPoint = "keybd_event", SetLastError = true)]
   5: internal static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
   6:  
   7: SystemState phoneIncomingCall = new SystemState(SystemProperty.PhoneIncomingCall);
   8: private void frmMain_Load(object sender, EventArgs e)
   9: {
  10:     phoneIncomingCall.Changed += new ChangeEventHandler(phoneIncomingCall_Changed);
  11: }
  12:  
  13: void phoneIncomingCall_Changed(object sender, ChangeEventArgs args)
  14: {
  15:     string phoneNumber = RemoveText(SystemState.PhoneIncomingCallerNumber);
  16:  
  17:     if(listBoxBlockedNumbers.Items.Contains(phoneNumber))
  18:     {
  19:         keybd_event(115, 0, KEYEVENTF_KEYDOWN, 0);
  20:         keybd_event(115, 0, KEYEVENTF_KEYUP, 0);
  21:     }
  22: }

 

Possibilities:

It would be easy to add support for blocking SMS text messages as well. We’ve done all the code for this already in previous applications. Also the application could really use a persistent data store to remember number to block in case the user closes the application. It would be nice to allow user formatting of entered phone numbers for increased readability.

Download executable: callBlock.cab

Download Source Code: callBlock.zip

Feedback:

Want more? What else would you like to see? Time’s running out on submitting ideas. Be sure to get yours in soon!


Saturday, June 28, 2008 16:07:00 (Eastern Standard Time, UTC-05:00)  #    Comments [2]  |  Trackback

So Page Brooks was talking with me earlier this week and he had a great idea for another Windows Mobile application. He wants an application that will repeat alerts for missed phones and text messages. I have to admit this is something I could use myself. So I figured I take a crack at it today, since it would make for a fun, simple, Friday app.

 

image

Repeatr

I decided to change up the naming format and play of the popular Web 2.0 naming conventions giving us the name: Repeatr. I have to admit, it is kind of catchy.

I searched for “Web 2.0 Logo Creator” and pretty much went with the first one I saw. This gave me a pretty slick logo in less than 5 minutes. I also decided to make the background a “tooltip” yellow, which I think looks really good.

Other than that everything is rather straight forward. We have checkboxes allowing the user to choose what events we will monitor. And we have a menu with a couple options, namely About and Exit. There is a “Clear Alerts” menu item, as well, that allows users to acknowledge they have responded to the alert(s).

The application allows user to select the number of minutes between alerts up to 60 minutes.

Of course we are using the State and Notification Broker to make all this happen. Using it means we hardly have to write any code ourselves!

State and Notification Broker setup code

   1: SystemState phoneMissedCalls = new SystemState(SystemProperty.PhoneMissedCalls);
   2: SystemState messagingSmsUnread = new SystemState(SystemProperty.MessagingSmsUnread);
   3: SystemState messagingTotalEmailUnread = new SystemState(SystemProperty.MessagingTotalEmailUnread);
   4: SystemState messagingVoiceMailTotalUnread = new SystemState(SystemProperty.MessagingVoiceMailTotalUnread);
   5:  
   6: private void frmMain_Load(object sender, EventArgs e)
   7: {
   8:     phoneMissedCalls.Changed += new ChangeEventHandler(phoneMissedCalls_Changed);
   9:     messagingSmsUnread.Changed += new ChangeEventHandler(messagingSmsUnread_Changed);
  10:     messagingTotalEmailUnread.Changed += new ChangeEventHandler(messagingTotalEmailUnread_Changed);
  11:     messagingVoiceMailTotalUnread.Changed += new ChangeEventHandler(messagingVoiceMailTotalUnread_Changed);
  12: }

 

The way we alert a user to having missed a monitored event is by playing a sounds which is easy to do.

   1: [DllImport("aygshell.dll")]
   2: static extern uint SndPlaySync(string pszSoundFile, uint dwFlags);
   3:  
   4: void PlaySound()
   5: {
   6:     string path;
   7:     path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
   8:  
   9:     SndPlaySync(Path.Combine(path, "alert.wma"), 0);
  10: }

Other than a little plumbing to make everything work together that is basically the entire app in a nutshell.

Possibilities:

This is a pretty spiffy application. But software can always be better. An option to allow the phone to vibrate would be great. Another option to allow the user to select the alert sound would be nice too.

Download executable: repeatr.cab

Download Source Code: repeatr.zip

Feedback:

Want more? What else would you like to see? Time’s running out on submitting ideas. Be sure to get yours in soon!


Saturday, June 28, 2008 02:30:00 (Eastern Standard Time, UTC-05:00)  #    Comments [0]  |  Trackback
Friday, June 27, 2008

4 Days left…

Today on twitter, Glen Gordon was telling me that Brendon Schwartz had an idea for today’s application: