Ejemplo n.º 1
0
        public MainViewModel()
        {
            _model   = new MainModel();
            _dialogs = new ObservableCollection <DialogViewModel>(_model.Dialogs.Select(
                                                                      d => new DialogViewModel(d)));
            Dialogs = new ReadOnlyObservableCollection <DialogViewModel>(_dialogs);
            Watch(_model.Dialogs, _dialogs, model => model.Messages);

            AddDialogCommand = new DelegateCommand(() =>
            {
                if (!string.IsNullOrEmpty(LoginToAddDialog))
                {
                    _model.AddDialog(LoginToAddDialog);
                    LoginToAddDialog = null; // Empty field.
                }
            });
        }