I need to make an application which has two windows:
Window 1
Contains 6 countdown timers.
Window 2
Here will the settings og the individual timers be set.
What will be the best solution for this functionality? I will be using c# wpf and .Net 4.0
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
MVVM
1. CountDownView
Represents a single timer View, simple TextBlock bound to a
CurrentValueproperty or something more nice/complex instead of TextBlock2. CountDownViewModel
Represents a single timer itself, expose property
int CurrentValuedisplayed as countdown number on the View. To implement countdown you can use Sytem.Timers.Timer and in Elapsed event handler just decrement CurrentValue property value3. TimersView – for first window with 6 timers
ItemsSource – bound to a
Timersproperty ofTimersViewModel, basically TimersViewModel shoudl be set to DataContext of the TimersView so you woudl eb able to specify following binding: (and each item will be bound to single Timer)<ListView ItemsSource="{Binding Timers}" ... />4. TimersViewModel – expose
IEnumerable<CountDownViewModel> Timersproperty5. SettingsView – Settings panel
PS: INotifyPropertyChanged for all VM properties exposed to Views
Homework for you: