ImaginationOverflow

The knowings and experiences of a group of developers.

Category Archives: .NET

Introducing Thomson Wifi Passwords

This past two weeks I’ve taken a little vacation from my pet project (Metro Scrobbler) and started an update for the most successful app that ImaginationOverflow has (until this day), Thomon Router Passwords  now renamed to Thomson Wifi Passwords.

The app now looks like a Windows Phone app, with a clean, simple and intuitive metro design.
Thomson Wifi Passwords allows you to generate the thomson routers default passwords, very useful when you are in nearby one of this routers, they are spread across the globe and have a bunch of different ssids templates out there.

The usage is quite simple, just insert the last 6 characters from the ssid, pick a mode and wait a little, while the app makes its magic. This last version added the online mode that enables users that have cellular data plans to use a little of it to get the password much quicker.

The app has two versions:

The paid version only exists to support the running costs of the app.

For news about the app, like Facebook page or follow the app twitter.

Go and get it 😉

                              

Advertisements

MonoGame for 2D

After a long break of developing on personal projects, due to laziness and a busy schedule (mostly laziness), I decided to take on a new project, I will recreate a game from my childhood! I don’t know the name of the game, I played it at coffee shops (on touch enabled arcades), but I do know how it is supposed to be played:

  • There is a single-player and a multi-player mode;
  • One wall of blocks will come from each player side and advance until it reaches the end, or the wall of the other player, at which point you lose;
  • You can remove blocks, by touching them, if they are adjacent to two or more blocks of the same color/type;
  • The game has no ending, the goal is to score as much points as you can.

With this basic premise for the game in mind I started developing the game. It wasn’t to long until I ran into the first bump in the road, but that was to be expected, the only games I managed to finish was a cheap version of the “The Hangman” and “Pacman” (in 3D!). So with no experience in developing games I started working on a little engine for my game, on top of MonoGame.

Read more of this post

My Vandalized View of Mvvm – Lets code

In the last post I gave an overall view into the MVVM pattern, in this I will put my hands to work and give some examples on what I meant.

In the last post I refereed that the MVVM pattern have three main layers, the view, view model and model. When you are coding to Windows Phone 7 (or WPF in general) the view layer is divided in two parts:

  • The Xaml, the actual user interface.
  • The code behind, code that is associated to behaviors or events of the user interface.

The xaml is just xml, used to define the UI, here is an example:

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
  <Button Content="GetBytes"  Name="GetBytesButton"  />
  <TextBlock Name="textBlock1" Text="TextBlock"  />
</Grid>

Read more of this post

My Vandalized View of Mvvm

As I said before, me and guys are developing stuff to windows phone and what is the architectural pattern for wp7 applications? Model View ViewModel.

So MVVM came after MVC other very popular architectural pattern and I should try to explain one on the concepts of the other. The MVC uses three distinct layers to separate logic:

  • Model – The business layer.
  • View – The presentation layer.
  • Controller – The one responsible to talk and control the other two layers.

Probably the worst error that I’ve made when studying MVVM is to try to connect or treat MVVM as a sub-pattern or a specification of MVC. So try to avoid compare the both until you totally understand MVVM.

MVVM also uses three layers:

  • Model – Same as MVC, your business logic.
  • View – The presentation Layer
  • View Model – The bridge between Model and View, can also be described as the binder.

So what are the differences? The interaction between view and view model is similar to MVC the views notifies the view model that something happened, like a button click, some text inserted etc,etc. The difference is how the view model talks to the view, the view model never (should) call anything related to the view. As an example in MVC is common to you call the view, controller code like view.showData(data) is normal and acceptable since is the way MVC works. In MVVM the view model updates the view changing its own public properties.

 

With the above image, you probably figure out what is happening. The view binds its the graphic elements to properties of the view model, by doing so, it will receive notifications when those properties changed, updating the view. Consider the follow example:

class ViewModel
{
 public string SomeText{get;set;}
 public ICommand SomeOperationThatChangesSomeText {get;set;}

}
class View
{
 Label label;

 public View(ViewModel viewModel)
 {
   label.Text = Bind(viewModel.SomeText);
   viewModel.SomeOperationThaChangesSomeText.Execute();
 }
}

The value of the property Text in the View is binded to the value of the property SomeText in the view model, now imagine that the command SomeOperationThatChangesSomeText changes the value of SomeText, when that happens the labels property Text will “automatically” change to the new value setted by the command.

As you saw there is no direct interaction between view model and the view, that is nice because it completely separates the user interface logic from the business logic.

Note that this post talks only about the practical terms of mvvm there is much more to it, for more details check out the roots of mvvm in the Presentation Model pattern by Martin Fowler

In the next post I’ll show this concepts using the windows phone platform.

%d bloggers like this: