public void Show(ViewModelBase viewModel) { StartViewViewModel vm = (StartViewViewModel)viewModel; this.lbFavorites.DataSource = vm.FavoriteMessages; this.lbFavorites.DisplayMember = nameof(DefinedMessageViewModel.MessageText); this.lbFavorites.ValueMember = nameof(DefinedMessageViewModel.Id); Visible = true; }
public void Show() { view = context.CreateView(typeof(StartViewViewModel)); var favorites = messageDefinitionService.GetFavoriteMessages() .Select(x => new DefinedMessageViewModel() { MessageText = x.MessageText }) .ToList(); var defined = messageDefinitionService.GetMessageDefinitions() .Select(x => new DefinedMessageViewModel() { MessageText = x.MessageText }) .ToList(); viewModel = new StartViewViewModel(defined, favorites); view.Show(viewModel); }