3using System.Threading.Tasks;
4using System.Windows.Input;
16 private readonly
Command cancel;
23 this.dialog.DataContext =
this;
25 this.add =
new Command(this.CanExecuteAdd, this.ExecuteAdd);
26 this.cancel =
new Command(this.ExecuteCancel);
34 get => this.selectedLanguage.Value;
37 this.selectedLanguage.Value = value;
38 this.add.RaiseCanExecuteChanged();
53 public ICommand
Add => this.add;
58 public ICommand
Cancel => this.cancel;
60 private bool CanExecuteAdd()
65 private Task ExecuteAdd()
67 this.dialog.DialogResult =
true;
68 return Task.CompletedTask;
71 private Task ExecuteCancel()
73 this.dialog.DialogResult =
false;
74 return Task.CompletedTask;
Interaction logic for AddLanguageDialog.xaml
View model for the Add Language dialog.
ICommand Cancel
Cancel Command
string SelectedLanguage
Language selected
static Iso__639_1.Record[] Languages
ISO 639-1 language codes
Defines a custom command.
Abstract base class for view models
Generic class for properties
Contains one record of the ISO 639-1 data set.
Static class containing ISO 639-1 language codes
static readonly Record[] Data
Available language codes
static bool CodeToLanguage(string Code, out string Language)
Tries to get the language name corresponding to an ISO 639-1 language code.