public async Task <FavoriteItemViewModel> GetFavoriteItemViewModel(Guid key = default(Guid)) { var fileItems = new List <WorkspaceItemModel>() { InputStreamItem }; fileItems.AddRange(await GetFileSystemItems()); if (key == default(Guid)) { return(new FavoriteItemViewModel(fileItems) { FileKey = Selected, Command = CommandExecutionModel?.CommandText }); } else { var item = await FavoriteRepository.GetItem(key); return(new FavoriteItemViewModel(fileItems, item.Key) { Title = item.Title, FileKey = item.FileKey, Command = item.Command, }); } }
public async Task ExecuteFavoriteItemViewModel(Guid key) { var item = await FavoriteRepository.GetItem(key); CommandExecutionModel.CommandText = item.Command; if (Selected != item.FileKey) { await SetSelected(item.FileKey); } SelectedChanged?.Invoke(); await CommandExecutionModel.RunCommand(); }