-
Notifications
You must be signed in to change notification settings - Fork 1
/
PlayTunePageViewModel.cs
69 lines (63 loc) · 2.21 KB
/
PlayTunePageViewModel.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DevExpress.Mvvm;
using DevExpress.Mvvm.POCO;
namespace VM_DrivenWizard.ViewModels
{
public class PlayTunePageViewModel : WizardViewModelBase, ISupportWizardNextCommand, ISupportWizardFinishCommand
{
public static PlayTunePageViewModel Create()
{
return ViewModelSource.Create(() => new PlayTunePageViewModel());
}
protected PlayTunePageViewModel()
{
ShowBack = true;
ShowCancel = true;
ShowNext = true;
AllowBack = true;
AllowCancel = true;
}
public string Header { get { return "Step 2 - Play a tune"; } }
public string Description { get { return "To make this demo more entertaining, we would like to play a tune for you. Simple choose your favorite track."; } }
public void Play()
{
string text = @"Sorry, but we don't have that song in our library..." + Environment.NewLine;
text += @"But we are agree with you that ""{0}"" is an exellent choice.";
text = string.Format(text, Model.Song);
this.GetService<IMessageBoxService>().ShowMessage(text, "Wizard", MessageButton.OK, MessageIcon.Information);
}
public bool CanPlay()
{
return Model != null && !string.IsNullOrEmpty(Model.Song);
}
public virtual string Song { get; set; }
public bool CanGoForward
{
get { return CanPlay(); }
}
public bool CanFinish
{
get
{
return true;
}
}
protected virtual void OnSongChanged()
{
Model.Song = Song;
}
public void OnGoForward(CancelEventArgs e)
{
this.GetRequiredService<IWizardService>().Navigate("CongratulationsPage", Model, this);
}
public void OnFinish(CancelEventArgs e)
{
this.GetService<IMessageBoxService>().ShowMessage("You have finished the tour.", "WPF Tour", MessageButton.OK, MessageIcon.Exclamation);
}
}
}