Exemplo n.º 1
0
        private ObservableCollection <ReceiverViewModel> CreateReceivers(List <Receiver> items)
        {
            var result = new ObservableCollection <ReceiverViewModel>(items.Select(d =>
            {
                var item = new ReceiverViewModel(d);
                item.WhenSaveRequested.Subscribe(SaveItem);
                return(item);
            }));

            return(result);
        }
Exemplo n.º 2
0
        private Task NewReceiverExecute(object arg)
        {
            var receiver = new Receiver();

            receiver.Id          = Guid.NewGuid();
            receiver.DisplayName = "New receiver";
            receiver.Encoding    = Encoding.UTF8;
            _receiverProvider.SaveAsync(receiver);

            var viewModel = new ReceiverViewModel(receiver);

            Receivers.Add(viewModel);

            if (_applicationSettings.FocusTabOnCreate)
            {
                OpenItemExecute(viewModel);
            }

            return(Task.CompletedTask);
        }