Top Apps Coming to Windows Phone 8

One of the biggest complaints against Windows Phone 7 I have heard is that the top apps are missing and the ones that are on the platform too way to long to appear. It’s obviously been tough for Microsoft to get people to think of it as a day one requirement to support the platform but they now seem to be making progress. The Windows Phone Marketplace now has over 120.000 apps and Microsoft announcing new “top apps” coming to the platform. Earlier today Microsoft announced Pandora as a great new comer to the Windows Phone Store plus it comes with a 1-year of free music

Microsoft has also announced other big name apps apps and games that will be coming soon to the Marketplace. These include the brand new Angry Birds Star Wars, Temple Run, and Asphalt 7, Cut the Rope, Where’s my Water/Perry games.

Microsoft has also improved the Facebook and Twitter apps on Windows Phone to be able to take advantage of the “live apps” feature and show you updates on the new lock screen.

Personally I think this could be MS turning a corning. Supporting the standard game engines and making it easy to port apps and games between Xbox, Windows 8 and Windows Phone 8 will hopefully make it a first class platform for new apps to support.

Advertisement
Posted in Uncategorized | Leave a comment

Microsoft Surface

So the Microsoft Surface has launched with Windows 8 now and a lot of people have posted reviews of it. I have been in a Microsoft Store in Seattle all morning playing with one and looking at all the new touch screen all in ones and laptops and tablets and stuff that are there.

I can honestly say that I am very impressed with this move by Microsoft. I know a lot of people are dissecting the hardware and are comparing things based on the RAM and the disk space but I am impressed on a different level to that.

I think the Surface really represents a wholesale change in the way Microsoft is thinking about its technology. The device itself is fantastic to hold and use and the new Start screen begs to be touched. The screen is responsive and the software is fluid.

The fact that Microsoft has designed all the hardware from scratch and though about how people are going to use shows a total shift from the way they seemed to operate before. I think the build quality of the device and the beauty of the Windows 8 UI is really going to impress “normal people”. Microsoft has also attracted developers and there were plenty of business people running Windows XP Tablet Edition back in the day but it’s this shift to attracting the masses that will make a difference to the company .

Its getting people like my mother to use it and to have people talk about it and show it off to their friends. Not just the people who always talk about tech but people outside of the normal circles of chatting about it. I think the $1.5 billion they have supposedly spent on advertising should help accomplish this.

I think they really have brought out a winning platform here and people who get windows Surface, Windows 8 PCs and Windows Phone 8 devices will be really happy with them. They will talk about them and this will become a winning platform combination.

Let me know what you think about the platform

Posted in Uncategorized | Leave a comment

From comment spam to reCAPTCHA

So I have now added reCAPTCHA to the comment section of my blog. I apologize to people who have to take this extra step to post comments when they have something valid to say.

I made the decision to go this route this morning while going through 319 new comments and marking them all as spam.

Hopefully it would upset you especially when you know that you are actually contributing to something

Continue reading

Posted in Uncategorized | Tagged , | Leave a comment

Sorting for an ObservableCollection

I am porting my Live Countdown app to Windows 8 in order to help my learn Windows 8 and to spread the goodness to more people 🙂

However one problem I had was sorting an ObservableCollection without causing it to reset. I got round this issue by implementing the QuickSort algorithm as an extension method so I could do in place sorting on the collection.

Continue reading

Posted in Utility, windows8 | Tagged , , , | Leave a comment

Live Countdown for Windows Phone

I have released my latest app for Windows Phone. Its Live Countdown available from the Marketplace at http://windowsphone.com/s?appid=2c04be67-e60e-49dc-a40a-1a77d7471254

Here is the blurb from Marketplace:

The LIVE COUNTDOWN app gives you exactly that! Whatever event is happening in your life, whether it’s a new baby, your birthday, wedding, or your summer vacation, you can now have it counted down on your home screen. The number of days until your big day will be displayed on a LIVE TILE along with a picture of your choice to represent your day. Choose from an extensive catalogue of built in images, or choose you own from your image library or even take a new one especially for it. Don’t want money on “Due Date Counters” any more. Grab this amazing free app today and start looking forward to the great things this year

Posted in windows phone | Tagged , , , | Leave a comment

Creating a custom Windows Phone Live Tile

I’m writing a Windows Phone app and I want it to have Live Tiles. However I want it to show a Count on the front of the Live tile which is larger than 99. Currently any number larger than 99 shows 99 as the count. I wanted to show bigger numbers and therefore from what I can gather, I had to roll my own for this. I have done so by drawing my own Live Tile background image.

Drawing a custom image was pretty easy on Windows Mobile or on any other platform with GDI+ support. However in Windows Phone and Silverlight its a little harder. I found a  great tool called WriteableBitmapEx (http://writeablebitmapex.codeplex.com/). This great tool gives GDI+ style methods as extension methods on a Writeable Bitmap. I was then able to use this to draw the count like this:

// Define the filename for our tile. Take note that a tile image *must* be saved in /Shared/ShellContent
// or otherwise it won't display.
var tileImage = string.Format("/Shared/ShellContent/{0}.jpg", myUniqueTileId);

var source = new BitmapImage();
source.CreateOptions = BitmapCreateOptions.None;
var imageUri = new Uri(theEvent.ImagePath.Substring(1), UriKind.Relative);
System.Windows.Resources.StreamResourceInfo s = Application.GetResourceStream(imageUri);
source.SetSource(s.Stream);
bitmap = new WriteableBitmap(source);

//rectangle dimensions
int width = 50, left = 115, top = 10, height = 30, cornerRadius = 5, right = 10;

var fontFamily = new FontFamily("Segoe WP");
var fontForeground = new SolidColorBrush(Colors.White);

//Textblock to show the number
TextBlock tb = new TextBlock();
tb.Text = sleeps.ToString();
tb.Foreground = new SolidColorBrush(Colors.White);
tb.FontSize = 20;
tb.Foreground = fontForeground;
tb.FontFamily = fontFamily;
tb.Margin = new Thickness(12, 4, 12, 4);
tb.Measure(new Size(width - tb.Margin.Left - tb.Margin.Right, height - tb.Margin.Top - tb.Margin.Bottom));
tb.Width = tb.ActualWidth;
tb.Height = tb.ActualHeight;

Color rectColor = Colors.Black;

//workout where to put the black rectangle behind the number
width = (int)(tb.Width + tb.Margin.Left + tb.Margin.Right);
height = (int)(tb.Height + tb.Margin.Top + tb.Margin.Bottom);
left = 173 - (right + width);

//Draw the Rectangle
bitmap.FillRectangle(left + cornerRadius, top, left + width - cornerRadius, top + height + 1, rectColor);
bitmap.FillRectangle(left, top + cornerRadius, width + left + 1, top + height - cornerRadius, rectColor);

//Draw the rounded corners
bitmap.FillEllipse(left, top + height - (cornerRadius * 2), left + (cornerRadius * 2), top + height, rectColor);
bitmap.FillEllipse(left, top, left + (cornerRadius * 2), top + (cornerRadius * 2), rectColor);
bitmap.FillEllipse(left + width - (cornerRadius * 2), top, left + width, top + (cornerRadius * 2), rectColor);
bitmap.FillEllipse(left + width - (cornerRadius * 2), top + height - (cornerRadius * 2), left + width, top + height, rectColor);

//render the TextBlock over the top
bitmap.Render(tb, new TranslateTransform { X = left + (width / 2.0) - (tb.Width / 2), Y = top + (height / 2.0) - (tb.Height / 2) });

// Invalidate the bitmap to make it actually render.
bitmap.Invalidate();

// Create our bitmap, in our selected dimension.

if (store.FileExists(newPath)) store.DeleteFile(newPath);

// Create a stream to store our file in.
var stream = store.CreateFile(tileImage);

// Save it to our stream.
bitmap.WritePNG(stream);

stream.Flush();

// Close the stream, and by that saving the file to the ISF.
stream.Close();

This works pretty well for me. I have an Id for the thing the Live Tile relates to. If it was a weather app it could be the zip code or an Id for the town for example. This needs to be used to keep the tile images from being written over each other.

To use an IsolatedStorage file as a Live Tile it needs to be in the /Shared/ShellContent folder.

The Uri that you put as the background image for the tile needs to start isostore: so it ends up like:
isostore:/Shared/ShellContent/CustomImage1.png

This will then work as the tile image:

Live Tile Example

Posted in Uncategorized | Leave a comment

WriteableBitmap – Invalid Pointer from Constructor

I have had a really irritating issue with my windows phone app that I am currently working on. I am trying to create live tiles with numbers bigger than 99 shown for the Count property of the TileData.

To do this I have decided to draw my own images with the Count on them and then save them in Isolated Storage for the tile. There are many problems trying to get this done, but they all seem to stem from the fact that Windows Phone or Silverlight in general perhaps does all its image loading / rendering in a lazy or at least background fashion. The problem with this is loading an image and trying to do stuff straight away with it seems to sometimes mean the image isn’t loaded in time.

A common problem this causes and it certainly caused me was that from this code:

var source = new BitmapImage(new Uri(imagePath, UriKind.Relative));
bitmap = new WriteableBitmap(source);

I kept getting an Exception with the message “Invalid Pointer”. This irritating message seems to be that the Bitmap named ‘source’ hasn’t loaded the actual Bitmap data when the WriteableBitmap tries to use it.

The common suggestion was to set the CreateOptions on the Bitmap to None before you “use it”. However the actual fact is you have to set it before you set the source. In my code the source was being passed in as a Uri to the constructor. Therefore I figured I’d try setting the options first, then setting the Uri. However I still had the issue ONLY when doing the logic immediately on app startup. The actual solution that works is:

var source = new BitmapImage();
source.CreateOptions = BitmapCreateOptions.None;
var imageUri = new Uri(imagePath, UriKind.Relative);
System.Windows.Resources.StreamResourceInfo s = Application.GetResourceStream(imageUri);
source.SetSource(s.Stream);
bitmap = new WriteableBitmap(source);

Passing the stream is the ONLY thing that seems to work reliably.

That got me passed that little issue so I thought I’d post it here as most other places I found information it was for loading the image from Isolated Storage. I’ll post more info on that soon enough.

Posted in Uncategorized, windows phone | Tagged , , | 5 Comments

Starting Windows Phone development

I have recently started to make Windows Phone apps. I am doing this mainly as a learning exercise as I am interested in learning the technologies involved which I’m not really able to do during my day job. I am working on some real high end server applications for a client and therefore don’t have time to mess around learning GUI tech, we have real WPF developers for that.

The other reason I am doing this is because I have a windows phone and I love it. I’ll admit, there are times when I miss aspects of my old phone, no not an iPhone or Android, a Windows Mobile 6.5 device. Anyway, I love my phone and its great to see it gets great reviews in the press. However what I hate about it and the reason I think it suffers is that there aren’t enough good apps for it. It doesn’t have the market share for people to bother porting their successful iPhone apps and it won’t gain that market share without the top apps. Therefore as I see it, if I want good apps I need to write them myself to try to help seed the platform and help it grow.
The last reason is a lesser one but it is a factor. I work in a pretty cool company with pretty cool people. It encourages learning and self empowerment and my bosses recognize things like this as positives and I get kudos at work.
So along with the new metro design for this site you should expect to see a lot more windows phone content here

Posted in windows phone | Tagged | Leave a comment

Generating your app.config at runtime.

So I am working on a project at a client which is a server application and a component of other server applications. Its a complex data service which can be deployed as a component of other applications and can be hosted as a WCF service and called by remote clients. The application has a lot of configuration settings which we control in the app.config file. We have service locator settings, middle-ware settings, database settings, logging settings, etc etc.

This is a re-engineering of an old system which used to take all these settings on the command line, or when running as a windows service, through registry entries. In order to smooth the transition to this new system, we have enabled the software to continue to take these settings through the command line/registry settings in that it used to use. The way we do this is to use a base application configuration file, open it as an XML document and use XPaths to swap the overrides into the XML. We then write that XML out to a seperate file and repoint our App Domain to use that config file. The base application config file can even be passed as a command line argument.

This has been working for use since about last summer when we implemented it. We had one simple stumbling block along the way when somebody added a Log4Net call in application before the configuration swap has been completed. This is a problem as when log4net initialises it reads the configuration file. The problem with this is that .NET caches the application config file on first read. However, with the help of a great little tool called Reflector I found this little static cache and therefore was able to use reflection to wipe it out and reset the framework to think it hasn’t loaded it yet. With this little change in place, all was right with the world. Until this week.

This week another change was implemented thanks to some unknown obscure functionality required some a couple of people located in one small corner of one office in the world. We had to read one of our configuration overrides from a database, otherwise we weren’t going to get signed off for release. Therefore, without a choice, we had to use the config/override settings that we had for the database connection to connect the database and read this setting. We put this change in and tested it, it all seemed good. We then promoted our change to the QA environment and it was tested when used as a component of another application. That is when it started to throw an Exception. It was actually WCF which threw the Exception saying that there was no endpoint in the config file for the contract we wanted.

This exception puzzled us a lot, we could see that our config file was being generated properly, we could see that our application was able to read it properly, otherwise it wouldn’t have known to call a WCF service. It was even more confusing when the error didn’t happen on one of the machines. After a whole day of debugging a head scratching, we figured out that the .NET framework has a SECOND cache for configuration data. Not that actual configuration file, as when we asked for our sections from the System.Configuration.ConfigurationManager, we got the values we expected. The reason the single machine that did work worked, was because the Sybase database driver wasn’t installed properly and therefore the connection didn’t open.

The only solution I have come up with so far this week is the run the database connection code in a separate AppDomain. This obviously has prevented the caching on configuration in the primary AppDomain as static variables are per AppDomain. Once I have found this extra little cache I will let you all know where it is. Until then, if anyone else knows or has the same issue, let me know.

Posted in Uncategorized | Tagged , , , , | Leave a comment

Better Know A Framework: Getting the windows proxy settings

It’s a question I have seen a few times on the Microsoft forums: How do you get the default system proxy settings? Well, let me tell you the answer:

WebRequest.GetSystemWebProxy will return a proxy object with the default system proxy in it.

http://msdn.microsoft.com/en-us/library/system.net.webrequest.getsystemwebproxy.aspx

Using the DefaultWebProxy property on WebRequest you can get the proxy for the system unless it has been overridden in your app.config file. This is the best property to use so your app can be repointed to a different proxy. That property can also be set by your code to repoint your app

http://msdn.microsoft.com/en-us/library/system.net.webrequest.defaultwebproxy.aspx

So that’s the simplest way to get hold of the proxy settings for Windows apps.

Posted in Better Know a Framework | Tagged , , , | Leave a comment