Ejemplo n.º 1
0
 public TwoWayTranslatorViewModel(TranslatorModel model)
 {
     _model                 = model;
     Languages              = _model.LoadLanguages().ToList();
     SelectedLanguageFrom   = Languages.Find(l => l.Name == model.TwoWaySelectedLanguageFrom);
     SelectedLanguageTo     = Languages.Find(l => l.Name == model.TwoWaySelectedLanguageTo);
     TranslateCommand       = new RelayCommand(c => !string.IsNullOrEmpty(TextFrom), Translate);
     SwapTranslationCommand = new RelayCommand(c => true, SwapTranslation);
 }
 public XmlTranslatorViewModel(TranslatorModel model)
 {
     _model               = model;
     Languages            = _model.LoadLanguages().ToList();
     SelectedLanguageFrom = Languages.Find(l => l.Name == "English");
     TranslateCommand     = new RelayCommand(c => !string.IsNullOrEmpty(TextFrom) &&
                                             !string.IsNullOrEmpty(XmlFileName), Translate);
     LoadXmlCommand       = new RelayCommand(c => !string.IsNullOrEmpty(TextFrom), LoadXml);
     OpenOutputXmlCommand = new RelayCommand(c => !string.IsNullOrEmpty(_model.OutputXml), OpenOutputXml);
 }
Ejemplo n.º 3
0
 public Main(TranslatorModel model)
 {
     _model = model;
     Tabs   = new List <TabItem>();
     Tabs.Add(
         new TabItem
     {
         Header  = "Two Way Translation",
         Content = new TwoWayTranslatorView()
     });
     Tabs.Add(
         new TabItem
     {
         Header  = "XML Translation",
         Content = new XmlTranslatorView()
     });
     SelectedTab = Tabs[0];
 }
Ejemplo n.º 4
0
 public OutWindowViewModel(TranslatorModel model)
 {
     _model = model;
     OnPropertyChanged("OutXml");
     CopyCommand = new RelayCommand(c => true, Copy);
 }