Some time earlier I wrote about
developing sudoku for Windows Phone . According to some users on Windows Phone 7.1 is not so little to neglect them. Also, the article will consider the moment of publication in the updated Windows Phone store.

')
According to the statistics of the already running application for the last month:

It is seen that the 7th version takes 30% of the total number of installations. The idea is to develop an application for learning that will be available for the 7.1+ version.
It was decided to make a game of points.
You start the game from one point. At each level, choose a new point. If you choose the old point - lose.
Statistics received for the day of the application developed and uploaded to the store:

Development
It is important to note that the development of applications for Windows Phone 7 occurs exclusively in Visual Studio
2012 . Layout layouts in Blend 2012. When you open a project in Studio version 13, the project is forcedly converted into a new version and there is no possibility to publish the application for old versions.
There are 3 screens in the game: Starting (aka the screen between levels), level screen and end game screen. In this application, unlike Sudoku added player rating (number of points). Rating is implemented as an API (without any serious protection). In addition, I want to compete in the office - I also want to know who is stronger in the world. It is clear that the camera decides, but without it more interesting. True!
Async
Windows Phone 7 does not have native support for async await. Also, there are some controls that simplify development. Here is my list of used packages from nuget.
Packages List<packages> <package id="Coding4Fun.Toolkit.Controls" version="2.0.7" targetFramework="wp71" /> <package id="GoogleAnalyticsSDK" version="1.2.01" targetFramework="wp71" /> <package id="Microsoft.Bcl" version="1.1.7" targetFramework="wp71" /> <package id="Microsoft.Bcl.Async" version="1.0.16" targetFramework="wp71" /> <package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="wp71" /> <package id="Microsoft.Net.Http" version="2.1.10" targetFramework="wp71" /> <package id="Newtonsoft.Json" version="5.0.7" targetFramework="wp71" /> <package id="WPtoolkit" version="4.2013.08.16" targetFramework="wp71" /> </packages>
To interact with the API, a generic class (httpclient) was developed that migrates from project to project. Approximate class code is presented below.
Http Client (async await) using (HttpClientHandler handler = new HttpClientHandler()) { using (HttpClient httpClient = new HttpClient(handler)) { using (HttpRequestMessage message = new HttpRequestMessage()) { message.RequestUri = new Uri(url); message.Method = postData == null ? HttpMethod.Get : HttpMethod.Post; if (postData != null) { message.Content = new StringContent(JsonConvert.SerializeObject(postData)); message.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } HttpResponseMessage response = await httpClient.SendAsync(message).ConfigureAwait(false); string data = await response.Content.ReadAsStringAsync(); return data; } } }
Drawing points occurs in the
Canvas
object. Each point is a
Button
with style. The generation of dots and colors is absolutely random (sometimes 4-5 dots of one color are very close, you have to navigate the relative positions of each other. The generation code is shown below. In addition, the intersections of the points are taken into account. The generation occurs until such a place is found where there will be no intersection with other points (or the cycle will end, then it will be in a random place)
Point generation DotInfo dot = new DotInfo(); dot.Color = Colors[Rand.Next(Colors.Count)]; int testX = 0, testY = 0; bool testOk = true; for (int i = 0; i < 10000; i++) { testX = Rand.Next(Width - ButtonSize); testY = Rand.Next(Heigth - ButtonSize); testOk = true; foreach (DotInfo dotInfo in _dots) { Rectangle intersect = Rectangle.Intersect(new Rectangle(dotInfo.X, dotInfo.Y, ButtonSize, ButtonSize), new Rectangle(testX, testY, ButtonSize, ButtonSize)); if (intersect != Rectangle.Empty) testOk = false; } if (testOk) { dot.X = testX; dot.Y = testY; break; } } if (!testOk) { dot.X = Rand.Next(Width - ButtonSize); dot.Y = Rand.Next(Heigth - ButtonSize); }
The player's name is requested by the control from the publisher Coding4Fun. By the way, very interesting controls, I advise you to look. (
Coding4Fun Toolkit )
Input dialog InputPrompt input = new InputPrompt(); input.Completed += UserNameInputOK; input.Title = " "; input.Value = UserSettings.Value.UserName; if (string.IsNullOrEmpty(input.Value)) input.Value = " " + randName.Next(Int32.MaxValue / 2); input.Show();
Interaction with user settings and stored data was implemented on the recommendation of Nokia’s “Introduction and best practices for IsolatedStorageSettings”. The solution turned out to be interesting and very convenient.
http://developer.nokia.com/community/wiki/Introduction_and_best_practices_for_IsolatedStorageSettingsPublish to the updated store
Almost immediately after the Build conference, the application store was updated (both on the client part and for developers)

An item about changes in the new version was added (so as not to change the description of the application itself) and not litter it.

Added reservation for the name of the application for Windows Phone applications (in the appendage in the Windows Store)

Applications that use the same name for both platforms have an icon:

In total, it took 20 hours to write this application + a small server part. It is worth noting that the publication of the application in the store has become cosmically fast (only 30 minutes). Received additional errors when integrating async-await into a Windows Phone 7.5 application. Fell a strange error FileNotFound. I think it was decided by a recent update of the Microsoft BCL libraries.
PS My record is 24 points, and you? (you can add Habr in the name to find out from whom the memory is better in Habré)

I would welcome comments, suggestions and good estimates in the store.
