21 December 2010

MVVM Platform Composer

In my 'spare' time I'm developing a WPF pure MVVM platform composer, at the moment I have learned and improved many things like datatemplates nesting to create itemscontrols inside itemscontrols.
The  idea is to create XMLs for XNA WP7 levels games. The first game I'll do is a shoot'em up with a new kind of levels, mixing different missions with achievements.

Note: The enemies are a really old version.






Great indie games are coming :).

12 December 2010

Memcards video ingame for WP7

Hello everyone, Memcards, a new game to learn a lot of vocabulary in a new way, with more than  2000 words in 30 categories, writing as fast as you can, learning in seconds with images and clues, and in an addictive way. Here the video:



Enjoy it now here in Zune

21 October 2010

MemCards for Windows Phone 7 available now on Marketplace

Hello everyone, I have released at Marketplace Memcards:

An amazing and addictive way of learning words, Spanish, English, German, Italian and French. Organized in 30 lessons with more than 2000 words you will see that you learn as fast as you write.

You have clues with images and definitions that makes easier and fast to learn a language, indeed great for kids associating images with the words. Great!

Choose a language for the words you read and a language for the answer you will write and in a few hours you will see that have learned plenty of words. Amazing! 


MemCards is just now available. Take a look at: MemCards or get it at MemCards at Zune

01 September 2010

Tip #1 MVVM Delegate Command with an ObservableCollection

First of all I get the DelegateCommand from the .toolbox courses (I encourage you to download them and find it).

Using this DelegateCommand wich we bind to a button Command for instance (I always add CommandParameter in xaml too, (in order to work fine).

Now my layoutroot datacontext viewmodel has the following property:

private ObservableCollection _sales;
public ObservableCollection Sales
{
  get { return _sales; }
  set
      {
         _sales= value;
         NotifyPropertyChanged("Sales");
         }
        }


And now (in this case is a WPF application, in case you use SL I recommend you to use PagedViewCollection), I instance the command in the constructor:


PaidCommand = new DelegateCommand()
{
 ExecuteCommand = () =>
   {
      bw = new BackgroundWorker();
      bw.RunWorkerCompleted += (s, e) =>
        {
          NotifyPropertyChanged("Sales"); //#1
        };
      bw.DoWork += (s1, e1) =>
        {
           _sales= DM.GetSales(_date1, _date2); //#2
        };
      bw.RunWorkerAsync();
    }

};

 In #2 we process every lines of code we want filling our private fields and when it's finished we publish
simply Notifying them #1 (In my case I have a datagrid with ItemsSource = {Binding Sales})

I hope it helps you (I like this way to do).


And now just a question if any one knows , for other classes I would like to define. Let's suppose a not MVVM environment

Button1.OnClick += (s,e) =>
{
 ...
};

Do you know a way to remove inside the ... the previous delegates like the old way:


Button1.OnClick -= OnButton1Clicked;

26 May 2010

Open asp.net crystal report from Silverlight 4 - Report with List T and List S subreport


1.- The sources: (To do not have CR errors)

Let's suppose (I like when it works) create a Crystal Report with a Subreport and the source are two List and List.

How can I set the sources.
A.- Create a new report in the project.
B.- Set the following as sources (Both the main and the child one):




 C.- Now you add the subreport to the main report:

D.-And add only the child class.
E.- Now in the main Report from database expert remove the child class because we needed it only to be able to add the child report.



In this moment we have defined the design of the report. Now by code we will fill it in the aspx:
 
E.- We add the viewer and a source

F.- In the .cs we add the following: (Create the templates, depending on the version you will need it)



#region Create XML Templates
XEvento xe = new XEvento();
xe.Cliente = "";
xe.Comercial = "";
xe.Fecha = new DateTime(2010, 10, 10);
xe.SerializeObj(XEvento.ItemsFile);

XHistorico xh = new XHistorico();
xh.Nombre = "Prueba";
xh.Fecha = new DateTime(2010, 10, 10);
xh.Detalle = "Esto es otra prueba";
xh.SerializeObj(XHistorico.ItemsFile);
#endregion

G.- Fill the two lists with your data.
H.- On Page_Load:
this.CrystalReportSource1.ReportDocument.Subreports[0].SetDataSource(xhs);
            this.CrystalReportSource1.ReportDocument.SetDataSource(xes);


And that's all the first part in the asp.net


2.- In a method in the silverlight:


private void BPrint_Click(object sender, RoutedEventArgs e)
        {
            HtmlPopupWindowOptions options = new HtmlPopupWindowOptions()
            {
                Directories = false,
                Location = false,
                Menubar = false,
                Status = false,
                Toolbar = false,
            };

            HtmlPage.PopupWindow(new Uri("http://localhost:51694/Reporting.aspx?Fecha=" + DP.SelectedDate.Value.Date.ToShortDateString().Replace('/','.') ), "_blank", options);
        }


3.- In the Page_Load in the asp.net capture the parameter:


this.TextBox1.Text = HttpContext.Current.Request.Params["Fecha"];

Now you have to set it as a parameter of the crystal report and that's all.

15 March 2010

Tip: Gimp remove red lines

If you have scracths, dust or anything that makes your pictures with lines or bands, apply the filter disparasite, check adaptative, uncheck recursive, radius =1,black level = -1, white level = 256
And that's all

09 March 2010

Tip for WPF Mess Resizing

When you begin to add containers and controls inside a WPF and you resize the form, you realize that the mess that happens, what you should do to keep the form is change the main grid container to a canvas, and you will have the control again.