Καλώς ορίσατε στο dotNETZone.gr - Σύνδεση | Εγγραφή | Βοήθεια

C# and .NET Tips and Tricks

Quests in programming in .NET
Going from Model-View-Presenter to MV-VM with WPF Commands (Part #3: MVVM and Commands)
In previous posts ( Part 1 and Part2 ) I have presented the implementation of a toy application using the Model-View-Presenter pattern and Routed Commands. In this final post, I will present the migration to MVVM. In Part2 , we have reached a point where we have managed to partly centralize the logic that is needed to be implemented for each Command but we were not yet fully satisfied with the wiring that needed to be done in the code-behind file. So, we will try to tackle this problem: Approach #4 Our first

Διαβάστε περισσότερα »

Posted: Δευτέρα, 12 Οκτωβρίου 2009 8:44 πμ από iwannis | 0 σχόλια
Δημοσίευση στην κατηγορία:
Going from Model-View-Presenter to MV-VM with WPF Commands (Part #2: Commands with MVP)
In my previous post , I have presented the first two approaches for implementing the GUI and the logic of a toy application: Approach #1: All the logic in the code behind file. Approach #2: The Model-View-Presenter pattern. In this post, we will pick up from where we stopped, in our route to migrate to the benefits of the MVVM model and the use of Commands. It is recommended to take a look at the previous post in order to get an idea of the application and the two previous approaches) Approach #3: A hybrid MVP

Διαβάστε περισσότερα »

Posted: Δευτέρα, 12 Οκτωβρίου 2009 8:25 πμ από iwannis | 0 σχόλια
Δημοσίευση στην κατηγορία:
Going from Model-View-Presenter to MV-VM with WPF Commands (Part #1: MVP)
In this post I will try to show the application of the MVP and MV-VM programming approaches and the use of WPF commands in them. I will start with a simple Window in WPF with all the code intertwined in the code-behind file and transform it to a Window with no code at all at the code-behind file, showing the separation between the view and the logic that is achieved with MV-VM and Commands. The Window is the following: The "Add Client" adds a new client, the "Delete Client" removes the selected

Διαβάστε περισσότερα »

Posted: Τρίτη, 6 Οκτωβρίου 2009 9:01 πμ από iwannis | 0 σχόλια
Δημοσίευση στην κατηγορία:
WPF Designer Error "Could not create an instance of type"
Suppose that in a WPF application there are some custom User Controls implemented. During development in some windows that use the custom User Control you may find that the designer cannot load them and instead it gives the following error: "Could not create an instance of type YOURCONTROLHERE" This happens because the designer runs the constructor for the User Control whenever it needs to display it in design mode. Within the constructor something throws an exception. Sometimes this does not mean

Διαβάστε περισσότερα »

Posted: Κυριακή, 20 Σεπτεμβρίου 2009 10:48 πμ από iwannis | 0 σχόλια
Δημοσίευση στην κατηγορία:
New Look !
This Blog has now a new look ! Hope you like it.

Διαβάστε περισσότερα »

NHibernate, PropertyChanged event and WPF
A typical implementation of an entity that supports the INotifyPropertyChanged interface for WPF Binding is for example as follows: public class Detail:INotifyPropertyChanged { private long _iD; public virtual long ID { get { return _iD; } set { _iD = value ; if (PropertyChanged != null ) PropertyChanged( this , new PropertyChangedEventArgs("ID"));} } private string _line1; public virtual string Line1 { get { return _line1; } set { _line1 = value ; if (PropertyChanged != null ) PropertyChanged( this

Διαβάστε περισσότερα »

Posted: Παρασκευή, 28 Αυγούστου 2009 4:30 μμ από iwannis | 0 σχόλια
Δημοσίευση στην κατηγορία: ,
Timers in WPF
There are times when you need a task to execute periodically. There are two ways of achieving this: Use the System.Windows.Threading. DispatcherTimer Use the System.Threading. Timer Say now that you want to implement a class the executes DoSomething() periodically and also informs through a delegate to whoever listens whent the execution is performed. The class for DispatcherTimer is as follows: public class DTimer { private DispatcherTimer timer; public event Action < int > DoSomething; private int _timesCalled

Διαβάστε περισσότερα »

Posted: Παρασκευή, 31 Ιουλίου 2009 8:44 πμ από iwannis | 0 σχόλια
Δημοσίευση στην κατηγορία: ,
CAPTCHA design and implementation
In my first blogging days, I received a comment for a post saying how wonderful and special the thing I did was. I was thrilled! Then I received 5 more comments with exactly the same sentence and then 5 more and I realized that this was my first encounter with comment spamming. In order to avoid this I present here a way to add a custom made CAPTCHA ( C ompletely A utomated P ublic T uring test to tell C omputers and H umans A part) in Blogengine.Net (1.4.5.0). The code below is based on ideas from the implementation

Διαβάστε περισσότερα »

Posted: Κυριακή, 26 Ιουλίου 2009 10:48 πμ από iwannis | 0 σχόλια
Δημοσίευση στην κατηγορία:
NHibernate inverse="true" and cascade="save-update" demo
We will work with the following database schema: The corresponding domain model is as follows: Entity.cs public class Entity { private long _iD; public virtual long ID { get { return _iD; } set { _iD = value ;} } private string _description; public virtual string Description { get { return _description; } set { _description = value ;} } private IList < Detail > _details; public virtual IList < Detail > Details { get { return _details; } set { _details = value ; } } (...) Detail.cs public class Detail

Διαβάστε περισσότερα »

Instantiating a class written in XAML from code.
There are some times when you want to write a specific framgent of the UI in XAML and then intantiate it in a code-behind file. This can also lead to the strange situation of being able to change the UI design completely afer the application has been compiled and shipped. Here is how such thing can be done: Suppose that you have written the following XAML code: < StackPanel xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns : x ="http://schemas.microsoft.com/winfx/2006/xaml"

Διαβάστε περισσότερα »

Posted: Παρασκευή, 17 Απριλίου 2009 3:14 μμ από iwannis | 0 σχόλια
Δημοσίευση στην κατηγορία:
Περισσότερες Δημοσιεύσεις « Προηγούμενη