We never keep our confidential information or passwords in open format. That would be very risky, as it might be stolen by someone else. How do we keep our confidential information safe? The best and the easiest way to keep it safe is using some hashing algorithms. In .net, there are couple of hashing algorithms.
Let s write a sample application to test these hashing algorithms
And the output of the program is as follows;
Maintainability, Scalability and extensibility are 3 most important things when you develop an application. Software development team usually composed of at least 2-3 people and most of the time the code has been written exceeds couple of thousands of lines. Because of that, each team member has to agree upon some common rules and restrictions over the project. So, developers will provide a common solution if they face any problem during the development instead of providing a specific solution for his/her part. In order to make it easier, there are some software design patterns that have been proved as best solution can be used. MVVM model is one of those software design patterrns which provides the 3 most important things that we have mentioned above specifically in WPF and Silverlight applications. It was created by John Gossman and it can be thought as a variation of MVC pattern.
MVVM model aims to provide seperating UI elements (UserControl, Page, Control, Window etc.) and related code in code-behind file from each other. In traditional UI programming, the logic belongs to the UI element usually resides in code-behind file.On the other hand,in MVVM model, this will not be the case. The goal is to clear the logic from code-behind file.
View: UI Element in the program is called View in this model and View can be Silverlight Page, User Control, Window, Data Template etc. Why it is called View? because it always displays something when the program runs.
ViewModel: This is the type that contains all the business logic for the View. Shortly, it provides a connection between view and model and keeps the states. View Model Philosophy aims "In this class, just code the business logic without thinking about the controllers"
Model: Model is data that we will use in the application. Data can be an entity returned from WCF RIA services or POCO objects.
View knows about ViewModel but ViewModel does not know about View.
We can say that view knows everything about ViewModel Because elements in UI will be bind to member in view model but ViewModel cannot reach View at all.
ViewModel knows about Model but Model does not know about ViewModel
View Model is able to reach a member of a class and use it but there is no code in model related with view model.
Advantages of MVVM
- Developer gains an ability and discipline to focus on business logic
- There is no need to change anything in ViewModel unless the business logic is changed. It does not matter that any input-output element in view has been changed.
- Blendability of View is increased so that Expression Blend ability is better.
- Binding in XML is easier to controllers. Data Binding in code file will be easier without repating the same code in different places.
- Because the business logic is independent from UI, testing the software is much easier.
- MVVM makes the designer and developer working synchronously and efficiently in the same project.
Refrehing the list or some other item in user control from child window is easy. All you need to do is wire up the child_closed event for child window and that s it. How about refreshing the list in another user control from this child window? There is no relation between the child window and the user control that we want to update. So, we cannot use child_closed event for that user control. Let s talk about the scenerio,
- Assigned Activites (User Control 1) , child window: CLM Activity
- Unassigned Activities (User Control 2)
- Activities ( User Control and it hosts UC1 and UC2)
What we want is, when we click ok button in "CLM Activity" child window, we will refresh UC1 and UC2.
- In Order to that,first, we ll define an event in assigned activities
- Then wire up this event to child window as follows. Child_Closed event is no longer need to be used
- Define OnPopupClosed event in assigned Activities user control. So, once the child window is closed, this event will be raised and Activities are refreshed in assigned activites screen.
- In Activities which is the host user control for the others, We ll wire up the same event handler for assigned activities.
- This event is also raised as well as OnPopupClosed event in Assigned Activities when the child windo is closed. RefreshSelf method refreshes the list in Unassigned Activities user control.
These are the steps to refresh the user control (unassigned activities ) from the other user control (assigned activities).
Exsilio Homepage | Software Development
Expression Blend is a powerful tool. It will write the necessary code for you. It is very easy to add mouse over behavior to any kind of control with silverlight. In the below example, Our goal is to add "MouseOver" and "MouseLeave" behavior to an image. Here are the steps;
1.Write click over the file that you want to add behavior and select "Open in Expression blend..."
2.In the "States" tab of Expression Blend, click on "add states group" icon to create a visual state of the control.
3.Give a name to Visual State Group and specify the Default Transition
4. Click on Add State icon right next to Visual state group that you ve created and give a name to the state. If you notice, VisualState state recording is on. What ever the style you apply on the image is recorded in this period. When you done styling the image (ex: making the border thicker, making it invisible etc.) click on Base at the top to finish.
5. At the end we ll have two states defined (NormalSearch, MouseOverSearch)
6.Switch to Assets tab and in the Behaviors menu select "Go to State Action"
7. Drag and drop "Go to state action" over the image that you want to add behavior
8.Do the same thing for imgExpandHover image.
9.When [GoToStateAction] for imgExpand is selected go to properties at right side of the screen and select "MouseEnter" for event name and "MouseOverSearch" for State Name
10. For imgExpandHover image,select "MouseLeave" as event name and "NormalSearch" for State Name
It will add all the necessary code automatically in .xaml file. We ve just created two states for two images. Initially, imgExpand is visible and imgExpandHover is invisible. In [GotoStateAction] part, events are defined for mouse enter and mouse leave behavior. What it does is, when you hover over the imgExpand, it ll be invisible and imgExpandHover image will be visible. When you do mouse leave from the image, imgExpand will be visible again and imgExpandHover will be invisible. imgExpandHover image has a border around it.So, when you mouse over the image you ll see that its border get thichker. That is basically what we wanted achieve.
Tags: Microsoft Expression Blend
Powered by Exsilio Solutions