Exemple #1
0
 private ObservableCollection <TransmitterViewModel> CreateTransmitters(List <Transmitter> all)
 {
     return(new ObservableCollection <TransmitterViewModel>(all.Select(d =>
     {
         var viewModel = new TransmitterViewModel(d, _dialogService, _mainView);
         viewModel.WhenSaveRequested.Subscribe(SaveItem);
         return viewModel;
     })));
 }
Exemple #2
0
        private Task NewTransmitterExecute(object arg)
        {
            var transmitter = new Transmitter();

            transmitter.Id          = Guid.NewGuid();
            transmitter.DisplayName = "New transmitter";
            transmitter.Encoding    = Encoding.UTF8;
            _transmitterProvider.SaveAsync(transmitter);

            var viewModel = new TransmitterViewModel(transmitter, _dialogService, _mainView);

            Transmitters.Add(viewModel);

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

            return(Task.CompletedTask);
        }